1 /* 2 * Copyright (c) 2019 Carlo Caione <ccaione@baylibre.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief ARM64 kernel structure member offset definition file 10 * 11 * This module is responsible for the generation of the absolute symbols whose 12 * value represents the member offsets for various ARM kernel structures. 13 * 14 * All of the absolute symbols defined by this module will be present in the 15 * final kernel ELF image (due to the linker's reference to the _OffsetAbsSyms 16 * symbol). 17 * 18 * INTERNAL 19 * It is NOT necessary to define the offset for every member of a structure. 20 * Typically, only those members that are accessed by assembly language routines 21 * are defined; however, it doesn't hurt to define all fields for the sake of 22 * completeness. 23 */ 24 25 #ifndef _ARM_OFFSETS_INC_ 26 #define _ARM_OFFSETS_INC_ 27 28 #include <gen_offset.h> 29 #include <zephyr/kernel.h> 30 #include <kernel_arch_data.h> 31 #include <kernel_offsets.h> 32 33 GEN_OFFSET_SYM(_thread_arch_t, exception_depth); 34 35 GEN_NAMED_OFFSET_SYM(_callee_saved_t, x19, x19_x20); 36 GEN_NAMED_OFFSET_SYM(_callee_saved_t, x21, x21_x22); 37 GEN_NAMED_OFFSET_SYM(_callee_saved_t, x23, x23_x24); 38 GEN_NAMED_OFFSET_SYM(_callee_saved_t, x25, x25_x26); 39 GEN_NAMED_OFFSET_SYM(_callee_saved_t, x27, x27_x28); 40 GEN_NAMED_OFFSET_SYM(_callee_saved_t, x29, x29_sp_el0); 41 GEN_NAMED_OFFSET_SYM(_callee_saved_t, sp_elx, sp_elx_lr); 42 43 #ifdef CONFIG_FRAME_POINTER 44 GEN_NAMED_OFFSET_SYM(_esf_t, fp, fp); 45 #endif 46 47 GEN_NAMED_OFFSET_SYM(_esf_t, spsr, spsr_elr); 48 GEN_NAMED_OFFSET_SYM(_esf_t, x18, x18_lr); 49 GEN_NAMED_OFFSET_SYM(_esf_t, x16, x16_x17); 50 GEN_NAMED_OFFSET_SYM(_esf_t, x14, x14_x15); 51 GEN_NAMED_OFFSET_SYM(_esf_t, x12, x12_x13); 52 GEN_NAMED_OFFSET_SYM(_esf_t, x10, x10_x11); 53 GEN_NAMED_OFFSET_SYM(_esf_t, x8, x8_x9); 54 GEN_NAMED_OFFSET_SYM(_esf_t, x6, x6_x7); 55 GEN_NAMED_OFFSET_SYM(_esf_t, x4, x4_x5); 56 GEN_NAMED_OFFSET_SYM(_esf_t, x2, x2_x3); 57 GEN_NAMED_OFFSET_SYM(_esf_t, x0, x0_x1); 58 59 GEN_ABSOLUTE_SYM(___esf_t_SIZEOF, sizeof(_esf_t)); 60 61 #ifdef CONFIG_ARM64_SAFE_EXCEPTION_STACK 62 GEN_OFFSET_SYM(_cpu_arch_t, safe_exception_stack); 63 GEN_OFFSET_SYM(_cpu_arch_t, current_stack_limit); 64 GEN_OFFSET_SYM(_cpu_arch_t, corrupted_sp); 65 GEN_OFFSET_SYM(_thread_arch_t, stack_limit); 66 GEN_NAMED_OFFSET_SYM(_esf_t, sp, sp_el0); 67 #endif 68 69 #ifdef CONFIG_HAS_ARM_SMCCC 70 71 #include <zephyr/arch/arm64/arm-smccc.h> 72 73 GEN_NAMED_OFFSET_SYM(arm_smccc_res_t, a0, a0_a1); 74 GEN_NAMED_OFFSET_SYM(arm_smccc_res_t, a2, a2_a3); 75 GEN_NAMED_OFFSET_SYM(arm_smccc_res_t, a4, a4_a5); 76 GEN_NAMED_OFFSET_SYM(arm_smccc_res_t, a6, a6_a7); 77 78 #endif /* CONFIG_HAS_ARM_SMCCC */ 79 80 GEN_ABS_SYM_END 81 82 #endif /* _ARM_OFFSETS_INC_ */ 83