stos/amd64: cpu: Obtain more processor info

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
Chloe M.
2026-06-23 07:03:35 +00:00
parent 81ebb948ed
commit 333331171d
+60
View File
@@ -14,12 +14,67 @@
#define DTRACE(Fmt, ...) \
TRACE("[ CPU ]: " Fmt, ##__VA_ARGS__)
/* Processor types */
#define PROCESSOR_OEM 0
#define PROCESSOR_OVERDRIVE 1
#define PROCESSOR_DUAL 2
#define PROCESSOR_TYPE(TYPE) \
((TYPE) >= NELEM(ProcessorType)) \
? "unknown" \
: ProcessorType[(Type)]
/* Processor type lookup table */
static const CHAR *ProcessorType[] = {
[PROCESSOR_OEM] = "OEM processor",
[PROCESSOR_OVERDRIVE] = "Intel overdrive processor",
[PROCESSOR_DUAL] = "Intel P5 dual processor"
};
/*
* Called by ProcessorIdentify()
*/
static VOID
ProcessorIdentify1(MCB *Mcb)
{
UCHAR ManufactId[13];
ULONG Ebx, Edx, Ecx, Unused;
if (Mcb == NULL) {
return;
}
/* Grab the manufacturer ID */
ManufactId[12] = '\0';
CPUID(0, Unused, Ebx, Ecx, Edx);
/* DWORD 0 */
ManufactId[0] = Ebx & 0xFF;
ManufactId[1] = (Ebx >> 8) & 0xFF;
ManufactId[2] = (Ebx >> 16) & 0xFF;
ManufactId[3] = (Ebx >> 24) & 0xFF;
/* DWORD 1 */
ManufactId[4] = Edx & 0xFF;
ManufactId[5] = (Edx >> 8) & 0xFF;
ManufactId[6] = (Edx >> 16) & 0xFF;
ManufactId[7] = (Edx >> 24) & 0xFF;
/* DWORD 2 */
ManufactId[8] = Ecx & 0xFF;
ManufactId[9] = (Ecx >> 8) & 0xFF;
ManufactId[10] = (Ecx >> 16) & 0xFF;
ManufactId[11] = (Ecx >> 24) & 0xFF;
DTRACE("vendor : %s\n", ManufactId);
}
static VOID
ProcessorIdentify(MCB *Mcb)
{
ULONG Eax, Unused;
UCHAR ModelLow, ModelHigh;
UCHAR FamilyLow, FamilyHigh;
UCHAR Type;
if (Mcb == NULL) {
return;
@@ -37,9 +92,14 @@ ProcessorIdentify(MCB *Mcb)
FamilyHigh = (Eax >> 20) & 0xFF;
Mcb->FamilyId = (FamilyHigh << 4) | FamilyLow;
/* Extract the processor type */
Type = (Eax >> 12) & 3;
/* Informational logging */
DTRACE("model : %X\n", Mcb->ModelId);
DTRACE("family : %X\n", Mcb->FamilyId);
DTRACE("type : %s\n", PROCESSOR_TYPE(Type));
ProcessorIdentify1(Mcb);
}
VOID