diff options
author | Elias Bakken <elias@iagent.no> | 2023-02-21 02:15:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-20 20:15:01 -0500 |
commit | b7978d37b360fb270782a8db5d690342654e6977 (patch) | |
tree | 5383243d85dee85a521f466ac966460ee092efa2 /lib/ar100/start.S | |
parent | d7bd7f1f4ba6cecd19daa566fdc1864561269ae1 (diff) | |
download | kutter-b7978d37b360fb270782a8db5d690342654e6977.tar.gz kutter-b7978d37b360fb270782a8db5d690342654e6977.tar.xz kutter-b7978d37b360fb270782a8db5d690342654e6977.zip |
ar100: Support for ar100 (#6054)
Add files to support AR100
Signed-off-by: Elias Bakken <elias@iagent.no>
Diffstat (limited to 'lib/ar100/start.S')
-rw-r--r-- | lib/ar100/start.S | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/ar100/start.S b/lib/ar100/start.S new file mode 100644 index 00000000..0ffc8348 --- /dev/null +++ b/lib/ar100/start.S @@ -0,0 +1,41 @@ +/* + * Copyright © 2017-2020 The Crust Firmware Authors. + * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only + */ + +#include <macros.S> +#include <asm/spr.h> + +func start + l.mfspr r2, r0, SPR_SYS_PPC_ADDR + l.sfltui r2, 0x4000 # Size of exception vector area + l.bf 1f + l.srli r2, r2, 8 # Vector address → exception number + l.addi r2, r0, 0 # Set to zero if not an exception +1: l.addi r3, r0, 0 # Invalidate instruction cache + l.addi r4, r0, 4096 # Cache lines (256) * block size (16) +2: l.mtspr r0, r3, SPR_ICACHE_ICBIR_ADDR + l.sfltu r3, r4 + l.bf 2b + l.addi r3, r3, 16 # Cache block size + l.psync # Flush CPU pipeline + l.mfspr r3, r0, SPR_SYS_SR_ADDR # Enable instruction cache + l.ori r3, r3, SPR_SYS_SR_ICE_MASK + l.mtspr r0, r3, SPR_SYS_SR_ADDR + l.nop # One cache block of nops + l.nop + l.nop + l.nop + l.movhi r3, hi(__bss_start) # Clear .bss + l.ori r3, r3, lo(__bss_start) + l.movhi r4, hi(__bss_end) + l.ori r4, r4, lo(__bss_end) +3: l.sw 0(r3), r0 + l.sfltu r3, r4 + l.bf 3b + l.addi r3, r3, 4 + l.movhi r1, hi(__stack_end) + l.ori r1, r1, lo(__stack_end) # Initialize stack pointer + l.j main # Jump to C entry point + l.or r3, r2, r2 +endfunc start |