24#define CPU_FEATURE_VMX 0x01
25#define CPU_FEATURE_HV 0x02
35#define FL_ANY (FL_AMD | FL_INTEL | FL_CYRIX | FL_VIA | FL_TM)
60 CHAR VendorString[13];
64 Vendor.ShuffledInts[0] = CpuInfo[1];
65 Vendor.ShuffledInts[1] = CpuInfo[3];
66 Vendor.ShuffledInts[2] = CpuInfo[2];
67 Vendor.VendorString[12] = 0;
68 trace(
"Vendor: %s\n", Vendor.VendorString);
70 if (
strcmp(Vendor.VendorString,
"GenuineIntel") == 0)
74 else if (
strcmp(Vendor.VendorString,
"AuthenticAMD") == 0)
78 else if (
strcmp(Vendor.VendorString,
"CyrixInstead") == 0)
82 else if (
strcmp(Vendor.VendorString,
"CentaurHauls") == 0)
86 else if (
strcmp(Vendor.VendorString,
"GenuineTMx86") == 0)
108 trace(
"CPUID 1: 0x%x, 0x%x, 0x%x, 0x%x\n", CpuInfo[0], CpuInfo[1], CpuInfo[2], CpuInfo[3]);
116 { __LINE__, { 0x0F, 0x0B, 0xC3 }, 0,
FL_INVALID },
117 { __LINE__, { 0x0F, 0x38, 0x0C, 0xC3 }, 0,
FL_INVALID },
142 { __LINE__, { 0x0F, 0x00, 0x10, 0xC3 }, 0,
FL_ANY |
FL_PRIV },
143 { __LINE__, { 0x0F, 0x00, 0x50, 0x00, 0xC3 }, 0,
FL_ANY |
FL_PRIV },
144 { __LINE__, { 0x0F, 0x00, 0x18, 0xC3 }, 0,
FL_ANY |
FL_PRIV },
145 { __LINE__, { 0x0F, 0x00, 0x58, 0x00, 0xC3 }, 0,
FL_ANY |
FL_PRIV },
146 { __LINE__, { 0x0F, 0x01, 0xC1, 0xC3 }, 0,
FL_INTEL |
FL_HV },
150 { __LINE__, { 0x0F, 0x01, 0xC8, 0xC3 }, 0,
FL_INVALID },
151 { __LINE__, { 0x0F, 0x01, 0xC9, 0xC3 }, 0,
FL_INVALID },
154 { __LINE__, { 0x0F, 0x01, 0xF8, 0xC3 }, 0,
FL_ANY |
FL_PRIV },
156 { __LINE__, { 0x0F, 0x01, 0x10, 0xC3 }, 0,
FL_ANY |
FL_PRIV },
157 { __LINE__, { 0x0F, 0x01, 0x18, 0xC3 }, 0,
FL_ANY |
FL_PRIV },
158 { __LINE__, { 0x0F, 0x01, 0x30, 0xC3 }, 0,
FL_ANY |
FL_PRIV },
160 { __LINE__, { 0x0F, 0x01, 0x38, 0xC3 }, 0,
FL_ANY |
FL_PRIV },
166 { __LINE__, { 0xF3, 0x0F, 0xC7, 0x31, 0xC3 }, 0,
FL_INVALID },
167 { __LINE__, { 0x0F, 0xC7, 0xE0, 0xC3 }, 0,
FL_INVALID },
185 { __LINE__, { 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0xC3 }, 0,
FL_ANY },
187 { __LINE__, { 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0xC3 }, 0,
FL_ANY |
FL_ACC },
189 { __LINE__, { 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0xC3 }, 0,
FL_INVALID },
191 { __LINE__, { 0xF0, 0x90, 0xC3 }, 0,
FL_INVLS },
192 { __LINE__, { 0xF0, 0x83, 0x0C, 0x24, 0x00, 0xC3 }, 0,
FL_ANY },
193 { __LINE__, { 0x3E, 0x66, 0x67, 0xF0, 0xF3, 0xF4, 0xC3 }, 0,
FL_ANY |
FL_INVLS |
FL_PRIV },
196 { __LINE__, { 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xC3 }, 0,
FL_ANY |
FL_ACC },
304 ok(RwxMemory !=
NULL,
"Failed to allocate RWX memory!\n");
305 if (RwxMemory ==
NULL)
#define ok_hex_(expression, result)
static void TestEntry(const ENTRY *pEntry)
static void DetermineCpuFeatures(void)
struct _TEST_ENTRY TEST_ENTRY
enum _CPU_VENDOR CPU_VENDOR
static void Test_InstructionFaults(void)
static CPU_VENDOR DetermineCpuVendor(void)
struct _TEST_ENTRY * PTEST_ENTRY
void Test_SingleInstruction(PVOID RwxMemory, PTEST_ENTRY TestEntry)
int strcmp(const char *String1, const char *String2)
#define STATUS_ILLEGAL_INSTRUCTION
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define EXCEPTION_EXECUTE_HANDLER
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
#define PAGE_EXECUTE_READWRITE
#define STATUS_PRIVILEGED_INSTRUCTION
#define STATUS_ACCESS_VIOLATION
#define STATUS_INVALID_LOCK_SEQUENCE
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
#define _SEH2_GetExceptionInformation()
#define ok_size_t_(file, line, expression, result)
#define ok_ptr_(file, line, expression, result)
#define ok_dec_(file, line, expression, result)
PEXCEPTION_RECORD ExceptionRecord
struct _EXCEPTION_RECORD * ExceptionRecord
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
UCHAR InstructionBytes[64]
ULONG ExpectedAddressOffset
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
_Must_inspect_result_ _In_ ULONG Flags