diff options
-rw-r--r-- | arch/x86/machine/boot.c | 6 | ||||
-rw-r--r-- | arch/x86/machine/cpu.c | 2 | ||||
-rw-r--r-- | arch/x86/machine/cpu.h | 6 | ||||
-rw-r--r-- | arch/x86/machine/pmap.c | 2 | ||||
-rw-r--r-- | arch/x86/machine/pmap.h | 2 | ||||
-rw-r--r-- | kern/kernel.c | 13 | ||||
-rw-r--r-- | kern/kernel.h | 7 |
7 files changed, 32 insertions, 6 deletions
diff --git a/arch/x86/machine/boot.c b/arch/x86/machine/boot.c index 98c3b9ce..b15b14ab 100644 --- a/arch/x86/machine/boot.c +++ b/arch/x86/machine/boot.c @@ -292,11 +292,7 @@ boot_ap_main(void) { cpu_ap_setup(); pmap_ap_bootstrap(); - - cpu_intr_enable(); - - for (;;) - cpu_idle(); + kernel_ap_main(); /* Never reached */ } diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c index 2b98b58c..1ca690cb 100644 --- a/arch/x86/machine/cpu.c +++ b/arch/x86/machine/cpu.c @@ -435,6 +435,7 @@ cpu_mp_setup(void) { acpimp_setup(); cpu_mp_start_aps(); + cpu_intr_enable(); pmap_mp_setup(); cpu_mp_info(); } @@ -445,4 +446,5 @@ cpu_ap_setup(void) cpu_init(&cpu_array[boot_ap_id]); cpu_check(cpu_current()); lapic_ap_setup(); + cpu_intr_enable(); } diff --git a/arch/x86/machine/cpu.h b/arch/x86/machine/cpu.h index f4202ee2..674892ad 100644 --- a/arch/x86/machine/cpu.h +++ b/arch/x86/machine/cpu.h @@ -436,11 +436,15 @@ void cpu_mp_register_lapic(unsigned int apic_id, int is_bsp); /* * Probe application processors and start them. + * + * This function enables interrupts. */ void cpu_mp_setup(void); /* - * AP-specific functions. + * CPU initialization on APs. + * + * This function enables interrupts. */ void cpu_ap_setup(void); diff --git a/arch/x86/machine/pmap.c b/arch/x86/machine/pmap.c index de29c016..4aa1e4de 100644 --- a/arch/x86/machine/pmap.c +++ b/arch/x86/machine/pmap.c @@ -546,6 +546,8 @@ pmap_kextract(unsigned long va) void pmap_mp_setup(void) { + assert(cpu_intr_enabled()); + pmap_mp_mode = 1; } diff --git a/arch/x86/machine/pmap.h b/arch/x86/machine/pmap.h index cbaf6597..89b36b52 100644 --- a/arch/x86/machine/pmap.h +++ b/arch/x86/machine/pmap.h @@ -177,6 +177,8 @@ phys_addr_t pmap_kextract(unsigned long va); /* * Prepare the pmap module for a multiprocessor environment. + * + * Interrupts must be enabled when calling this function. */ void pmap_mp_setup(void); diff --git a/kern/kernel.c b/kern/kernel.c index 9e7f0435..70cc8c71 100644 --- a/kern/kernel.c +++ b/kern/kernel.c @@ -37,6 +37,8 @@ kernel_main(void) struct thread *thread; int error; + assert(!cpu_intr_enabled()); + task_setup(); thread_setup(); cpu_mp_setup(); @@ -50,3 +52,14 @@ kernel_main(void) /* Never reached */ } + +void __init +kernel_ap_main(void) +{ + assert(cpu_intr_enabled()); + + for (;;) + cpu_idle(); + + /* Never reached */ +} diff --git a/kern/kernel.h b/kern/kernel.h index 2505541d..22d5714b 100644 --- a/kern/kernel.h +++ b/kern/kernel.h @@ -29,4 +29,11 @@ */ void kernel_main(void); +/* + * Entry point for APs. + * + * Interrupts must be enabled when calling this function. + */ +void kernel_ap_main(void); + #endif /* _KERN_KERNEL_H */ |