Created
April 22, 2022 07:52
-
-
Save moio/1f50c268c48c8ece0b1f857838f75dca to your computer and use it in GitHub Desktop.
C program to check if the machine supports the RDTSCP instruction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cpuid.h> | |
#include <stdio.h> | |
int main() { | |
unsigned a, b, c, d; | |
if (__get_cpuid(0x80000001, &a, &b, &c, &d) && (d & (1<<27))) | |
{ | |
printf("RDTSCP is supported\n"); | |
} | |
else | |
{ | |
printf("RDTSCP is NOT supported\n"); | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment