blob: 3cadf7e12a0bc7a77b4d23807d4fbf7605cb56a0 [file] [log] [blame]
Benjamin Walshf6ca7de2016-11-08 10:36:50 -05001/*
2 * Copyright (c) 2013-2014 Wind River Systems, Inc.
3 *
David B. Kinderac74d8b2017-01-18 17:01:01 -08004 * SPDX-License-Identifier: Apache-2.0
Benjamin Walshf6ca7de2016-11-08 10:36:50 -05005 */
Gerard Marull-Paretascffefc82022-05-06 11:04:23 +02006#include <zephyr/device.h>
Gerard Marull-Paretascffefc82022-05-06 11:04:23 +02007#include <zephyr/pm/device.h>
Nicolas Pitre1f362a82022-09-26 22:58:21 -04008#include "kernel_internal.h"
Flavio Ceolind02a1e92022-03-20 21:53:42 -07009
Flavio Ceolina7fffa92018-09-13 15:06:35 -070010#ifndef ZEPHYR_KERNEL_INCLUDE_KERNEL_OFFSETS_H_
11#define ZEPHYR_KERNEL_INCLUDE_KERNEL_OFFSETS_H_
Benjamin Walshf6ca7de2016-11-08 10:36:50 -050012
Yong Cong Sinbbe5e1e2024-01-24 17:35:04 +080013#include <zephyr/syscall_list.h>
Andrew Boiefa94ee72017-09-28 16:54:35 -070014
Andrew Boieaade2b52019-06-25 08:53:14 -070015/* 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 Walshf6ca7de2016-11-08 10:36:50 -050021/*
22 * The final link step uses the symbol _OffsetAbsSyms to force the linkage of
23 * offsets.o into the ELF image.
24 */
25
26GEN_ABS_SYM_BEGIN(_OffsetAbsSyms)
27
Andy Rosse6946562018-01-25 16:39:35 -080028GEN_OFFSET_SYM(_cpu_t, current);
29GEN_OFFSET_SYM(_cpu_t, nested);
30GEN_OFFSET_SYM(_cpu_t, irq_stack);
Nicolas Pitref97d1292021-04-15 16:27:45 -040031GEN_OFFSET_SYM(_cpu_t, arch);
Benjamin Walshf6ca7de2016-11-08 10:36:50 -050032
Carlo Caione64dfa692021-03-09 14:18:19 +010033GEN_OFFSET_SYM(_kernel_t, cpus);
34
Bradley Bolen88ba97f2020-12-10 08:45:20 -050035#if defined(CONFIG_FPU_SHARING)
36GEN_OFFSET_SYM(_cpu_t, fp_ctx);
Simon Heinbcd1d192024-03-08 12:00:10 +010037#endif /* CONFIG_FPU_SHARING */
Bradley Bolen88ba97f2020-12-10 08:45:20 -050038
Anas Nashifdd931f92020-09-01 18:31:40 -040039#ifdef CONFIG_PM
Benjamin Walshf6ca7de2016-11-08 10:36:50 -050040GEN_OFFSET_SYM(_kernel_t, idle);
Simon Heinbcd1d192024-03-08 12:00:10 +010041#endif /* CONFIG_PM */
Benjamin Walshf6ca7de2016-11-08 10:36:50 -050042
Andy Rossb11e7962021-09-24 10:57:39 -070043#ifndef CONFIG_SCHED_CPU_MASK_PIN_ONLY
Benjamin Walsh88b36912016-12-02 10:37:27 -050044GEN_OFFSET_SYM(_kernel_t, ready_q);
Simon Heinbcd1d192024-03-08 12:00:10 +010045#endif /* CONFIG_SCHED_CPU_MASK_PIN_ONLY */
Benjamin Walsh1f2a5792016-12-19 12:17:23 -050046
Andy Ross2724fd12018-01-29 14:55:20 -080047#ifndef CONFIG_SMP
Benjamin Walsh88b36912016-12-02 10:37:27 -050048GEN_OFFSET_SYM(_ready_q_t, cache);
Simon Heinbcd1d192024-03-08 12:00:10 +010049#endif /* CONFIG_SMP */
Benjamin Walsh88b36912016-12-02 10:37:27 -050050
Stephanos Ioannidisaaf93202020-05-03 18:03:19 +090051#ifdef CONFIG_FPU_SHARING
Benjamin Walshf6ca7de2016-11-08 10:36:50 -050052GEN_OFFSET_SYM(_kernel_t, current_fp);
Simon Heinbcd1d192024-03-08 12:00:10 +010053#endif /* CONFIG_FPU_SHARING */
Benjamin Walshf6ca7de2016-11-08 10:36:50 -050054
Benjamin Walshed240f22017-01-22 13:05:08 -050055GEN_OFFSET_SYM(_thread_base_t, user_options);
Benjamin Walshf6ca7de2016-11-08 10:36:50 -050056
57GEN_OFFSET_SYM(_thread_t, base);
Benjamin Walshf6ca7de2016-11-08 10:36:50 -050058GEN_OFFSET_SYM(_thread_t, callee_saved);
59GEN_OFFSET_SYM(_thread_t, arch);
60
Andy Ross8bc3b6f2019-10-18 14:12:00 -070061#ifdef CONFIG_USE_SWITCH
62GEN_OFFSET_SYM(_thread_t, switch_handle);
Simon Heinbcd1d192024-03-08 12:00:10 +010063#endif /* CONFIG_USE_SWITCH */
Andy Ross8bc3b6f2019-10-18 14:12:00 -070064
Andrew Boie41c68ec2017-05-11 15:38:20 -070065#ifdef CONFIG_THREAD_STACK_INFO
Andrew Boie41c68ec2017-05-11 15:38:20 -070066GEN_OFFSET_SYM(_thread_t, stack_info);
Simon Heinbcd1d192024-03-08 12:00:10 +010067#endif /* CONFIG_THREAD_STACK_INFO */
Andrew Boie41c68ec2017-05-11 15:38:20 -070068
Daniel Leung02b20352020-09-28 11:27:11 -070069#ifdef CONFIG_THREAD_LOCAL_STORAGE
70GEN_OFFSET_SYM(_thread_t, tls);
Simon Heinbcd1d192024-03-08 12:00:10 +010071#endif /* CONFIG_THREAD_LOCAL_STORAGE */
Daniel Leung02b20352020-09-28 11:27:11 -070072
Nicolas Pitre1f362a82022-09-26 22:58:21 -040073GEN_ABSOLUTE_SYM(__z_interrupt_stack_SIZEOF, sizeof(z_interrupt_stacks[0]));
Yong Cong Sin035c8222024-09-10 19:04:32 +080074GEN_ABSOLUTE_SYM(__z_interrupt_all_stacks_SIZEOF, sizeof(z_interrupt_stacks));
Nicolas Pitre1f362a82022-09-26 22:58:21 -040075
Peter Bigotd554d342020-06-30 10:05:35 -050076/* member offsets in the device structure. Used in image post-processing */
Gerard Marull-Paretas48b201c2023-06-14 14:30:41 +020077#ifdef CONFIG_DEVICE_DEPS
Peter Bigotd554d342020-06-30 10:05:35 -050078GEN_ABSOLUTE_SYM(_DEVICE_STRUCT_HANDLES_OFFSET,
Gerard Marull-Paretas5982d832023-06-14 12:38:30 +020079 offsetof(struct device, deps));
Simon Heinbcd1d192024-03-08 12:00:10 +010080#endif /* CONFIG_DEVICE_DEPS */
Peter Bigotd554d342020-06-30 10:05:35 -050081
Flavio Ceolind02a1e92022-03-20 21:53:42 -070082#ifdef CONFIG_PM_DEVICE
83GEN_ABSOLUTE_SYM(_DEVICE_STRUCT_PM_OFFSET,
84 offsetof(struct device, pm));
Simon Heinbcd1d192024-03-08 12:00:10 +010085#endif /* CONFIG_PM_DEVICE */
Flavio Ceolind02a1e92022-03-20 21:53:42 -070086
87/* member offsets in the pm_device structure. Used in image post-processing */
88
89GEN_ABSOLUTE_SYM(_PM_DEVICE_STRUCT_FLAGS_OFFSET,
Krzysztof Chruściński25173f72024-01-10 11:01:11 +010090 offsetof(struct pm_device_base, flags));
Flavio Ceolind02a1e92022-03-20 21:53:42 -070091
92GEN_ABSOLUTE_SYM(_PM_DEVICE_FLAG_PD, PM_DEVICE_FLAG_PD);
93
Andrew Boieaade2b52019-06-25 08:53:14 -070094/* LCOV_EXCL_STOP */
Flavio Ceolina7fffa92018-09-13 15:06:35 -070095#endif /* ZEPHYR_KERNEL_INCLUDE_KERNEL_OFFSETS_H_ */