1 /* 2 * Copyright (c) 2013-2014 Wind River Systems, Inc. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief ARM 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 <zephyr/kernel.h> 29 #include <kernel_arch_data.h> 30 #include <kernel_offsets.h> 31 32 GEN_OFFSET_SYM(_thread_arch_t, basepri); 33 GEN_OFFSET_SYM(_thread_arch_t, swap_return_value); 34 35 #if defined(CONFIG_CPU_AARCH32_CORTEX_A) || defined(CONFIG_CPU_AARCH32_CORTEX_R) 36 GEN_OFFSET_SYM(_thread_arch_t, exception_depth); 37 GEN_OFFSET_SYM(_cpu_arch_t, exc_depth); 38 #endif 39 40 #if defined(CONFIG_ARM_STORE_EXC_RETURN) || defined(CONFIG_USERSPACE) 41 GEN_OFFSET_SYM(_thread_arch_t, mode); 42 #endif 43 #if defined(CONFIG_ARM_STORE_EXC_RETURN) 44 GEN_OFFSET_SYM(_thread_arch_t, mode_exc_return); 45 #endif 46 #if defined(CONFIG_USERSPACE) 47 GEN_OFFSET_SYM(_thread_arch_t, priv_stack_start); 48 #if defined(CONFIG_CPU_AARCH32_CORTEX_R) 49 GEN_OFFSET_SYM(_thread_arch_t, priv_stack_end); 50 GEN_OFFSET_SYM(_thread_arch_t, sp_usr); 51 #endif 52 #endif 53 54 #if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) 55 GEN_OFFSET_SYM(_thread_arch_t, preempt_float); 56 #endif 57 58 GEN_OFFSET_SYM(_basic_sf_t, pc); 59 GEN_OFFSET_SYM(_basic_sf_t, xpsr); 60 61 #if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) 62 GEN_OFFSET_SYM(_fpu_sf_t, fpscr); 63 64 GEN_ABSOLUTE_SYM(___fpu_t_SIZEOF, sizeof(_fpu_sf_t)); 65 #endif 66 67 GEN_ABSOLUTE_SYM(___esf_t_SIZEOF, sizeof(_esf_t)); 68 69 /* size of the entire preempt registers structure */ 70 71 GEN_ABSOLUTE_SYM(___callee_saved_t_SIZEOF, sizeof(struct _callee_saved)); 72 73 #if defined(CONFIG_EXTRA_EXCEPTION_INFO) 74 GEN_ABSOLUTE_SYM(___extra_esf_info_t_SIZEOF, sizeof(struct __extra_esf_info)); 75 #endif 76 77 #if defined(CONFIG_THREAD_STACK_INFO) 78 GEN_OFFSET_SYM(_thread_stack_info_t, start); 79 #endif 80 81 /* 82 * CPU context for S2RAM 83 */ 84 #if defined(CONFIG_PM_S2RAM) 85 GEN_OFFSET_SYM(_cpu_context_t, msp); 86 GEN_OFFSET_SYM(_cpu_context_t, psp); 87 GEN_OFFSET_SYM(_cpu_context_t, primask); 88 GEN_OFFSET_SYM(_cpu_context_t, control); 89 90 #if defined(CONFIG_ARMV7_M_ARMV8_M_MAINLINE) 91 /* Registers present only on ARMv7-M and ARMv8-M Mainline */ 92 GEN_OFFSET_SYM(_cpu_context_t, faultmask); 93 GEN_OFFSET_SYM(_cpu_context_t, basepri); 94 #endif /* CONFIG_ARMV7_M_ARMV8_M_MAINLINE */ 95 96 #if defined(CONFIG_CPU_CORTEX_M_HAS_SPLIM) 97 /* Registers present only on certain ARMv8-M implementations */ 98 GEN_OFFSET_SYM(_cpu_context_t, msplim); 99 GEN_OFFSET_SYM(_cpu_context_t, psplim); 100 #endif /* CONFIG_CPU_CORTEX_M_HAS_SPLIM */ 101 #endif /* CONFIG_PM_S2RAM */ 102 103 #endif /* _ARM_OFFSETS_INC_ */ 104