summaryrefslogtreecommitdiffstats
path: root/utils/hwstub/stub
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-02-04 00:16:46 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2014-02-10 23:14:25 +0100
commit81dfed27cf7ca1008b9cf21c084310eaeae082ac (patch)
tree62c5c1e60bfe39d110c21e75af2dba1e0d7bf0eb /utils/hwstub/stub
parentc17d30f20466861a244c603665c580feb7758abf (diff)
downloadrockbox-81dfed27cf7ca1008b9cf21c084310eaeae082ac.tar.gz
rockbox-81dfed27cf7ca1008b9cf21c084310eaeae082ac.zip
utils/hwstub: make stmp stub able to load in a MMU'ed environement
In might be useful to load hwstub in an environment with the MMU active, in which case care must be taken on the order in which things are done. Mostly, one should not disable the MMU before moving stuff around. The code assumes the linking address (0 currently) is identity mapped. Change-Id: I8d54ce9e8cadcde2e08990353ca7a46803731ca7
Diffstat (limited to 'utils/hwstub/stub')
-rw-r--r--utils/hwstub/stub/stmp/crt0.S16
1 files changed, 10 insertions, 6 deletions
diff --git a/utils/hwstub/stub/stmp/crt0.S b/utils/hwstub/stub/stmp/crt0.S
index f4a0c28360..38b6f18ac5 100644
--- a/utils/hwstub/stub/stmp/crt0.S
+++ b/utils/hwstub/stub/stmp/crt0.S
@@ -5,12 +5,10 @@
start:
sub r7, pc, #8 /* Copy running address */
msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */
- /* Disable MMU, disable caching and buffering;
- * use low exception range address */
- mrc p15, 0, r0, c1, c0, 0
- ldr r1, =0x3005
- bic r0, r1
- mcr p15, 0, r0, c1, c0, 0
+ /* The stub could be located at a virtual address so killing the MMU at
+ * this point would be mere suicide. We assume that the remap location
+ * is identically mapped and kill the MMU after the copy */
+
/* Relocate to right address */
mov r2, r7
ldr r3, =_copystart
@@ -25,6 +23,12 @@ start:
/* Jump to real location */
ldr pc, =remap
remap:
+ /* Disable MMU, disable caching and buffering;
+ * use low exception range address */
+ mrc p15, 0, r0, c1, c0, 0
+ ldr r1, =0x3005
+ bic r0, r1
+ mcr p15, 0, r0, c1, c0, 0
/* clear bss */
ldr r2, =bss_start
ldr r3, =bss_end