Benjamin Walsh | f6ca7de | 2016-11-08 10:36:50 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013-2014 Wind River Systems, Inc. |
| 3 | * |
David B. Kinder | ac74d8b | 2017-01-18 17:01:01 -0800 | [diff] [blame] | 4 | * SPDX-License-Identifier: Apache-2.0 |
Benjamin Walsh | f6ca7de | 2016-11-08 10:36:50 -0500 | [diff] [blame] | 5 | */ |
Gerard Marull-Paretas | cffefc8 | 2022-05-06 11:04:23 +0200 | [diff] [blame] | 6 | #include <zephyr/device.h> |
Gerard Marull-Paretas | cffefc8 | 2022-05-06 11:04:23 +0200 | [diff] [blame] | 7 | #include <zephyr/pm/device.h> |
Nicolas Pitre | 1f362a8 | 2022-09-26 22:58:21 -0400 | [diff] [blame] | 8 | #include "kernel_internal.h" |
Flavio Ceolin | d02a1e9 | 2022-03-20 21:53:42 -0700 | [diff] [blame] | 9 | |
Flavio Ceolin | a7fffa9 | 2018-09-13 15:06:35 -0700 | [diff] [blame] | 10 | #ifndef ZEPHYR_KERNEL_INCLUDE_KERNEL_OFFSETS_H_ |
| 11 | #define ZEPHYR_KERNEL_INCLUDE_KERNEL_OFFSETS_H_ |
Benjamin Walsh | f6ca7de | 2016-11-08 10:36:50 -0500 | [diff] [blame] | 12 | |
Yong Cong Sin | bbe5e1e | 2024-01-24 17:35:04 +0800 | [diff] [blame] | 13 | #include <zephyr/syscall_list.h> |
Andrew Boie | fa94ee7 | 2017-09-28 16:54:35 -0700 | [diff] [blame] | 14 | |
Andrew Boie | aade2b5 | 2019-06-25 08:53:14 -0700 | [diff] [blame] | 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 | |
Benjamin Walsh | f6ca7de | 2016-11-08 10:36:50 -0500 | [diff] [blame] | 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 | |
Andy Ross | e694656 | 2018-01-25 16:39:35 -0800 | [diff] [blame] | 28 | GEN_OFFSET_SYM(_cpu_t, current); |
| 29 | GEN_OFFSET_SYM(_cpu_t, nested); |
| 30 | GEN_OFFSET_SYM(_cpu_t, irq_stack); |
Nicolas Pitre | f97d129 | 2021-04-15 16:27:45 -0400 | [diff] [blame] | 31 | GEN_OFFSET_SYM(_cpu_t, arch); |
Benjamin Walsh | f6ca7de | 2016-11-08 10:36:50 -0500 | [diff] [blame] | 32 | |
Carlo Caione | 64dfa69 | 2021-03-09 14:18:19 +0100 | [diff] [blame] | 33 | GEN_OFFSET_SYM(_kernel_t, cpus); |
| 34 | |
Bradley Bolen | 88ba97f | 2020-12-10 08:45:20 -0500 | [diff] [blame] | 35 | #if defined(CONFIG_FPU_SHARING) |
| 36 | GEN_OFFSET_SYM(_cpu_t, fp_ctx); |
Simon Hein | bcd1d19 | 2024-03-08 12:00:10 +0100 | [diff] [blame] | 37 | #endif /* CONFIG_FPU_SHARING */ |
Bradley Bolen | 88ba97f | 2020-12-10 08:45:20 -0500 | [diff] [blame] | 38 | |
Anas Nashif | dd931f9 | 2020-09-01 18:31:40 -0400 | [diff] [blame] | 39 | #ifdef CONFIG_PM |
Benjamin Walsh | f6ca7de | 2016-11-08 10:36:50 -0500 | [diff] [blame] | 40 | GEN_OFFSET_SYM(_kernel_t, idle); |
Simon Hein | bcd1d19 | 2024-03-08 12:00:10 +0100 | [diff] [blame] | 41 | #endif /* CONFIG_PM */ |
Benjamin Walsh | f6ca7de | 2016-11-08 10:36:50 -0500 | [diff] [blame] | 42 | |
Andy Ross | b11e796 | 2021-09-24 10:57:39 -0700 | [diff] [blame] | 43 | #ifndef CONFIG_SCHED_CPU_MASK_PIN_ONLY |
Benjamin Walsh | 88b3691 | 2016-12-02 10:37:27 -0500 | [diff] [blame] | 44 | GEN_OFFSET_SYM(_kernel_t, ready_q); |
Simon Hein | bcd1d19 | 2024-03-08 12:00:10 +0100 | [diff] [blame] | 45 | #endif /* CONFIG_SCHED_CPU_MASK_PIN_ONLY */ |
Benjamin Walsh | 1f2a579 | 2016-12-19 12:17:23 -0500 | [diff] [blame] | 46 | |
Andy Ross | 2724fd1 | 2018-01-29 14:55:20 -0800 | [diff] [blame] | 47 | #ifndef CONFIG_SMP |
Benjamin Walsh | 88b3691 | 2016-12-02 10:37:27 -0500 | [diff] [blame] | 48 | GEN_OFFSET_SYM(_ready_q_t, cache); |
Simon Hein | bcd1d19 | 2024-03-08 12:00:10 +0100 | [diff] [blame] | 49 | #endif /* CONFIG_SMP */ |
Benjamin Walsh | 88b3691 | 2016-12-02 10:37:27 -0500 | [diff] [blame] | 50 | |
Stephanos Ioannidis | aaf9320 | 2020-05-03 18:03:19 +0900 | [diff] [blame] | 51 | #ifdef CONFIG_FPU_SHARING |
Benjamin Walsh | f6ca7de | 2016-11-08 10:36:50 -0500 | [diff] [blame] | 52 | GEN_OFFSET_SYM(_kernel_t, current_fp); |
Simon Hein | bcd1d19 | 2024-03-08 12:00:10 +0100 | [diff] [blame] | 53 | #endif /* CONFIG_FPU_SHARING */ |
Benjamin Walsh | f6ca7de | 2016-11-08 10:36:50 -0500 | [diff] [blame] | 54 | |
Benjamin Walsh | ed240f2 | 2017-01-22 13:05:08 -0500 | [diff] [blame] | 55 | GEN_OFFSET_SYM(_thread_base_t, user_options); |
Benjamin Walsh | f6ca7de | 2016-11-08 10:36:50 -0500 | [diff] [blame] | 56 | |
| 57 | GEN_OFFSET_SYM(_thread_t, base); |
Benjamin Walsh | f6ca7de | 2016-11-08 10:36:50 -0500 | [diff] [blame] | 58 | GEN_OFFSET_SYM(_thread_t, callee_saved); |
| 59 | GEN_OFFSET_SYM(_thread_t, arch); |
| 60 | |
Andy Ross | 8bc3b6f | 2019-10-18 14:12:00 -0700 | [diff] [blame] | 61 | #ifdef CONFIG_USE_SWITCH |
| 62 | GEN_OFFSET_SYM(_thread_t, switch_handle); |
Simon Hein | bcd1d19 | 2024-03-08 12:00:10 +0100 | [diff] [blame] | 63 | #endif /* CONFIG_USE_SWITCH */ |
Andy Ross | 8bc3b6f | 2019-10-18 14:12:00 -0700 | [diff] [blame] | 64 | |
Andrew Boie | 41c68ec | 2017-05-11 15:38:20 -0700 | [diff] [blame] | 65 | #ifdef CONFIG_THREAD_STACK_INFO |
Andrew Boie | 41c68ec | 2017-05-11 15:38:20 -0700 | [diff] [blame] | 66 | GEN_OFFSET_SYM(_thread_t, stack_info); |
Simon Hein | bcd1d19 | 2024-03-08 12:00:10 +0100 | [diff] [blame] | 67 | #endif /* CONFIG_THREAD_STACK_INFO */ |
Andrew Boie | 41c68ec | 2017-05-11 15:38:20 -0700 | [diff] [blame] | 68 | |
Daniel Leung | 02b2035 | 2020-09-28 11:27:11 -0700 | [diff] [blame] | 69 | #ifdef CONFIG_THREAD_LOCAL_STORAGE |
| 70 | GEN_OFFSET_SYM(_thread_t, tls); |
Simon Hein | bcd1d19 | 2024-03-08 12:00:10 +0100 | [diff] [blame] | 71 | #endif /* CONFIG_THREAD_LOCAL_STORAGE */ |
Daniel Leung | 02b2035 | 2020-09-28 11:27:11 -0700 | [diff] [blame] | 72 | |
Nicolas Pitre | 1f362a8 | 2022-09-26 22:58:21 -0400 | [diff] [blame] | 73 | GEN_ABSOLUTE_SYM(__z_interrupt_stack_SIZEOF, sizeof(z_interrupt_stacks[0])); |
Yong Cong Sin | 035c822 | 2024-09-10 19:04:32 +0800 | [diff] [blame] | 74 | GEN_ABSOLUTE_SYM(__z_interrupt_all_stacks_SIZEOF, sizeof(z_interrupt_stacks)); |
Nicolas Pitre | 1f362a8 | 2022-09-26 22:58:21 -0400 | [diff] [blame] | 75 | |
Peter Bigot | d554d34 | 2020-06-30 10:05:35 -0500 | [diff] [blame] | 76 | /* member offsets in the device structure. Used in image post-processing */ |
Gerard Marull-Paretas | 48b201c | 2023-06-14 14:30:41 +0200 | [diff] [blame] | 77 | #ifdef CONFIG_DEVICE_DEPS |
Peter Bigot | d554d34 | 2020-06-30 10:05:35 -0500 | [diff] [blame] | 78 | GEN_ABSOLUTE_SYM(_DEVICE_STRUCT_HANDLES_OFFSET, |
Gerard Marull-Paretas | 5982d83 | 2023-06-14 12:38:30 +0200 | [diff] [blame] | 79 | offsetof(struct device, deps)); |
Simon Hein | bcd1d19 | 2024-03-08 12:00:10 +0100 | [diff] [blame] | 80 | #endif /* CONFIG_DEVICE_DEPS */ |
Peter Bigot | d554d34 | 2020-06-30 10:05:35 -0500 | [diff] [blame] | 81 | |
Flavio Ceolin | d02a1e9 | 2022-03-20 21:53:42 -0700 | [diff] [blame] | 82 | #ifdef CONFIG_PM_DEVICE |
| 83 | GEN_ABSOLUTE_SYM(_DEVICE_STRUCT_PM_OFFSET, |
| 84 | offsetof(struct device, pm)); |
Simon Hein | bcd1d19 | 2024-03-08 12:00:10 +0100 | [diff] [blame] | 85 | #endif /* CONFIG_PM_DEVICE */ |
Flavio Ceolin | d02a1e9 | 2022-03-20 21:53:42 -0700 | [diff] [blame] | 86 | |
| 87 | /* member offsets in the pm_device structure. Used in image post-processing */ |
| 88 | |
| 89 | GEN_ABSOLUTE_SYM(_PM_DEVICE_STRUCT_FLAGS_OFFSET, |
Krzysztof Chruściński | 25173f7 | 2024-01-10 11:01:11 +0100 | [diff] [blame] | 90 | offsetof(struct pm_device_base, flags)); |
Flavio Ceolin | d02a1e9 | 2022-03-20 21:53:42 -0700 | [diff] [blame] | 91 | |
| 92 | GEN_ABSOLUTE_SYM(_PM_DEVICE_FLAG_PD, PM_DEVICE_FLAG_PD); |
| 93 | |
Andrew Boie | aade2b5 | 2019-06-25 08:53:14 -0700 | [diff] [blame] | 94 | /* LCOV_EXCL_STOP */ |
Flavio Ceolin | a7fffa9 | 2018-09-13 15:06:35 -0700 | [diff] [blame] | 95 | #endif /* ZEPHYR_KERNEL_INCLUDE_KERNEL_OFFSETS_H_ */ |