1 /*
2  * Copyright (c) 2014 Wind River Systems, Inc.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /**
8  * @file
9  * @brief ARCv2 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 ARCv2 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 #include <zephyr/kernel.h>
26 #include <kernel_arch_data.h>
27 #include <gen_offset.h>
28 #include <kernel_offsets.h>
29 #ifdef CONFIG_DSP_SHARING
30 #include "../dsp/dsp_offsets.c"
31 #endif
32 
33 GEN_OFFSET_SYM(_thread_arch_t, relinquish_cause);
34 #ifdef CONFIG_ARC_STACK_CHECKING
35 GEN_OFFSET_SYM(_thread_arch_t, k_stack_base);
36 GEN_OFFSET_SYM(_thread_arch_t, k_stack_top);
37 #ifdef CONFIG_USERSPACE
38 GEN_OFFSET_SYM(_thread_arch_t, u_stack_base);
39 GEN_OFFSET_SYM(_thread_arch_t, u_stack_top);
40 #endif
41 #endif
42 
43 #ifdef CONFIG_USERSPACE
44 GEN_OFFSET_SYM(_thread_arch_t, priv_stack_start);
45 #endif
46 
47 
48 /* ARCv2-specific IRQ stack frame structure member offsets */
49 GEN_OFFSET_SYM(_isf_t, r0);
50 GEN_OFFSET_SYM(_isf_t, r1);
51 GEN_OFFSET_SYM(_isf_t, r2);
52 GEN_OFFSET_SYM(_isf_t, r3);
53 GEN_OFFSET_SYM(_isf_t, r4);
54 GEN_OFFSET_SYM(_isf_t, r5);
55 GEN_OFFSET_SYM(_isf_t, r6);
56 GEN_OFFSET_SYM(_isf_t, r7);
57 GEN_OFFSET_SYM(_isf_t, r8);
58 GEN_OFFSET_SYM(_isf_t, r9);
59 GEN_OFFSET_SYM(_isf_t, r10);
60 GEN_OFFSET_SYM(_isf_t, r11);
61 GEN_OFFSET_SYM(_isf_t, r12);
62 GEN_OFFSET_SYM(_isf_t, r13);
63 GEN_OFFSET_SYM(_isf_t, blink);
64 #ifdef CONFIG_ARC_HAS_ZOL
65 GEN_OFFSET_SYM(_isf_t, lp_end);
66 GEN_OFFSET_SYM(_isf_t, lp_start);
67 GEN_OFFSET_SYM(_isf_t, lp_count);
68 #endif /* CONFIG_ARC_HAS_ZOL */
69 #ifdef CONFIG_CODE_DENSITY
70 GEN_OFFSET_SYM(_isf_t, ei_base);
71 GEN_OFFSET_SYM(_isf_t, ldi_base);
72 GEN_OFFSET_SYM(_isf_t, jli_base);
73 #endif
74 GEN_OFFSET_SYM(_isf_t, pc);
75 #ifdef CONFIG_ARC_HAS_SECURE
76 GEN_OFFSET_SYM(_isf_t, sec_stat);
77 #endif
78 GEN_OFFSET_SYM(_isf_t, status32);
79 GEN_ABSOLUTE_SYM(___isf_t_SIZEOF, sizeof(_isf_t));
80 
81 GEN_OFFSET_SYM(_callee_saved_t, sp);
82 
83 GEN_OFFSET_SYM(_callee_saved_stack_t, r13);
84 GEN_OFFSET_SYM(_callee_saved_stack_t, r14);
85 GEN_OFFSET_SYM(_callee_saved_stack_t, r15);
86 GEN_OFFSET_SYM(_callee_saved_stack_t, r16);
87 GEN_OFFSET_SYM(_callee_saved_stack_t, r17);
88 GEN_OFFSET_SYM(_callee_saved_stack_t, r18);
89 GEN_OFFSET_SYM(_callee_saved_stack_t, r19);
90 GEN_OFFSET_SYM(_callee_saved_stack_t, r20);
91 GEN_OFFSET_SYM(_callee_saved_stack_t, r21);
92 GEN_OFFSET_SYM(_callee_saved_stack_t, r22);
93 GEN_OFFSET_SYM(_callee_saved_stack_t, r23);
94 GEN_OFFSET_SYM(_callee_saved_stack_t, r24);
95 GEN_OFFSET_SYM(_callee_saved_stack_t, r25);
96 GEN_OFFSET_SYM(_callee_saved_stack_t, r26);
97 GEN_OFFSET_SYM(_callee_saved_stack_t, fp);
98 #ifdef CONFIG_USERSPACE
99 #ifdef CONFIG_ARC_HAS_SECURE
100 GEN_OFFSET_SYM(_callee_saved_stack_t, kernel_sp);
101 GEN_OFFSET_SYM(_callee_saved_stack_t, user_sp);
102 #else
103 GEN_OFFSET_SYM(_callee_saved_stack_t, user_sp);
104 #endif
105 #endif
106 GEN_OFFSET_SYM(_callee_saved_stack_t, r30);
107 #ifdef CONFIG_ARC_HAS_ACCL_REGS
108 GEN_OFFSET_SYM(_callee_saved_stack_t, r58);
109 #ifndef CONFIG_64BIT
110 GEN_OFFSET_SYM(_callee_saved_stack_t, r59);
111 #endif /* !CONFIG_64BIT */
112 #endif
113 #ifdef CONFIG_FPU_SHARING
114 GEN_OFFSET_SYM(_callee_saved_stack_t, fpu_status);
115 GEN_OFFSET_SYM(_callee_saved_stack_t, fpu_ctrl);
116 #ifdef CONFIG_FP_FPU_DA
117 GEN_OFFSET_SYM(_callee_saved_stack_t, dpfp2h);
118 GEN_OFFSET_SYM(_callee_saved_stack_t, dpfp2l);
119 GEN_OFFSET_SYM(_callee_saved_stack_t, dpfp1h);
120 GEN_OFFSET_SYM(_callee_saved_stack_t, dpfp1l);
121 #endif
122 #endif
123 
124 GEN_ABSOLUTE_SYM(___callee_saved_stack_t_SIZEOF, sizeof(_callee_saved_stack_t));
125 
126 GEN_ABS_SYM_END
127