1/* 2 * Copyright (c) 2019-2020 Cobham Gaisler AB 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7#include <zephyr/toolchain.h> 8#include <zephyr/linker/sections.h> 9#include <zephyr/arch/sparc/sparc.h> 10 11/* The trap table reset entry jumps to here. */ 12 13GTEXT(__sparc_trap_reset) 14SECTION_FUNC(TEXT, __sparc_trap_reset) 15 set __sparc_trap_table, %g1 16 wr %g1, %tbr 17 wr 2, %wim 18 wr PSR_PIL | PSR_S | PSR_PS | PSR_ET, %psr 19 /* NOTE: wrpsr above may have changed the current register window. */ 20 21 /* We are in the 3 instruction wrpsr delay so use global registers. */ 22 set z_interrupt_stacks, %g2 23 set CONFIG_ISR_STACK_SIZE, %g4 24 add %g2, %g4, %g1 25 and %g1, 0xfffffff0, %l3 26 27 /* 28 * According to SPARC ABI, Chapter 3: The system marks the deepest 29 * stack frame by setting the frame pointer to zero. No other frame's 30 * %fp has a zero value. 31 */ 32 sub %l3, 96, %sp 33 clr %fp 34 clr %i7 35 36#ifdef CONFIG_INIT_STACKS 37 /* In-place memset() to avoid register window related traps. */ 38 set 0xaaaaaaaa, %l0 39 mov %l0, %l1 401: 41 std %l0, [%g2] 42 add %g2, 8, %g2 43 cmp %g2, %l3 44 bne 1b 45 nop 46#endif 47 48 call z_bss_zero 49 nop 50 51 call _PrepC 52 nop 53 54/* We halt the system by generating a "trap in trap" condition. */ 55GTEXT(arch_system_halt) 56SECTION_FUNC(TEXT, arch_system_halt) 57 mov %o0, %g0 58 mov %g1, %g0 59 set 1, %g1 60 ta 0x00 61