arch/x86: elevate prep_c.c to common code

Elevate the previously 32-bit-only z_x86_prep_c() function to common
code, so both 32-bit and 64-bit arches now enter the kernel this way.
Minor changes to prep_c.c to make it build with the SMP scheduler on.

Signed-off-by: Charles E. Youse <charles.youse@intel.com>
This commit is contained in:
Charles E. Youse 2019-09-28 14:25:13 -04:00 committed by Anas Nashif
commit 8279af76c8
5 changed files with 8 additions and 23 deletions

View file

@ -9,6 +9,7 @@ endif ()
zephyr_library_sources(cpuhalt.c)
zephyr_library_sources(memmap.c)
zephyr_library_sources(prep_c.c)
zephyr_library_sources_if_kconfig(pcie.c)
zephyr_library_sources_if_kconfig(reboot_rst_cnt.c)

View file

@ -18,7 +18,6 @@ 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)

View file

@ -108,20 +108,6 @@ __start:
rep stosq
#endif
#ifdef CONFIG_MULTIBOOT_INFO
/* If EBX isn't 0, then we have a valid multiboot info struct. */
testl %ebx, %ebx
jz 1f
movl %ebx, %esi
movl $__MULTIBOOT_INFO_SIZEOF, %ecx
movq $multiboot_info, %rdi
rep
movsb
1:
#endif /* CONFIG_MULTIBOOT_INFO */
/*
* set up SSE in case something uses the floating-point unit during
* early initialization (either directly, or if GCC gets clever)
@ -132,7 +118,8 @@ __start:
/* don't replace CALL with JMP; honor the ABI stack alignment! */
call z_cstart
movl %ebx, %edi /* multiboot pointer (or NULL) */
call z_x86_prep_c /* enter kernel; never returns */
stop: jmp stop

View file

@ -16,8 +16,4 @@
GEN_OFFSET_SYM(_thread_arch_t, flags);
/* size of struct multiboot_info, used by crt0.S/locore.S */
GEN_ABSOLUTE_SYM(__MULTIBOOT_INFO_SIZEOF, sizeof(struct multiboot_info));
GEN_ABS_SYM_END

View file

@ -8,11 +8,13 @@
#include <arch/x86/acpi.h>
#include <arch/x86/multiboot.h>
extern FUNC_NORETURN void z_cstart(void);
FUNC_NORETURN void z_x86_prep_c(struct multiboot_info *info)
{
_kernel.nested = 0;
_kernel.irq_stack = Z_THREAD_STACK_BUFFER(_interrupt_stack) +
CONFIG_ISR_STACK_SIZE;
_kernel.cpus[0].nested = 0;
_kernel.cpus[0].irq_stack = Z_THREAD_STACK_BUFFER(_interrupt_stack) +
CONFIG_ISR_STACK_SIZE;
#ifdef CONFIG_X86_VERY_EARLY_CONSOLE
z_x86_early_serial_init();