kernel: add an architecture specific structs header
Add the ability to define architecture specific structures, notably the ability to extend struct _cpu with per-CPU arch-specific stuff that can be accessed with _current_cpu->arch.* similarly to _current->arch.* for per-thead architecture data. This is opt-in for architectures that want to benefit from this, otherwise empty defaults are provided. A placeholder for ARM64 is included to show the pattern. Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
parent
ad1868369c
commit
f97d12936e
5 changed files with 64 additions and 0 deletions
15
include/arch/arm64/structs.h
Normal file
15
include/arch/arm64/structs.h
Normal file
|
@ -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_ */
|
43
include/arch/structs.h
Normal file
43
include/arch/structs.h
Normal file
|
@ -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 <arch/arm64/structs.h>
|
||||
#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_ */
|
Loading…
Add table
Add a link
Reference in a new issue