From 39c64a75878480ca96b2ed61d89c51c199ade21a Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 9 Dec 2024 22:23:10 +0100 Subject: Comment on the reason for the different CPU_NUMBER versions --- i386/i386/cpu_number.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/i386/i386/cpu_number.h b/i386/i386/cpu_number.h index 67c19e9b..547e0498 100644 --- a/i386/i386/cpu_number.h +++ b/i386/i386/cpu_number.h @@ -41,12 +41,14 @@ #define CX(addr, reg) addr(,reg,8) #endif +/* Slow version, always works */ #define CPU_NUMBER_NO_STACK(reg) \ movl %cs:lapic, reg ;\ movl %cs:APIC_ID(reg), reg ;\ shrl $24, reg ;\ movl %cs:CX(cpu_id_lut, reg), reg ;\ +/* Fast version, requires a stack */ #ifdef __i386__ /* Never call CPU_NUMBER_NO_GS(%esi) */ #define CPU_NUMBER_NO_GS(reg) \ @@ -86,6 +88,7 @@ popq %rsi #endif +/* Fastest version, requires gs being set up */ #define CPU_NUMBER(reg) \ movl MY(CPU_ID), reg; -- cgit v1.2.3