From 4dd07e0787270dbcce2aa6171912ea73bfdd2e4f Mon Sep 17 00:00:00 2001 From: AlmuHS Date: Thu, 3 Oct 2019 19:01:55 +0200 Subject: fix: add shift 24 in apic id --- i386/i386/cpuboot.S | 4 +--- i386/i386/mp_desc.c | 2 +- i386/i386at/acpi_rsdp.c | 4 ++-- i386/i386at/model_dep.c | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/i386/i386/cpuboot.S b/i386/i386/cpuboot.S index b0bccbdb..071b62c9 100644 --- a/i386/i386/cpuboot.S +++ b/i386/i386/cpuboot.S @@ -129,6 +129,4 @@ gdt_tmp: _apbootend: apbootend: -// .globl dummyf -//dummyf: -ret + diff --git a/i386/i386/mp_desc.c b/i386/i386/mp_desc.c index 10caeb19..557b7e18 100644 --- a/i386/i386/mp_desc.c +++ b/i386/i386/mp_desc.c @@ -299,7 +299,7 @@ cpu_setup() /* assume Pentium 4, Xeon, or later processors */ //unsigned apic_id = (((ApicLocalUnit*)phystokv(lapic_addr))->apic_id.r >> 24) & 0xff; - unsigned apic_id = lapic->apic_id.r; + unsigned apic_id = lapic->apic_id.r >>24; /* panic? */ if(i >= ncpu) diff --git a/i386/i386at/acpi_rsdp.c b/i386/i386at/acpi_rsdp.c index 9617a589..3341407b 100644 --- a/i386/i386at/acpi_rsdp.c +++ b/i386/i386at/acpi_rsdp.c @@ -263,9 +263,9 @@ acpi_apic_setup(){ if((lapic_entry->flags & 0x1) && ncpu < NCPUS){ //Enumerate CPU and add It to cpu/apic vector - machine_slot[ncpu].apic_id = lapic_entry->apic_id; + machine_slot[ncpu].apic_id = lapic_entry->apic_id >>24; machine_slot[ncpu].is_cpu = TRUE; - apic2kernel[lapic_entry->apic_id] = ncpu; + apic2kernel[lapic_entry->apic_id >>24] = ncpu; //Increase number of CPU ncpu++; diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index e47ef317..e5ad89a8 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -689,7 +689,7 @@ void c_boot_entry(vm_offset_t bi) } if(lapic != 0){ - apic_id = lapic->apic_id.r; + apic_id = lapic->apic_id.r >>24; //update BSP machine_slot and apic2kernel machine_slot[0].apic_id = apic_id; -- cgit v1.2.3