Spectrum refarming (SR) refers to a radio resource management technique which allows different generations of cellular networks to operate in the same radio spectrum. In this paper, an underlay SR model is proposed, in which an Orthogonal Frequency Division Multiple Access (OFDMA) system refarms the spectrum of a Code Division Multiple Access (CDMA) system through intelligently exploiting the interference margin provided by the CDMA system. We investigate the mutual effect of the two systems by evaluating the asymptotic signal-to-interference-plus-noise ratio (SINR) of the users, based on which the interference margin tolerable by the CDMA system is determined. By using the interference margin together with the transmit power constraints, the uplink resource allocation problem of OFDMA system is formulated and solved through dual decomposition method. Simulation results have verified our theoretical analysis, and validated the effectiveness of the proposed resource allocation algorithm and its capability to protect the legacy CDMA users. The proposed SR system requires the least information flow from the CDMA system to the OFDMA system, and importantly, no upgrading of legacy CDMA system is needed; thus it can be deployed by telecom operators to maximize the spectral efficiency of their cellular networks.