I'm working on a bare-bones system in which I need to determine sometime after boot how many cores and threads are enabled, so that I can send them SIPI events. I also want each thread to know which thread it is.
For instance, in a single-core configuration with HT enabled, we have (for instance, Intel Atom):
thread 0 --> core 0 thread 0
thread 1 --> core 0 thread 1
While in a dual-core configuration with no HT we have (for instance, Core 2 Duo):
thread 0 --> core 0 thread 0
thread 1 --> core 1 thread 0
What's the best way to determine this?
Edit: I found how each thread can find which thread it is. I still haven't found how to determine how many cores there are.