Arm9Support.S 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #------------------------------------------------------------------------------
  2. #
  3. # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
  4. #
  5. # This program and the accompanying materials
  6. # are licensed and made available under the terms and conditions of the BSD License
  7. # which accompanies this distribution. The full text of the license may be found at
  8. # http://opensource.org/licenses/bsd-license.php
  9. #
  10. # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  12. #
  13. #------------------------------------------------------------------------------
  14. .text
  15. .align 2
  16. GCC_ASM_EXPORT(ArmCleanInvalidateDataCache)
  17. GCC_ASM_EXPORT(ArmCleanDataCache)
  18. GCC_ASM_EXPORT(ArmInvalidateDataCache)
  19. GCC_ASM_EXPORT(ArmInvalidateInstructionCache)
  20. GCC_ASM_EXPORT(ArmInvalidateDataCacheEntryByMVA)
  21. GCC_ASM_EXPORT(ArmCleanDataCacheEntryByMVA)
  22. GCC_ASM_EXPORT(ArmCleanInvalidateDataCacheEntryByMVA)
  23. GCC_ASM_EXPORT(ArmEnableMmu)
  24. GCC_ASM_EXPORT(ArmDisableMmu)
  25. GCC_ASM_EXPORT(ArmMmuEnabled)
  26. GCC_ASM_EXPORT(ArmEnableDataCache)
  27. GCC_ASM_EXPORT(ArmDisableDataCache)
  28. GCC_ASM_EXPORT(ArmEnableInstructionCache)
  29. GCC_ASM_EXPORT(ArmDisableInstructionCache)
  30. GCC_ASM_EXPORT(ArmEnableBranchPrediction)
  31. GCC_ASM_EXPORT(ArmDisableBranchPrediction)
  32. GCC_ASM_EXPORT(ArmDataMemoryBarrier)
  33. GCC_ASM_EXPORT(ArmDataSyncronizationBarrier)
  34. GCC_ASM_EXPORT(ArmInstructionSynchronizationBarrier)
  35. .set DC_ON, (1<<2)
  36. .set IC_ON, (1<<12)
  37. #------------------------------------------------------------------------------
  38. ASM_PFX(ArmInvalidateDataCacheEntryByMVA):
  39. mcr p15, 0, r0, c7, c6, 1 @ invalidate single data cache line
  40. bx lr
  41. ASM_PFX(ArmCleanDataCacheEntryByMVA):
  42. mcr p15, 0, r0, c7, c10, 1 @ clean single data cache line
  43. bx lr
  44. ASM_PFX(ArmCleanInvalidateDataCacheEntryByMVA):
  45. mcr p15, 0, r0, c7, c14, 1 @ clean and invalidate single data cache line
  46. bx lr
  47. ASM_PFX(ArmEnableInstructionCache):
  48. ldr r1,=IC_ON
  49. mrc p15,0,r0,c1,c0,0 @Read control register configuration data
  50. orr r0,r0,r1 @Set I bit
  51. mcr p15,0,r0,c1,c0,0 @Write control register configuration data
  52. bx LR
  53. ASM_PFX(ArmDisableInstructionCache):
  54. ldr r1,=IC_ON
  55. mrc p15,0,r0,c1,c0,0 @Read control register configuration data
  56. bic r0,r0,r1 @Clear I bit.
  57. mcr p15,0,r0,c1,c0,0 @Write control register configuration data
  58. bx LR
  59. ASM_PFX(ArmInvalidateInstructionCache):
  60. mov r0,#0
  61. mcr p15,0,r0,c7,c5,0 @Invalidate entire Instruction cache.
  62. @Also flushes the branch target cache.
  63. mov r0,#0
  64. mcr p15,0,r0,c7,c10,4 @Data write buffer
  65. bx LR
  66. ASM_PFX(ArmEnableMmu):
  67. mrc p15,0,R0,c1,c0,0
  68. orr R0,R0,#1
  69. mcr p15,0,R0,c1,c0,0
  70. bx LR
  71. ASM_PFX(ArmMmuEnabled):
  72. mrc p15,0,R0,c1,c0,0
  73. and R0,R0,#1
  74. bx LR
  75. ASM_PFX(ArmDisableMmu):
  76. mrc p15,0,R0,c1,c0,0
  77. bic R0,R0,#1
  78. mcr p15,0,R0,c1,c0,0
  79. mov R0,#0
  80. mcr p15,0,R0,c7,c10,4 @Drain write buffer
  81. bx LR
  82. ASM_PFX(ArmEnableDataCache):
  83. ldr R1,=DC_ON
  84. mrc p15,0,R0,c1,c0,0 @Read control register configuration data
  85. orr R0,R0,R1 @Set C bit
  86. mcr p15,0,r0,c1,c0,0 @Write control register configuration data
  87. bx LR
  88. ASM_PFX(ArmDisableDataCache):
  89. ldr R1,=DC_ON
  90. mrc p15,0,R0,c1,c0,0 @Read control register configuration data
  91. bic R0,R0,R1 @Clear C bit
  92. mcr p15,0,r0,c1,c0,0 @Write control register configuration data
  93. bx LR
  94. ASM_PFX(ArmCleanDataCache):
  95. mrc p15,0,r15,c7,c10,3
  96. bne ASM_PFX(ArmCleanDataCache)
  97. mov R0,#0
  98. mcr p15,0,R0,c7,c10,4 @Drain write buffer
  99. bx LR
  100. ASM_PFX(ArmInvalidateDataCache):
  101. mov R0,#0
  102. mcr p15,0,R0,c7,c6,0 @Invalidate entire data cache
  103. mov R0,#0
  104. mcr p15,0,R0,c7,c10,4 @Drain write buffer
  105. bx LR
  106. ASM_PFX(ArmCleanInvalidateDataCache):
  107. mrc p15,0,r15,c7,c14,3
  108. bne ASM_PFX(ArmCleanInvalidateDataCache)
  109. mov R0,#0
  110. mcr p15,0,R0,c7,c10,4 @Drain write buffer
  111. bx LR
  112. ASM_PFX(ArmEnableBranchPrediction):
  113. bx LR @Branch prediction is not supported.
  114. ASM_PFX(ArmDisableBranchPrediction):
  115. bx LR @Branch prediction is not supported.
  116. ASM_PFX(ArmDataMemoryBarrier):
  117. mov R0, #0
  118. mcr P15, #0, R0, C7, C10, #5 @ check if this is OK?
  119. bx LR
  120. ASM_PFX(ArmDataSyncronizationBarrier):
  121. mov R0, #0
  122. mcr P15, #0, R0, C7, C10, #4 @ check if this is OK?
  123. bx LR
  124. ASM_PFX(ArmInstructionSynchronizationBarrier):
  125. mov R0, #0
  126. mcr P15, #0, R0, C7, C5, #4 @ check if this is OK?
  127. bx LR
  128. ASM_FUNCTION_REMOVE_IF_UNREFERENCED