From 46715faa5c604319f24b28c42ce11fa910f51441 Mon Sep 17 00:00:00 2001 From: Flavio Ceolin Date: Wed, 28 Nov 2018 13:31:05 -0800 Subject: [PATCH] kernel: Remove _IntLibInit function There were many platforms where this function was doing nothing. Just merging its functionality with _PrepC function. Signed-off-by: Flavio Ceolin --- arch/arc/include/kernel_arch_func.h | 5 ----- arch/arm/core/cortex_m/prep_c.c | 3 +++ arch/arm/include/kernel_arch_func.h | 3 --- arch/nios2/include/kernel_arch_func.h | 5 ----- arch/posix/core/posix_core.c | 2 +- arch/posix/include/kernel_arch_func.h | 10 ---------- arch/riscv32/core/prep_c.c | 3 +++ arch/riscv32/include/kernel_arch_func.h | 7 ------- arch/x86/include/kernel_arch_func.h | 10 ---------- arch/xtensa/include/kernel_arch_func.h | 8 -------- kernel/init.c | 2 -- soc/posix/inf_clock/soc.c | 2 ++ 12 files changed, 9 insertions(+), 51 deletions(-) diff --git a/arch/arc/include/kernel_arch_func.h b/arch/arc/include/kernel_arch_func.h index c5cbbb18d227..bd1e6606bae1 100644 --- a/arch/arc/include/kernel_arch_func.h +++ b/arch/arc/include/kernel_arch_func.h @@ -61,11 +61,6 @@ static ALWAYS_INLINE int _INTERRUPT_CAUSE(void) extern void _thread_entry_wrapper(void); extern void _user_thread_entry_wrapper(void); -static inline void _IntLibInit(void) -{ - /* nothing needed, here because the kernel requires it */ -} - extern void _arc_userspace_enter(k_thread_entry_t user_entry, void *p1, void *p2, void *p3, u32_t stack, u32_t size); diff --git a/arch/arm/core/cortex_m/prep_c.c b/arch/arm/core/cortex_m/prep_c.c index b22a5e23d043..9cce3b7c4f79 100644 --- a/arch/arm/core/cortex_m/prep_c.c +++ b/arch/arm/core/cortex_m/prep_c.c @@ -105,6 +105,8 @@ extern FUNC_NORETURN void _Cstart(void); * @return N/A */ +extern void _IntLibInit(void); + #ifdef CONFIG_BOOT_TIME_MEASUREMENT extern u64_t __start_time_stamp; #endif @@ -117,6 +119,7 @@ void _PrepC(void) #ifdef CONFIG_BOOT_TIME_MEASUREMENT __start_time_stamp = 0; #endif + _IntLibInit(); _Cstart(); CODE_UNREACHABLE; } diff --git a/arch/arm/include/kernel_arch_func.h b/arch/arm/include/kernel_arch_func.h index 49b838fb038e..b249600f73a7 100644 --- a/arch/arm/include/kernel_arch_func.h +++ b/arch/arm/include/kernel_arch_func.h @@ -127,9 +127,6 @@ extern void k_cpu_atomic_idle(unsigned int key); #define _is_in_isr() _IsInIsr() -extern void _IntLibInit(void); - - extern FUNC_NORETURN void _arm_userspace_enter(k_thread_entry_t user_entry, void *p1, void *p2, void *p3, u32_t stack_end, diff --git a/arch/nios2/include/kernel_arch_func.h b/arch/nios2/include/kernel_arch_func.h index 1bc9059e4754..d704b77aeda5 100644 --- a/arch/nios2/include/kernel_arch_func.h +++ b/arch/nios2/include/kernel_arch_func.h @@ -41,11 +41,6 @@ _set_thread_return_value(struct k_thread *thread, unsigned int value) thread->callee_saved.retval = value; } -static inline void _IntLibInit(void) -{ - /* No special initialization of the interrupt subsystem required */ -} - #define _is_in_isr() (_kernel.nested != 0U) #ifdef CONFIG_IRQ_OFFLOAD diff --git a/arch/posix/core/posix_core.c b/arch/posix/core/posix_core.c index c3d5404a39fc..72e33ff54df0 100644 --- a/arch/posix/core/posix_core.c +++ b/arch/posix/core/posix_core.c @@ -385,7 +385,7 @@ void posix_new_thread(posix_thread_status_t *ptr) } /** - * Called from _IntLibInit() + * Called from zephyr_wrapper() * prepare whatever needs to be prepared to be able to start threads */ void posix_init_multithreading(void) diff --git a/arch/posix/include/kernel_arch_func.h b/arch/posix/include/kernel_arch_func.h index 50c643d891d1..018fc5a0bf26 100644 --- a/arch/posix/include/kernel_arch_func.h +++ b/arch/posix/include/kernel_arch_func.h @@ -49,16 +49,6 @@ _set_thread_return_value(struct k_thread *thread, unsigned int value) thread->callee_saved.retval = value; } - -/* - * _IntLibInit() is called from the non-arch specific function, - * prepare_multithreading(). - */ -static inline void _IntLibInit(void) -{ - posix_init_multithreading(); -} - #ifdef __cplusplus } #endif diff --git a/arch/riscv32/core/prep_c.c b/arch/riscv32/core/prep_c.c index e131857a98ba..96c7997c11f8 100644 --- a/arch/riscv32/core/prep_c.c +++ b/arch/riscv32/core/prep_c.c @@ -34,6 +34,9 @@ void _PrepC(void) _bss_zero(); #ifdef CONFIG_XIP _data_copy(); +#endif +#if defined(CONFIG_RISCV_SOC_INTERRUPT_INIT) + soc_interrupt_init(); #endif _Cstart(); CODE_UNREACHABLE; diff --git a/arch/riscv32/include/kernel_arch_func.h b/arch/riscv32/include/kernel_arch_func.h index 50f1fc2a8d36..a02bec063d6d 100644 --- a/arch/riscv32/include/kernel_arch_func.h +++ b/arch/riscv32/include/kernel_arch_func.h @@ -37,13 +37,6 @@ _set_thread_return_value(struct k_thread *thread, unsigned int value) thread->arch.swap_return_value = value; } -static inline void _IntLibInit(void) -{ -#if defined(CONFIG_RISCV_SOC_INTERRUPT_INIT) - soc_interrupt_init(); -#endif -} - FUNC_NORETURN void _NanoFatalErrorHandler(unsigned int reason, const NANO_ESF *esf); diff --git a/arch/x86/include/kernel_arch_func.h b/arch/x86/include/kernel_arch_func.h index 252cd31b1239..79e45d9b9d37 100644 --- a/arch/x86/include/kernel_arch_func.h +++ b/arch/x86/include/kernel_arch_func.h @@ -118,16 +118,6 @@ static inline void write_x2apic(unsigned int reg, u32_t val) } #endif -/* - * _IntLibInit() is called from the non-arch specific function, - * prepare_multithreading(). The IA-32 kernel does not require any special - * initialization of the interrupt subsystem. However, we still need to - * provide an _IntLibInit() of some sort to prevent build errors. - */ -static inline void _IntLibInit(void) -{ -} - extern FUNC_NORETURN void _x86_userspace_enter(k_thread_entry_t user_entry, void *p1, void *p2, void *p3, u32_t stack_end, diff --git a/arch/xtensa/include/kernel_arch_func.h b/arch/xtensa/include/kernel_arch_func.h index 04c07dfde03a..20f07dea7483 100644 --- a/arch/xtensa/include/kernel_arch_func.h +++ b/arch/xtensa/include/kernel_arch_func.h @@ -118,14 +118,6 @@ _set_thread_return_value(struct k_thread *thread, unsigned int value) extern void k_cpu_atomic_idle(unsigned int key); -/* - * Required by the core kernel even though we don't have to do anything on this - * arch. - */ -static inline void _IntLibInit(void) -{ -} - #include /* For size_t */ #ifdef __cplusplus diff --git a/kernel/init.c b/kernel/init.c index f0cbed045fee..c63fccecb430 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -463,8 +463,6 @@ FUNC_NORETURN void _Cstart(void) * drivers are initialized. */ - _IntLibInit(); - if (IS_ENABLED(CONFIG_LOG)) { log_core_init(); } diff --git a/soc/posix/inf_clock/soc.c b/soc/posix/inf_clock/soc.c index f0b610ca0b26..8835e0a5a502 100644 --- a/soc/posix/inf_clock/soc.c +++ b/soc/posix/inf_clock/soc.c @@ -183,6 +183,8 @@ static void *zephyr_wrapper(void *a) zephyr_thread); #endif + posix_init_multithreading(); + /* Start Zephyr: */ _Cstart(); CODE_UNREACHABLE;