Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
initialize APIC after the intialization of IDT & GDT
Browse files Browse the repository at this point in the history
- fix problems with Qemu
  • Loading branch information
stlankes committed Aug 4, 2017
1 parent ba72913 commit d785b1b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions arch/x86/kernel/apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,12 +905,7 @@ extern int set_idle_task(void);
#if MAX_CORES > 1
int smp_start(void)
{
x2apic_enable();

// reset APIC and set id
lapic_reset();

LOG_DEBUG("Processor %d (local id %d) is entering its idle task\n", apic_cpu_id(), atomic_int32_read(&current_boot_id));
LOG_DEBUG("Try to initialize processor (local id %d)\n", atomic_int32_read(&current_boot_id));

// use the same gdt like the boot processors
gdt_flush();
Expand All @@ -921,6 +916,12 @@ int smp_start(void)
// enable additional cpu features
cpu_detection();

x2apic_enable();

// reset APIC
lapic_reset();

LOG_DEBUG("Processor %d (local id %d) is entering its idle task\n", apic_cpu_id(), atomic_int32_read(&current_boot_id));
LOG_DEBUG("CR0 of core %u: 0x%x\n", atomic_int32_read(&current_boot_id), read_cr0());
online[atomic_int32_read(&current_boot_id)] = 1;

Expand Down

0 comments on commit d785b1b

Please sign in to comment.