diff options
Diffstat (limited to 'utils/hwstub/stub/stmp/crt0.S')
-rw-r--r-- | utils/hwstub/stub/stmp/crt0.S | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/utils/hwstub/stub/stmp/crt0.S b/utils/hwstub/stub/stmp/crt0.S new file mode 100644 index 0000000000..8b2197823e --- /dev/null +++ b/utils/hwstub/stub/stmp/crt0.S | |||
@@ -0,0 +1,41 @@ | |||
1 | .section .text,"ax",%progbits | ||
2 | .code 32 | ||
3 | .align 0x04 | ||
4 | .global start | ||
5 | start: | ||
6 | sub r7, pc, #8 /* Copy running address */ | ||
7 | msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */ | ||
8 | #ifdef CONFIG_STMP | ||
9 | /* Disable MMU, disable caching and buffering; | ||
10 | * use low exception range address */ | ||
11 | mrc p15, 0, r0, c1, c0, 0 | ||
12 | ldr r1, =0x3005 | ||
13 | bic r0, r1 | ||
14 | mcr p15, 0, r0, c1, c0, 0 | ||
15 | #endif | ||
16 | ldr sp, =oc_stackend | ||
17 | /* Relocate to right address */ | ||
18 | mov r2, r7 | ||
19 | ldr r3, =_copystart | ||
20 | ldr r4, =_copyend | ||
21 | 1: | ||
22 | cmp r4, r3 | ||
23 | ldrhi r5, [r2], #4 | ||
24 | strhi r5, [r3], #4 | ||
25 | bhi 1b | ||
26 | |||
27 | mov r2, #0 | ||
28 | mcr p15, 0, r2, c7, c5, 0 @ Invalidate ICache | ||
29 | /* Jump to real location */ | ||
30 | ldr pc, =remap | ||
31 | remap: | ||
32 | /* clear bss */ | ||
33 | ldr r2, =bss_start | ||
34 | ldr r3, =bss_end | ||
35 | mov r4, #0 | ||
36 | 1: | ||
37 | cmp r3, r2 | ||
38 | strhi r4, [r2], #4 | ||
39 | bhi 1b | ||
40 | /* jump to C code */ | ||
41 | b main | ||