lib_hssubr.S
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:4k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * Copyright (C) 2000, 2001 Broadcom Corporation
  3.  *
  4.  * This program is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU General Public License
  6.  * as published by the Free Software Foundation; either version 2
  7.  * of the License, or (at your option) any later version.
  8.  *
  9.  * This program is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  * GNU General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, write to the Free Software
  16.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  17.  */
  18. #include <asm/asm.h>
  19. #include <asm/addrspace.h>
  20. #include <asm/mipsregs.h>
  21. #include <asm/regdef.h>
  22.  .set mips64
  23. #define HAZARD SSNOP ; SSNOP ; SSNOP ; SSNOP ; SSNOP ; SSNOP ; SSNOP
  24. /*  *********************************************************************
  25.     *  hs_read8 - read 8-bit bytes
  26.     ********************************************************************* */
  27. LEAF(hs_read8)
  28. mfc0 t2, CP0_STATUS
  29. or t1, t2, ST0_KX
  30. mtc0 t1, CP0_STATUS
  31. HAZARD
  32. dli v0, PHYS_TO_XKSEG_UNCACHED(0)
  33. dsll a0, a0, 32
  34. dsrl a0, a0, 32
  35. or a0, a0,v0
  36. lb v0, (a0)
  37. and v0, 0xFF
  38. mtc0 t2, CP0_STATUS
  39. HAZARD
  40. j ra
  41. END(hs_read8)
  42. /*  *********************************************************************
  43.     *  hs_read16 - read 16-bit shorts
  44.     ********************************************************************* */
  45. LEAF(hs_read16)
  46. mfc0 t2, CP0_STATUS
  47. or t1, t2, ST0_KX
  48. mtc0 t1, CP0_STATUS
  49. HAZARD
  50. dli v0, PHYS_TO_XKSEG_UNCACHED(0)
  51. dsll a0, a0, 32
  52. dsrl a0, a0, 32
  53. or a0, a0, v0
  54. lh v0, (a0)
  55. and v0, 0xFFFF
  56. mtc0 t2, CP0_STATUS
  57. HAZARD
  58. j ra
  59. END(hs_read16)
  60. /*  *********************************************************************
  61.     *  hs_read32 - read 32-bit ints
  62.     ********************************************************************* */
  63. LEAF(hs_read32)
  64. mfc0 t2, CP0_STATUS
  65. or t1, t2, ST0_KX
  66. mtc0 t1, CP0_STATUS
  67. HAZARD
  68. dli v0, PHYS_TO_XKSEG_UNCACHED(0)
  69. dsll a0, a0, 32
  70. dsrl a0, a0, 32
  71. or a0, a0, v0
  72. lw v0, (a0)
  73. and v0, 0xFFFFFFFF
  74. mtc0 t2, CP0_STATUS
  75. HAZARD
  76. j ra
  77. END(hs_read32)
  78. /*  *********************************************************************
  79.     *  hs_read64 - read 64-bit longs
  80.     ********************************************************************* */
  81. LEAF(hs_read64)
  82. mfc0 t2, CP0_STATUS
  83. or t1, t2, ST0_KX
  84. mtc0 t1, CP0_STATUS
  85. HAZARD
  86. dli v0, PHYS_TO_XKSEG_UNCACHED(0)
  87. dsll a0, a0, 32
  88. dsrl a0, a0, 32
  89. or a0, a0, v0
  90. ld v0, (a0)
  91. mtc0 t2, CP0_STATUS
  92. HAZARD
  93. j ra
  94. END(hs_read64)
  95. /*  *********************************************************************
  96.     *  hs_write8 - write 8-bit bytes
  97.     ********************************************************************* */
  98. LEAF(hs_write8)
  99. mfc0 t2, CP0_STATUS
  100. or t1, t2, ST0_KX
  101. mtc0 t1, CP0_STATUS
  102. HAZARD
  103. dli v0, PHYS_TO_XKSEG_UNCACHED(0)
  104. dsll a0, a0, 32
  105. dsrl a0, a0, 32
  106. or a0, a0, v0
  107. sb a1, (a0)
  108. mtc0 t2, CP0_STATUS
  109. HAZARD
  110. j ra
  111. END(hs_write8)
  112. /*  *********************************************************************
  113.     *  hs_write16 - write 16-bit shorts
  114.     ********************************************************************* */
  115. LEAF(hs_write16)
  116. mfc0 t2, CP0_STATUS
  117. or t1, t2, ST0_KX
  118. mtc0 t1, CP0_STATUS
  119. HAZARD
  120. dli v0, PHYS_TO_XKSEG_UNCACHED(0)
  121. dsll a0, a0, 32
  122. dsrl a0, a0, 32
  123. or a0, a0, v0
  124. sh a1, (a0)
  125. mtc0 t2, CP0_STATUS
  126. HAZARD
  127. j ra
  128. END(hs_write16)
  129. /*  *********************************************************************
  130.     *  hs_write32 - write 32-bit longs
  131.     ********************************************************************* */
  132. LEAF(hs_write32)
  133. mfc0 t2, CP0_STATUS
  134. or t1, t2, ST0_KX
  135. mtc0 t1, CP0_STATUS
  136. HAZARD
  137. dli v0, PHYS_TO_XKSEG_UNCACHED(0)
  138. dsll a0, a0, 32
  139. dsrl a0, a0, 32
  140. or a0, a0, v0
  141. sw a1, (a0)
  142. mtc0 t2, CP0_STATUS
  143. HAZARD
  144. j ra
  145. END(hs_write32)
  146. /*  *********************************************************************
  147.     *  hs_write64 - write 64-bit longs
  148.     ********************************************************************* */
  149. LEAF(hs_write64)
  150. mfc0 t2, CP0_STATUS
  151. or t1, t2, ST0_KX
  152. mtc0 t1, CP0_STATUS
  153. HAZARD
  154. dli v0, PHYS_TO_XKSEG_UNCACHED(0)
  155. dsll a0, a0, 32
  156. dsrl a0, a0, 32
  157. or a0, a0, v0
  158. sd a1, (a0)
  159. mtc0 t2, CP0_STATUS
  160. HAZARD
  161. j ra
  162. END(hs_write64)