diff --git a/kernel/arch/i386/apic.c b/kernel/arch/i386/apic.c index 8bc855b2a..ed6f48e03 100644 --- a/kernel/arch/i386/apic.c +++ b/kernel/arch/i386/apic.c @@ -835,7 +835,7 @@ PUBLIC void apic_idt_init(const int reset) } #ifdef CONFIG_APIC_DEBUG - if (cpu_is_bsp(cpuid)) + if (is_bsp) printf("APIC debugging is enabled\n"); lapic_set_dummy_handlers(); #endif diff --git a/kernel/arch/i386/arch_smp.c b/kernel/arch/i386/arch_smp.c index ce6009aaa..b10abbaa9 100644 --- a/kernel/arch/i386/arch_smp.c +++ b/kernel/arch/i386/arch_smp.c @@ -190,6 +190,12 @@ PRIVATE void ap_finish_booting(void) while(!i386_paging_enabled) arch_pause(); + /* + * we must load some page tables befre we turn paging on. As VM is + * always present we use those + */ + segmentation2paging(proc_addr(VM_PROC_NR)); + BKL_LOCK(); printf("CPU %d is running\n", cpu); BKL_UNLOCK(); diff --git a/kernel/arch/i386/include/arch_proto.h b/kernel/arch/i386/include/arch_proto.h index 54658754c..189d879ce 100644 --- a/kernel/arch/i386/include/arch_proto.h +++ b/kernel/arch/i386/include/arch_proto.h @@ -54,6 +54,7 @@ _PROTOTYPE( void kernel_call_entry, (void) ); _PROTOTYPE( void level0_call, (void) ); /* memory.c */ +_PROTOTYPE( void segmentation2paging, (struct proc * current)); _PROTOTYPE( void i386_freepde, (int pde)); _PROTOTYPE( void getcr3val, (void)); diff --git a/kernel/main.c b/kernel/main.c index a870e4466..043926341 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -285,8 +285,14 @@ PUBLIC int main(void) } else if (config_no_smp) { BOOT_VERBOSE(printf("SMP disabled, using legacy PIC\n")); smp_single_cpu_fallback(); - } else + } else { smp_init(); + /* + * if smp_init() returns it means that it failed and we try to finish + * single CPU booting + */ + bsp_finish_booting(); + } #else /* * if configured for a single CPU, we are already on the kernel stack which we