| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
/* |
| 3 |
* Early initialization code for ARM architecture. |
| 4 |
* |
| 5 |
* This file is based off of the OMAP3530/ARM Cortex start.S file from Das |
| 6 |
* U-Boot, which itself got the file from armboot. |
| 7 |
*/ |
| 8 |
|
| 9 |
#include <arch/asm.h> |
| 10 |
|
| 11 |
ENTRY(_start) |
| 12 |
/* |
| 13 |
* Set the CPU to System mode with IRQ and FIQ disabled. Prefetch/Data |
| 14 |
* aborts may happen early and crash before the abort handlers are |
| 15 |
* installed, but at least the problem will show up near the code that |
| 16 |
* causes it. |
| 17 |
*/ |
| 18 |
msr cpsr_cxf, #0xdf |
| 19 |
|
| 20 |
/* |
| 21 |
* Initialize the stack to a known value. This is used to check for |
| 22 |
* stack overflow later in the boot process. |
| 23 |
*/ |
| 24 |
ldr r0, =_stack |
| 25 |
ldr r1, =_estack |
| 26 |
ldr r2, =0xdeadbeef |
| 27 |
init_stack_loop: |
| 28 |
str r2, [r0] |
| 29 |
add r0, #4 |
| 30 |
cmp r0, r1 |
| 31 |
bne init_stack_loop |
| 32 |
|
| 33 |
/* Set stackpointer in internal RAM to call bootblock main() */ |
| 34 |
call_bootblock: |
| 35 |
ldr sp, =_estack /* Set up stack pointer */ |
| 36 |
ldr r0,=0x00000000 |
| 37 |
/* |
| 38 |
* The current design of cpu_info places the |
| 39 |
* struct at the top of the stack. The number of |
| 40 |
* words pushed must be at least as large as that |
| 41 |
* struct. |
| 42 |
*/ |
| 43 |
push {r0-r2} |
| 44 |
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ |
| 45 |
/* |
| 46 |
* Use "bl" instead of "b" even though we do not intend to return. |
| 47 |
* "bl" gets compiled to "blx" if we're transitioning from ARM to |
| 48 |
* Thumb. However, "b" will not and GCC may attempt to create a |
| 49 |
* wrapper which is currently broken. |
| 50 |
*/ |
| 51 |
bl main |
| 52 |
ENDPROC(_start) |