x86 - Assembly instructions to find how many threads are enabled in a multi-core system -
I am working on a bare bone system in which I need to determine after some time of boot how many core And threads are enabled, so that I can send them SIPI events. For example, in a one-core configuration with HT enabled, we have (for example, Intel Atom):
thread 0 - & gt; Core 0 thread 0 thread 1 - & gt; Core 0 Thread 1 While we are in the double-core configuration of HTC (for example, Core 2 Duo):
Thread 0 - & Gt; Core 0 thread 0 thread 1 - & gt; Core 1 thread 0 What is the best way to determine this?
Edit: I found out how each thread can find out which thread it is. I still do not know how many corpses are.
I searched it a bit and came up with these facts about cpuid With API EBX [31:24] returns API ID and HT enabled EDX [28] .
This code should work:
; This code will put thread ID into Exx; And Core ID in the EBX mov eX, 01H cpid; Obtain an APIC ID from EBX [31:24] Shab Abex, 24 and Ebucks, 0FHF; Actually not necessary but makes code good; Enable HT slightly from ADX [28] Exam ADX, 010000000 HJS HT_of; HT is on; The bit of EBX is 0 thread; Bits 7: 1 core movie ecx, ebx and ecx, 01h shr ebx, 1 jmp done ht_off:; The thread is always used to make 0xacx, exx:
Comments
Post a Comment