x86: move calling z_loapic_enable into z_x86_prep_c
This moves calling z_loapic_enable() from crt0.S into z_x86_prep_c(). This is done so we can move BSS clearing and data section copying inside z_x86_prep_c() as these are needed before calling z_loapic_enable(). Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
5a9f997a80
commit
dd98de880a
3 changed files with 16 additions and 8 deletions
|
@ -224,13 +224,6 @@ __csSet:
|
||||||
movl %eax, %cr0
|
movl %eax, %cr0
|
||||||
#endif /* CONFIG_X86_MMU */
|
#endif /* CONFIG_X86_MMU */
|
||||||
|
|
||||||
#ifdef CONFIG_LOAPIC
|
|
||||||
/* For BSP, cpu_number is 0 */
|
|
||||||
xorl %eax, %eax
|
|
||||||
pushl %eax
|
|
||||||
call z_loapic_enable
|
|
||||||
#endif
|
|
||||||
|
|
||||||
pushl %ebx /* pointer to multiboot info, or NULL */
|
pushl %ebx /* pointer to multiboot info, or NULL */
|
||||||
call z_x86_prep_c /* enter kernel; never returns */
|
call z_x86_prep_c /* enter kernel; never returns */
|
||||||
|
|
||||||
|
|
|
@ -163,8 +163,19 @@ FUNC_NORETURN void z_x86_cpu_init(struct x86_cpuboot *cpuboot)
|
||||||
{
|
{
|
||||||
x86_sse_init(NULL);
|
x86_sse_init(NULL);
|
||||||
|
|
||||||
|
#if CONFIG_MP_NUM_CPUS > 1
|
||||||
/* The internal cpu_number is the index to x86_cpuboot[] */
|
/* The internal cpu_number is the index to x86_cpuboot[] */
|
||||||
z_loapic_enable((unsigned char)(cpuboot - x86_cpuboot));
|
unsigned char cpu_num = (unsigned char)(cpuboot - x86_cpuboot);
|
||||||
|
|
||||||
|
if (cpu_num > 0) {
|
||||||
|
/*
|
||||||
|
* For CPU #0, z_loapic_enable(0) will be done
|
||||||
|
* inside z_x86_prep_c() so there is no need to do it
|
||||||
|
* here.
|
||||||
|
*/
|
||||||
|
z_loapic_enable(cpu_num);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
/* Set landing site for 'syscall' instruction */
|
/* Set landing site for 'syscall' instruction */
|
||||||
|
|
|
@ -22,6 +22,10 @@ FUNC_NORETURN void z_x86_prep_c(void *arg)
|
||||||
|
|
||||||
_kernel.cpus[0].nested = 0;
|
_kernel.cpus[0].nested = 0;
|
||||||
|
|
||||||
|
#if defined(CONFIG_LOAPIC)
|
||||||
|
z_loapic_enable(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_X86_VERY_EARLY_CONSOLE
|
#ifdef CONFIG_X86_VERY_EARLY_CONSOLE
|
||||||
z_x86_early_serial_init();
|
z_x86_early_serial_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue