SMP - The slave CPUs turn paging on

- APs wait until BSP turns paging on, it is not possible to safely
  execute any code on APs until we can turn paging on as well as it
  must be done synchronously everywhere

- APs turn paging on but do not continue and wait
This commit is contained in:
Tomas Hruby 2010-09-15 14:10:07 +00:00
parent 6aa26565e6
commit 85cca7096f
4 changed files with 15 additions and 2 deletions

View file

@ -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

View file

@ -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();

View file

@ -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));

View file

@ -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