@@ -99,8 +99,11 @@ phys_l2x0_saved_regs:
- bl v7_invalidate_l1
+ ldr ip, 2f
+ mov lr, pc
+1: add pc, pc, ip
+2: .word v7_invalidate_l1 - 1b - 8
However it is probably best to move all the code to the .text section
where it belongs and fixup the data access instead. I must plead guilty
for introducing this idea of putting code in the .data section with the
SA1100resume code over 10 years ago that everyone copied since.
So here's how I think it should look instead, and how I should have done
the SA1100 code back then:
@@ -73,16 +73,16 @@ ENDPROC(v7_secondary_startup)
- * The following code is located into the .data section. This is to
- * allow phys_l2x0_saved_regs to be accessed with a relative load
- * as we are running on physical address here.
+ * The following code must assume it is running from physical address
+ * where absolute virtual addresses to the data section have to be
+ * turned into relative ones.
- ldr r2, phys_l2x0_saved_regs
+ adr r0, phys_l2x0_saved_ptr_offset
+ ldr r2, [r0]
+ add r2, r2, r0
ldr r0, [r2, #L2X0_R_PHY_BASE] @ get physical base of l2x0
ldr r1, [r2, #L2X0_R_AUX_CTRL] @ get aux_ctrl value
str r1, [r0, #L2X0_AUX_CTRL] @ restore aux_ctrl
@@ -90,9 +90,13 @@ ENDPROC(v7_secondary_startup)
str r1, [r0, #L2X0_CTRL] @ re-enable L2
- .long 0
+ .space 4
+ .word phys_l2x0_saved_regs - .