diff --git a/include/arch/arm64/structs.h b/include/arch/arm64/structs.h new file mode 100644 index 00000000000..25d0659377c --- /dev/null +++ b/include/arch/arm64/structs.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_INCLUDE_ARM64_STRUCTS_H_ +#define ZEPHYR_INCLUDE_ARM64_STRUCTS_H_ + +/* Per CPU architecture specifics */ +struct _cpu_arch { + /* content coming soon */ +}; + +#endif /* ZEPHYR_INCLUDE_ARM64_STRUCTS_H_ */ diff --git a/include/arch/structs.h b/include/arch/structs.h new file mode 100644 index 00000000000..ca452ef17d2 --- /dev/null +++ b/include/arch/structs.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) BayLibre SAS + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * The purpose of this file is to provide essential/minimal architecture- + * specific structure definitions to be included in generic kernel + * structures. + * + * The following rules must be observed: + * 1. arch/structs.h shall not depend on kernel.h both directly and + * indirectly (i.e. it shall not include any header files that include + * kernel.h in their dependency chain). + * 2. kernel.h shall imply arch/structs.h via kernel_structs.h , such that + * it shall not be necessary to include arch/structs.h explicitly when + * kernel.h is included. + */ + +#ifndef ZEPHYR_INCLUDE_ARCH_STRUCTS_H_ +#define ZEPHYR_INCLUDE_ARCH_STRUCTS_H_ + +#if !defined(_ASMLANGUAGE) + +#if defined(CONFIG_ARM64) +#include +#else + +/* Default definitions when no architecture specific definitions exist. */ + +/* Per CPU architecture specifics (empty) */ +struct _cpu_arch { +}; + +#endif + +/* typedefs to be used with GEN_OFFSET_SYM(), etc. */ +typedef struct _cpu_arch _cpu_arch_t; + +#endif /* _ASMLANGUAGE */ + +#endif /* ZEPHYR_INCLUDE_ARCH_STRUCTS_H_ */ diff --git a/include/kernel_structs.h b/include/kernel_structs.h index 41d9ff3a04b..8be2e17da9a 100644 --- a/include/kernel_structs.h +++ b/include/kernel_structs.h @@ -27,6 +27,7 @@ #include #include #include +#include #endif #define K_NUM_PRIORITIES \ @@ -125,6 +126,9 @@ struct _cpu { /* True when _current is allowed to context switch */ uint8_t swap_ok; #endif + + /* Per CPU architecture specifics */ + struct _cpu_arch arch; }; typedef struct _cpu _cpu_t; diff --git a/kernel/include/kernel_offsets.h b/kernel/include/kernel_offsets.h index ac7efa65d65..8b864fad1f7 100644 --- a/kernel/include/kernel_offsets.h +++ b/kernel/include/kernel_offsets.h @@ -26,6 +26,7 @@ GEN_ABS_SYM_BEGIN(_OffsetAbsSyms) GEN_OFFSET_SYM(_cpu_t, current); GEN_OFFSET_SYM(_cpu_t, nested); GEN_OFFSET_SYM(_cpu_t, irq_stack); +GEN_OFFSET_SYM(_cpu_t, arch); GEN_ABSOLUTE_SYM(___cpu_t_SIZEOF, sizeof(struct _cpu)); diff --git a/scripts/checkpatch/typedefsfile b/scripts/checkpatch/typedefsfile index 4b1a96ecbb5..71fd5031a30 100644 --- a/scripts/checkpatch/typedefsfile +++ b/scripts/checkpatch/typedefsfile @@ -1,3 +1,4 @@ +_cpu_arch_t k_mem_partition_attr_t mbedtls_pk_context z_arch_esf_t