1 /* 2 * Copyright (c) 2019-2020 Cobham Gaisler AB 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_ARCH_SPARC_CORE_STACK_H_ 8 #define ZEPHYR_ARCH_SPARC_CORE_STACK_H_ 9 10 /* 11 * Offsets for SPARC ABI stack frame. 12 * 13 * Reference: System V Application Binary Interface, SPARC Processor 14 * Supplement, Third Edition, Page 3-35. 15 */ 16 #define STACK_FRAME_L0_OFFSET 0x00 17 #define STACK_FRAME_L1_OFFSET 0x04 18 #define STACK_FRAME_L2_OFFSET 0x08 19 #define STACK_FRAME_L3_OFFSET 0x0c 20 #define STACK_FRAME_L4_OFFSET 0x10 21 #define STACK_FRAME_L5_OFFSET 0x14 22 #define STACK_FRAME_L6_OFFSET 0x18 23 #define STACK_FRAME_L7_OFFSET 0x1c 24 #define STACK_FRAME_I0_OFFSET 0x20 25 #define STACK_FRAME_I1_OFFSET 0x24 26 #define STACK_FRAME_I2_OFFSET 0x28 27 #define STACK_FRAME_I3_OFFSET 0x2c 28 #define STACK_FRAME_I4_OFFSET 0x30 29 #define STACK_FRAME_I5_OFFSET 0x34 30 #define STACK_FRAME_I6_OFFSET 0x38 31 #define STACK_FRAME_I7_OFFSET 0x3c 32 #define STACK_FRAME_STRUCTURE_RETURN_ADDRESS_OFFSET 0x40 33 #define STACK_FRAME_SAVED_ARG0_OFFSET 0x44 34 #define STACK_FRAME_SAVED_ARG1_OFFSET 0x48 35 #define STACK_FRAME_SAVED_ARG2_OFFSET 0x4c 36 #define STACK_FRAME_SAVED_ARG3_OFFSET 0x50 37 #define STACK_FRAME_SAVED_ARG4_OFFSET 0x54 38 #define STACK_FRAME_SAVED_ARG5_OFFSET 0x58 39 #define STACK_FRAME_PAD0_OFFSET 0x5c 40 #define STACK_FRAME_SIZE 0x60 41 42 43 /* Interrupt stack frame */ 44 #define ISF_PSR_OFFSET (0x40 + 0x00) 45 #define ISF_PC_OFFSET (0x40 + 0x04) 46 #define ISF_NPC_OFFSET (0x40 + 0x08) 47 #define ISF_G1_OFFSET (0x40 + 0x0c) 48 #define ISF_G2_OFFSET (0x40 + 0x10) 49 #define ISF_G3_OFFSET (0x40 + 0x14) 50 #define ISF_G4_OFFSET (0x40 + 0x18) 51 #define ISF_Y_OFFSET (0x40 + 0x1c) 52 53 #if !defined(_FLAT) 54 #define ISF_SIZE (0x20) 55 #else 56 /* 57 * The flat ABI stores and loads "local" and "in" registers in the save area as 58 * part of function prologue and epilogue. So we allocate space for a new save 59 * area (0x40 byte) as part of the interrupt stack frame. 60 */ 61 #define ISF_SIZE (0x40 + 0x20) 62 #endif 63 64 #endif /* ZEPHYR_ARCH_SPARC_CORE_STACK_H_ */ 65