The number is actually a mask bit per cpu.
---
 i386/i386/apic.c | 2 +-
 i386/i386/apic.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/i386/i386/apic.c b/i386/i386/apic.c
index 7ec8c49b..e0941c6a 100644
--- a/i386/i386/apic.c
+++ b/i386/i386/apic.c
@@ -337,7 +337,7 @@ lapic_setup(void)
 
     /* Every 8th cpu is in the same logical group */
     dummy = lapic->logical_dest.r;
-    lapic->logical_dest.r = 0x01000000 << (APIC_LOGICAL_ID(cpu));
+    lapic->logical_dest.r = APIC_LOGICAL_ID(cpu) << 24;
 
     dummy = lapic->lvt_lint0.r;
     lapic->lvt_lint0.r = dummy | LAPIC_DISABLE;
diff --git a/i386/i386/apic.h b/i386/i386/apic.h
index ec910456..cb700c44 100644
--- a/i386/i386/apic.h
+++ b/i386/i386/apic.h
@@ -314,7 +314,7 @@ extern uint32_t *hpet_addr;
 
 /* Since Logical Destination Register only has 8 bits of mask,
  * we can only address 8 unique groups of cpus for IPIs.  */
-#define APIC_LOGICAL_ID(cpu)             ((cpu) % 8)
+#define APIC_LOGICAL_ID(cpu)             (1u << ((cpu) % 8))
 
 /* Set or clear a bit in a 255-bit APIC mask register.
    These registers are spread through eight 32-bit registers.  */
-- 
2.45.2



Reply via email to