Skip to content

[PRELIMINARY] headers: Refactor kernel_structs.h and introduce kernel_arch.h. #20047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions arch/arm/core/cortex_m/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@
* Common fault handler for ARM Cortex-M processors.
*/

#include <toolchain.h>
#include <linker/sections.h>

#include <kernel.h>
#include <kernel_structs.h>
#include <kernel_arch.h>
#include <inttypes.h>
#include <exc_handle.h>
#include <logging/log.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/core/cortex_r/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

#include <kernel.h>
#include <kernel_structs.h>
#include <kernel_arch.h>

/**
*
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/core/fatal.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <inttypes.h>

#include <kernel.h>
#include <kernel_structs.h>
#include <kernel_arch.h>
#include <logging/log.h>
LOG_MODULE_DECLARE(os);

Expand Down
2 changes: 2 additions & 0 deletions arch/arm/core/offsets/offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
*/

#include <gen_offset.h>
#include <kernel.h>
#include <kernel_arch_data.h>
#include <kernel_structs.h>
#include <kernel_offsets.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/core/swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <kernel.h>
#include <toolchain.h>
#include <kernel_structs.h>
#include <kernel_arch.h>

#ifdef CONFIG_EXECUTION_BENCHMARKING
extern void read_timer_start_of_swap(void);
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/core/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <kernel.h>
#include <toolchain.h>
#include <kernel_structs.h>
#include <kernel_arch.h>
#include <wait_q.h>

#ifdef CONFIG_USERSPACE
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/include/kernel_arch_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#ifndef ZEPHYR_ARCH_ARM_INCLUDE_KERNEL_ARCH_FUNC_H_
#define ZEPHYR_ARCH_ARM_INCLUDE_KERNEL_ARCH_FUNC_H_

#include <kernel_arch_data.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
3 changes: 2 additions & 1 deletion arch/nios2/core/crt0.S
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <kernel_structs.h>
#include <toolchain.h>
#include <linker/sections.h>

/* exports */
GTEXT(__start)
Expand Down
3 changes: 2 additions & 1 deletion arch/nios2/core/exception.S
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <kernel_structs.h>
#include <toolchain.h>
#include <linker/sections.h>
#include <offsets_short.h>

/* exports */
Expand Down
6 changes: 1 addition & 5 deletions arch/nios2/core/prep_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
* initialization is performed.
*/

#include <zephyr/types.h>
#include <toolchain.h>
#include <linker/linker-defs.h>
#include <kernel_structs.h>
#include <kernel_internal.h>
#include <kernel_arch.h>

/**
*
Expand Down
4 changes: 2 additions & 2 deletions arch/nios2/core/reset.S
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <arch/cpu.h>
#include <kernel_structs.h>
#include <toolchain.h>
#include <offsets_short.h>
#include <arch/cpu.h>

GTEXT(__start)

3 changes: 2 additions & 1 deletion arch/nios2/core/swap.S
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <kernel_structs.h>
#include <toolchain.h>
#include <linker/sections.h>
#include <offsets_short.h>

/* exports */
Expand Down
2 changes: 2 additions & 0 deletions arch/nios2/include/kernel_arch_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#ifndef ZEPHYR_ARCH_NIOS2_INCLUDE_KERNEL_ARCH_FUNC_H_
#define ZEPHYR_ARCH_NIOS2_INCLUDE_KERNEL_ARCH_FUNC_H_

#include <kernel_arch_data.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
4 changes: 2 additions & 2 deletions arch/riscv/core/irq_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <toolchain.h>
#include <kernel_structs.h>
#include <kernel.h>
#include <kernel_arch.h>
#include <logging/log.h>
LOG_MODULE_DECLARE(os);

Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/core/isr.S
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include <toolchain.h>
#include <linker/sections.h>
#include <kernel_structs.h>
#include <offsets_short.h>
#include <arch/cpu.h>

/* imports */
GDATA(_sw_isr_table)
Expand Down
3 changes: 2 additions & 1 deletion arch/riscv/core/reset.S
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <kernel_structs.h>
#include <toolchain.h>
#include <linker/sections.h>

/* exports */
GTEXT(__initialize)
Expand Down
5 changes: 3 additions & 2 deletions arch/riscv/core/swap.S
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <irq.h>
#include <kernel_structs.h>
#include <toolchain.h>
#include <linker/sections.h>
#include <offsets_short.h>
#include <arch/cpu.h>

/* exports */
GTEXT(z_arch_swap)
Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/include/kernel_arch_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef ZEPHYR_ARCH_RISCV_INCLUDE_KERNEL_ARCH_FUNC_H_
#define ZEPHYR_ARCH_RISCV_INCLUDE_KERNEL_ARCH_FUNC_H_

#include <soc.h>
#include <kernel_arch_data.h>

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 2 additions & 0 deletions arch/x86/core/ia32/cache_s.S
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* This module contains functions for manipulating caches.
*/

#include <toolchain.h>
#include <linker/sections.h>
#include <arch/x86/ia32/asm.h>

