-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcpuid.h
25 lines (22 loc) · 869 Bytes
/
cpuid.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef CPUID_H
#define CPUID_H
#include "misc.h"
static inline void do_cpuid(dword_t *eax, dword_t *ebx, dword_t *ecx, dword_t *edx) {
dword_t leaf = *eax;
switch (leaf) {
case 0:
*eax = 0x01; // we support barely anything
*ebx = 0x756e6547; // Genu
*edx = 0x49656e69; // ineI
*ecx = 0x6c65746e; // ntel
break;
default: // if leaf is too high, use highest supported leaf
case 1:
*eax = 0x0; // say nothing about cpu model number
*ebx = 0x0; // processor number 0, flushes 0 bytes on clflush
*ecx = 0b00000000000000000000000000000000; // we support none of the features in ecx
*edx = 0b00000000000000000000000000000000; // we also support none of the features in edx
break;
}
}
#endif