x86: add prep_c function
Assembly language start code will enter here, which sets up early kernel initialization and then calls z_cstart() when finished. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
c3b3aafaec
commit
02629b69b5
4 changed files with 32 additions and 19 deletions
|
@ -19,6 +19,7 @@ zephyr_library_sources(
|
|||
ia32/swap.S
|
||||
ia32/thread.c
|
||||
ia32/spec_ctrl.c
|
||||
ia32/prep_c.c
|
||||
)
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_IRQ_OFFLOAD ia32/irq_offload.c)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
GTEXT(z_x86_enable_paging)
|
||||
|
||||
/* externs */
|
||||
GTEXT(z_cstart)
|
||||
GTEXT(z_x86_prep_c)
|
||||
|
||||
GDATA(_idt_base_address)
|
||||
GDATA(_interrupt_stack)
|
||||
|
@ -308,10 +308,8 @@ __csSet:
|
|||
outb %al, $0xA1 /* set i8259 slave mask (IRQs 8-15) */
|
||||
#endif
|
||||
|
||||
/* Jump to C portion of kernel initialization and never return */
|
||||
|
||||
jmp z_cstart
|
||||
|
||||
/* call C portion of kernel initialization and never return */
|
||||
call z_x86_prep_c
|
||||
|
||||
_x86_bss_zero:
|
||||
/* ECX = size, EDI = starting address */
|
||||
|
|
27
arch/x86/core/ia32/prep_c.c
Normal file
27
arch/x86/core/ia32/prep_c.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <kernel_structs.h>
|
||||
|
||||
FUNC_NORETURN void z_x86_prep_c(void)
|
||||
{
|
||||
_kernel.nested = 0;
|
||||
_kernel.irq_stack = Z_THREAD_STACK_BUFFER(_interrupt_stack) +
|
||||
CONFIG_ISR_STACK_SIZE;
|
||||
|
||||
#ifdef CONFIG_X86_VERY_EARLY_CONSOLE
|
||||
z_x86_early_serial_init();
|
||||
#endif
|
||||
#ifdef CONFIG_X86_MMU
|
||||
z_x86_paging_init();
|
||||
#endif
|
||||
#if CONFIG_X86_STACK_PROTECTION
|
||||
z_x86_mmu_set_flags(&z_x86_kernel_pdpt, _interrupt_stack, MMU_PAGE_SIZE,
|
||||
MMU_ENTRY_READ, MMU_PTE_RW_MASK, true);
|
||||
#endif
|
||||
|
||||
z_cstart();
|
||||
}
|
|
@ -43,20 +43,7 @@ void z_x86_paging_init(void);
|
|||
*/
|
||||
static inline void kernel_arch_init(void)
|
||||
{
|
||||
_kernel.nested = 0;
|
||||
_kernel.irq_stack = Z_THREAD_STACK_BUFFER(_interrupt_stack) +
|
||||
CONFIG_ISR_STACK_SIZE;
|
||||
|
||||
#ifdef CONFIG_X86_VERY_EARLY_CONSOLE
|
||||
z_x86_early_serial_init();
|
||||
#endif
|
||||
#ifdef CONFIG_X86_MMU
|
||||
z_x86_paging_init();
|
||||
#endif
|
||||
#if CONFIG_X86_STACK_PROTECTION
|
||||
z_x86_mmu_set_flags(&z_x86_kernel_pdpt, _interrupt_stack, MMU_PAGE_SIZE,
|
||||
MMU_ENTRY_READ, MMU_PTE_RW_MASK, true);
|
||||
#endif
|
||||
/* No-op on this arch */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue