Damien Zammit, le mer. 07 janv. 2026 03:08:21 +0000, a ecrit:
> +#ifdef __x86_64__
> +/* Clobbers %r8, need to input 32/64 bit regs */

Better make r8 a parameter of the macro (actually, three, to have
64/32/8), so we get both callers able to choose it, and avoid callers
missing that it is clobbering a register.

I wouldn't write "input", because this is not a data input of the code.
Better write e.g. "specify both 32 and 64 variants of the chosen
register".

> +#define      CPU_NUMBER_NO_STACK(reg32, reg64)\
> +     movq    %cs:lapic, %r8          ;\
> +     movl    %cs:APIC_ID(%r8), %r8d  ;\
> +     shrl    $24, %r8d               ;\
> +     andb    %cs:apic_id_mask, %r8b  ;\
> +     leaq    cpu_id_lut(%rip), reg64 ;\
> +     movl    %cs:(reg64, %r8, 8), reg32
> +#endif
>  
>  /* Fast version, requires a stack */
>  #ifdef __i386__

Samuel

Reply via email to