1 /*
2  * Copyright (c) 2013-2014 Wind River Systems, Inc.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #include <zephyr/device.h>
7 #include <zephyr/pm/device.h>
8 #include "kernel_internal.h"
9 
10 #ifndef ZEPHYR_KERNEL_INCLUDE_KERNEL_OFFSETS_H_
11 #define ZEPHYR_KERNEL_INCLUDE_KERNEL_OFFSETS_H_
12 
13 #include <zephyr/syscall_list.h>
14 
15 /* All of this is build time magic, but LCOV gets confused. Disable coverage
16  * for this whole file.
17  *
18  * LCOV_EXCL_START
19  */
20 
21 /*
22  * The final link step uses the symbol _OffsetAbsSyms to force the linkage of
23  * offsets.o into the ELF image.
24  */
25 
26 GEN_ABS_SYM_BEGIN(_OffsetAbsSyms)
27 
28 GEN_OFFSET_SYM(_cpu_t, current);
29 GEN_OFFSET_SYM(_cpu_t, nested);
30 GEN_OFFSET_SYM(_cpu_t, irq_stack);
31 GEN_OFFSET_SYM(_cpu_t, arch);
32 
33 GEN_OFFSET_SYM(_kernel_t, cpus);
34 
35 #if defined(CONFIG_FPU_SHARING)
36 GEN_OFFSET_SYM(_cpu_t, fp_ctx);
37 #endif /* CONFIG_FPU_SHARING */
38 
39 #ifdef CONFIG_PM
40 GEN_OFFSET_SYM(_kernel_t, idle);
41 #endif /* CONFIG_PM */
42 
43 #ifndef CONFIG_SCHED_CPU_MASK_PIN_ONLY
44 GEN_OFFSET_SYM(_kernel_t, ready_q);
45 #endif /* CONFIG_SCHED_CPU_MASK_PIN_ONLY */
46 
47 #ifndef CONFIG_SMP
48 GEN_OFFSET_SYM(_ready_q_t, cache);
49 #endif /* CONFIG_SMP */
50 
51 #ifdef CONFIG_FPU_SHARING
52 GEN_OFFSET_SYM(_kernel_t, current_fp);
53 #endif /* CONFIG_FPU_SHARING */
54 
55 GEN_OFFSET_SYM(_thread_base_t, user_options);
56 
57 GEN_OFFSET_SYM(_thread_t, base);
58 GEN_OFFSET_SYM(_thread_t, callee_saved);
59 GEN_OFFSET_SYM(_thread_t, arch);
60 
61 #ifdef CONFIG_USE_SWITCH
62 GEN_OFFSET_SYM(_thread_t, switch_handle);
63 #endif /* CONFIG_USE_SWITCH */
64 
65 #ifdef CONFIG_THREAD_STACK_INFO
66 GEN_OFFSET_SYM(_thread_t, stack_info);
67 #endif /* CONFIG_THREAD_STACK_INFO */
68 
69 #ifdef CONFIG_THREAD_LOCAL_STORAGE
70 GEN_OFFSET_SYM(_thread_t, tls);
71 #endif /* CONFIG_THREAD_LOCAL_STORAGE */
72 
73 GEN_ABSOLUTE_SYM(__z_interrupt_stack_SIZEOF, sizeof(z_interrupt_stacks[0]));
74 
75 /* member offsets in the device structure. Used in image post-processing */
76 #ifdef CONFIG_DEVICE_DEPS
77 GEN_ABSOLUTE_SYM(_DEVICE_STRUCT_HANDLES_OFFSET,
78 		 offsetof(struct device, deps));
79 #endif /* CONFIG_DEVICE_DEPS */
80 
81 #ifdef CONFIG_PM_DEVICE
82 GEN_ABSOLUTE_SYM(_DEVICE_STRUCT_PM_OFFSET,
83 		 offsetof(struct device, pm));
84 #endif /* CONFIG_PM_DEVICE */
85 
86 /* member offsets in the pm_device structure. Used in image post-processing */
87 
88 GEN_ABSOLUTE_SYM(_PM_DEVICE_STRUCT_FLAGS_OFFSET,
89 		 offsetof(struct pm_device_base, flags));
90 
91 GEN_ABSOLUTE_SYM(_PM_DEVICE_FLAG_PD, PM_DEVICE_FLAG_PD);
92 
93 /* LCOV_EXCL_STOP */
94 #endif /* ZEPHYR_KERNEL_INCLUDE_KERNEL_OFFSETS_H_ */
95