bl cache_on跳转的返回

bl	cache_on                              	@ bl跳转会将返回地址(下一条指令的地址)保存到lr
转载地址:https://blog.csdn.net/coldsnow33/article/details/37727331
  1. cache_on: mov r3, #8 @ cache_on function //偏移为8,对应cache_on

  2. b call_cache_fn @ b跳转不会将返回地址保存到lr

http://blog.csdn.net/coldsnow33/article/details/37727621

 
  1. call_cache_fn: adr r12, proc_types

  2. #ifdef CONFIG_CPU_CP15

  3. mrc p15, 0, r9, c0, c0 @ get processor ID

  4. #else

  5. ldr r9, =CONFIG_PROCESSOR_ID

  6. #endif

  7. 1: ldr r1, [r12, #0] @ get value

  8. ldr r2, [r12, #4] @ get mask

  9. eor r1, r1, r9 @ (real ^ match)

  10. tst r1, r2 @ & mask

  11. ARM( addeq pc, r12, r3 ) @ call cache function

  12. THUMB( addeq r12, r3 )

  13. THUMB( moveq pc, r12 ) @ call cache function//match到ID后就跳转到对应架构的cache_on了

  14. add r12, r12, #PROC_ENTRY_SIZE @ 没有match到ID,PROC_ENTRY_SIZE为4*5,每条指令4byte,proc_types表中每个架构对应5个条目

  15. b 1b @ 再跳转回tag1时, r12保存了下一个架构的条目,继续match

 
  1. .align 2

  2. .type proc_types,#object

  3. proc_types:

  4. .word 0x41000000 @ old ARM ID

  5. .word 0xff00f000

  6. mov pc, lr

  7. THUMB( nop )

  8. mov pc, lr

  9. THUMB( nop )

  10. mov pc, lr

  11. THUMB( nop )

  12.  
  13. .word 0x41007000 @ ARM7/710

  14. .word 0xfff8fe00

  15. mov pc, lr

  16. THUMB( nop )

  17. mov pc, lr

  18. THUMB( nop )

  19. mov pc, lr

  20. THUMB( nop )

  21.  
  22. .word 0x41807200 @ ARM720T (writethrough)

  23. .word 0xffffff00

  24. W(b) __armv4_mmu_cache_on

  25. W(b) __armv4_mmu_cache_off

  26. mov pc, lr

  27. THUMB( nop )

  28.  
  29. .word 0x41007400 @ ARM74x

  30. .word 0xff00ff00

  31. W(b) __armv3_mpu_cache_on

  32. W(b) __armv3_mpu_cache_off

  33. W(b) __armv3_mpu_cache_flush

  34.  
  35. .word 0x41009400 @ ARM94x

  36. .word 0xff00ff00

  37. W(b) __armv4_mpu_cache_on

  38. W(b) __armv4_mpu_cache_off

  39. W(b) __armv4_mpu_cache_flush

  40.  
  41. .word 0x41069260 @ ARM926EJ-S (v5TEJ)

  42. .word 0xff0ffff0

  43. W(b) __arm926ejs_mmu_cache_on

  44. W(b) __armv4_mmu_cache_off

  45. W(b) __armv5tej_mmu_cache_flush

  46.  
  47. .word 0x00007000 @ ARM7 IDs

  48. .word 0x0000f000

  49. mov pc, lr

  50. THUMB( nop )

  51. mov pc, lr

  52. THUMB( nop )

  53. mov pc, lr

  54. THUMB( nop )

  55.  
  56. @ Everything from here on will be the new ID system.

  57.  
  58. .word 0x4401a100 @ sa110 / sa1100

  59. .word 0xffffffe0

  60. W(b) __armv4_mmu_cache_on

  61. W(b) __armv4_mmu_cache_off

  62. W(b) __armv4_mmu_cache_flush

  63.  
  64. .word 0x6901b110 @ sa1110

  65. .word 0xfffffff0

  66. W(b) __armv4_mmu_cache_on

  67. W(b) __armv4_mmu_cache_off

  68. W(b) __armv4_mmu_cache_flush

  69.  
  70. .word 0x56056900

  71. .word 0xffffff00 @ PXA9xx

  72. W(b) __armv4_mmu_cache_on

  73. W(b) __armv4_mmu_cache_off

  74. W(b) __armv4_mmu_cache_flush

  75.  
  76. .word 0x56158000 @ PXA168

  77. .word 0xfffff000

  78. W(b) __armv4_mmu_cache_on

  79. W(b) __armv4_mmu_cache_off

  80. W(b) __armv5tej_mmu_cache_flush

  81.  
  82. .word 0x56050000 @ Feroceon

  83. .word 0xff0f0000

  84. W(b) __armv4_mmu_cache_on

  85. W(b) __armv4_mmu_cache_off

  86. W(b) __armv5tej_mmu_cache_flush

  87.  
  88. #ifdef CONFIG_CPU_FEROCEON_OLD_ID

  89. /* this conflicts with the standard ARMv5TE entry */

  90. .long 0x41009260 @ Old Feroceon

  91. .long 0xff00fff0

  92. b __armv4_mmu_cache_on

  93. b __armv4_mmu_cache_off

  94. b __armv5tej_mmu_cache_flush

  95. #endif

  96.  
  97. .word 0x66015261 @ FA526

  98. .word 0xff01fff1

  99. W(b) __fa526_cache_on

  100. W(b) __armv4_mmu_cache_off

  101. W(b) __fa526_cache_flush

  102.  
  103. @ These match on the architecture ID

  104.  
  105. .word 0x00020000 @ ARMv4T

  106. .word 0x000f0000

  107. W(b) __armv4_mmu_cache_on

  108. W(b) __armv4_mmu_cache_off

  109. W(b) __armv4_mmu_cache_flush

  110.  
  111. .word 0x00050000 @ ARMv5TE

  112. .word 0x000f0000

  113. W(b) __armv4_mmu_cache_on

  114. W(b) __armv4_mmu_cache_off

  115. W(b) __armv4_mmu_cache_flush

  116.  
  117. .word 0x00060000 @ ARMv5TEJ

  118. .word 0x000f0000

  119. W(b) __armv4_mmu_cache_on

  120. W(b) __armv4_mmu_cache_off

  121. W(b) __armv5tej_mmu_cache_flush

  122.  
  123. .word 0x0007b000 @ ARMv6

  124. .word 0x000ff000

  125. W(b) __armv6_mmu_cache_on

  126. W(b) __armv4_mmu_cache_off

  127. W(b) __armv6_mmu_cache_flush

  128.  
  129. .word 0x000f0000 @ new CPU Id

  130. .word 0x000f0000

  131. W(b) __armv7_mmu_cache_on

  132. W(b) __armv7_mmu_cache_off

  133. W(b) __armv7_mmu_cache_flush

  134.  
  135. .word 0 @ unrecognised type

  136. .word 0

  137. mov pc, lr

  138. THUMB( nop )

  139. mov pc, lr

  140. THUMB( nop )

  141. mov pc, lr

  142. THUMB( nop )

  143.  
  144. .size proc_types, . - proc_types

  145.  

如果ID没有match,就会查到表中的最后一个条目,mov pc, lr,跳回去。

 
  1. armv7_mmu_cache_on:

  2. mov r12, lr @ lr保存的是bl cache_on的下一条指令,下面还有tag的跳转,会重写lr,需要保存lr到其他寄存器#ifdef CONFIG_MMU

  3. mrc p15, 0, r11, c0, c1, 4 @ read ID_MMFR0

  4. tst r11, #0xf @ VMSA

  5. movne r6, #CB_BITS | 0x02 @ !XN

  6. blne __setup_mmu @ bl跳转会保存返回地址到lr

  7. mov r0, #0

  8. mcr p15, 0, r0, c7, c10, 4 @ drain write buffer

  9. tst r11, #0xf @ VMSA

  10. mcrne p15, 0, r0, c8, c7, 0 @ flush I,D TLBs

  11. #endif

  12. mrc p15, 0, r0, c1, c0, 0 @ read control reg

  13. bic r0, r0, #1 << 28 @ clear SCTLR.TRE

  14. orr r0, r0, #0x5000 @ I-cache enable, RR cache replacement

  15. orr r0, r0, #0x003c @ write buffer

  16. bic r0, r0, #2 @ A (no unaligned access fault)

  17. orr r0, r0, #1 << 22 @ U (v6 unaligned access model)

  18. @ (needed for ARM1176)

  19. #ifdef CONFIG_MMU

  20. ARM_BE8( orr r0, r0, #1 << 25 ) @ big-endian page tables

  21. mrcne p15, 0, r6, c2, c0, 2 @ read ttb control reg

  22. orrne r0, r0, #1 @ MMU enabled

  23. movne r1, #0xfffffffd @ domain 0 = client

  24. bic r6, r6, #1 << 31 @ 32-bit translation system

  25. bic r6, r6, #3 << 0 @ use only ttbr0

  26. mcrne p15, 0, r3, c2, c0, 0 @ load page table pointer

  27. mcrne p15, 0, r1, c3, c0, 0 @ load domain access control

  28. mcrne p15, 0, r6, c2, c0, 2 @ load ttb control

  29. #endif

  30. mcr p15, 0, r0, c7, c5, 4 @ ISB

  31. mcr p15, 0, r0, c1, c0, 0 @ load control register

  32. mrc p15, 0, r0, c1, c0, 0 @ and read it back

  33. mov r0, #0

  34. mcr p15, 0, r0, c7, c5, 4 @ ISB

  35. mov pc, r12 @ 返回到bl cache_on的下一条指令

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值