#ifndef CONFIG_CLFLUSH_INSTRUCTION_SUPPORTED
Expand Down
2 changes: 2 additions & 0 deletions arch/x86/core/ia32/crt0.S
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* after having been loaded into RAM.
*/

#include <toolchain.h>
#include <linker/sections.h>
#include <arch/x86/ia32/asm.h>
#include <arch/x86/msr.h>
#include <kernel_arch_data.h>
Expand Down
5 changes: 3 additions & 2 deletions arch/x86/core/ia32/excstub.S
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
* and exiting a C exception handler.
*/

#include <kernel_structs.h>
#include <toolchain.h>
#include <linker/sections.h>
#include <offsets_short.h>
#include <arch/x86/ia32/asm.h>
#include <arch/x86/ia32/arch.h> /* For MK_ISR_NAME */
#include <offsets_short.h>


/* exports (internal APIs) */
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/core/ia32/fatal.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <linker/sections.h>

#include <kernel.h>
#include <kernel_structs.h>
#include <kernel_arch.h>
#include <drivers/interrupt_controller/sysapic.h>
#include <arch/x86/ia32/segmentation.h>
#include <ia32/exception.h>
Expand Down
3 changes: 1 addition & 2 deletions arch/x86/core/ia32/float.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@
* to enable FP register sharing on its behalf.
*/

#include <kernel_structs.h>
#include <toolchain.h>
#include <kernel_arch.h>

/* SSE control/status register default value (used by assembler code) */
extern u32_t _sse_mxcsr_default_value;
Expand Down
5 changes: 3 additions & 2 deletions arch/x86/core/ia32/intstub.S
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
* entering and exiting a C interrupt handler.
*/

#include <kernel_structs.h>
#include <arch/x86/ia32/asm.h>
#include <toolchain.h>
#include <linker/sections.h>
#include <offsets_short.h>
#include <arch/x86/ia32/asm.h>
#include <arch/cpu.h>
#include <drivers/interrupt_controller/sysapic.h>

Expand Down
7 changes: 5 additions & 2 deletions arch/x86/core/ia32/swap.S
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
* This module implements the z_arch_swap() routine for the IA-32 architecture.
*/

#include <kernel_structs.h>
#include <arch/x86/ia32/asm.h>
#include <toolchain.h>
#include <linker/sections.h>
#include <offsets_short.h>
#include <kernel.h>
#include <kernel_arch_data.h>
#include <arch/x86/ia32/asm.h>

/* exports (internal APIs) */

Expand Down
5 changes: 3 additions & 2 deletions arch/x86/core/ia32/userspace.S
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <kernel_structs.h>
#include <toolchain.h>
#include <linker/sections.h>
#include <offsets_short.h>
#include <arch/x86/ia32/asm.h>
#include <arch/cpu.h>
#include <offsets_short.h>
#include <syscall.h>

/* Exports */
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/core/ia32/x86_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <arch/x86/mmustructs.h>
#include <linker/linker-defs.h>
#include <kernel_internal.h>
#include <kernel_structs.h>
#include <kernel_arch.h>
#include <init.h>
#include <ctype.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/core/prep_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include <kernel_structs.h>
#include <kernel_arch.h>
#include <arch/x86/acpi.h>
#include <arch/x86/multiboot.h>

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/include/ia32/kernel_arch_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#ifndef _ASMLANGUAGE

#include <stddef.h> /* For size_t */
#include <kernel_arch_data.h>

#ifdef __cplusplus
extern "C" {
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/include/intel64/kernel_arch_func.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef ZEPHYR_ARCH_X86_INCLUDE_INTEL64_KERNEL_ARCH_FUNC_H_
#define ZEPHYR_ARCH_X86_INCLUDE_INTEL64_KERNEL_ARCH_FUNC_H_

#include <kernel_structs.h>
#include <kernel_arch_data.h>

#ifndef _ASMLANGUAGE

Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/core/offsets/offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

/* list of headers that define whose structure offsets will be generated */

#include <kernel_arch_data.h>
#include <kernel_structs.h>

#include <kernel_offsets.h>

/* Xtensa-specific k_thread structure member offsets */
Expand Down
1 change: 1 addition & 0 deletions include/arch/arm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#ifndef ZEPHYR_INCLUDE_ARCH_ARM_CORTEX_M_IRQ_H_
#define ZEPHYR_INCLUDE_ARCH_ARM_CORTEX_M_IRQ_H_

#include <kernel_structs.h>
#include <irq.h>
#include <sw_isr_table.h>
#include <stdbool.h>
Expand Down
2 changes: 1 addition & 1 deletion include/sys/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static inline int sys_mutex_unlock(struct sys_mutex *mutex)

#else
#include <kernel.h>
#include <kernel_structs.h>
#include <kernel_arch.h>

struct sys_mutex {
struct k_mutex kernel_mutex;
Expand Down
4 changes: 2 additions & 2 deletions kernel/errno.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* context switching.
*/

#include <kernel_structs.h>
#include <syscall_handler.h>
#include <kernel.h>
#include <kernel_arch.h>

/*
* Define _k_neg_eagain for use in assembly files as errno.h is
Expand Down
Loading