summaryrefslogtreecommitdiff
path: root/utils/hwstub
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
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')
-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 @@
5start: 5start:
6 sub r7, pc, #8 /* Copy running address */ 6 sub r7, pc, #8 /* Copy running address */
7 msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */ 7 msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */
8 /* Disable MMU, disable caching and buffering; 8 /* The stub could be located at a virtual address so killing the MMU at
9 * use low exception range address */ 9 * this point would be mere suicide. We assume that the remap location
10 mrc p15, 0, r0, c1, c0, 0 10 * is identically mapped and kill the MMU after the copy */
11 ldr r1, =0x3005 11
12 bic r0, r1
13 mcr p15, 0, r0, c1, c0, 0
14 /* Relocate to right address */ 12 /* Relocate to right address */
15 mov r2, r7 13 mov r2, r7
16 ldr r3, =_copystart 14 ldr r3, =_copystart
@@ -25,6 +23,12 @@ start:
25 /* Jump to real location */ 23 /* Jump to real location */
26 ldr pc, =remap 24 ldr pc, =remap
27remap: 25remap:
26 /* Disable MMU, disable caching and buffering;
27 * use low exception range address */
28 mrc p15, 0, r0, c1, c0, 0
29 ldr r1, =0x3005
30 bic r0, r1
31 mcr p15, 0, r0, c1, c0, 0
28 /* clear bss */ 32 /* clear bss */
29 ldr r2, =bss_start 33 ldr r2, =bss_start
30 ldr r3, =bss_end 34 ldr r3, =bss_end