Add misclassified C sample (#3652)

This sample is misclassified as Objective-C.
This commit is contained in:
Theodore Dubois
2017-06-30 09:11:50 -07:00
committed by Colin Seymour
parent c552e25bd7
commit 648720301d

25
samples/C/cpuid.h Normal file
View File

@@ -0,0 +1,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