News for hackers. Stuff that matters.
Re:Booting Modern Intel CPUs by vardump on Monday April 17, 2023 @06:30AM (#35598910)
> A few lines of memory-less stack-less assembly could get the CPU number and then change the stack...

Except for that TSC_AUX (CPU id number) is going to be 0 for all of the cores. Unless you know some other way to get CPU number?

Re:Booting Modern Intel CPUs by dfox on Monday April 17, 2023 @09:02AM (#35600003)
Core ID in TSC_AUX is essentially an concession to userspace. As an OS and firmware you are supposed to identify CPU cores by means of their LAPIC ID (as read from APIC configurations MSR or from CPUID). Small issue there is that APIC IDs are structured according to HT/NUMA topology and thus not necessarily consecutive.

On the other hand, as an OS on PC-like platform you know how many cores there are supposed to be and what are their APIC IDs before-hand because they were already enumerated by firmware (which is the reason why you can do the one by one AP startup sequence in the first place).

Re:Booting Modern Intel CPUs by JoshTriplett on Monday April 17, 2023 @09:07AM (#35600065)
Exactly: either read the APIC ID and use that to look up the CPU number in a table you already have, or arrange a location in memory to use xadd to assign a sequential CPU number, whichever your OS prefers.