diff options
author | Richard Braun <rbraun@sceen.net> | 2012-12-11 21:42:30 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2012-12-11 21:42:30 +0100 |
commit | 32dd2e582a6041d672be066306225604e4b898da (patch) | |
tree | 9aeda74f6d973101cc717560f897bfc4436f95ec | |
parent | 13ec72e8ae44308a1340f6f17641bddfe61b072d (diff) |
Adjust interrupts configuration on kernel entry
-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 98c3b9c..b15b14a 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 2b98b58..1ca690c 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 f4202ee..674892a 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 de29c01..4aa1e4d 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 cbaf659..89b36b5 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 9e7f043..70cc8c7 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 2505541..22d5714 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 */ |