Created
January 15, 2015 09:22
-
-
Save RobinDavid/992ad58d55b1a039f02b to your computer and use it in GitHub Desktop.
Get RFLAGS using inline assembly
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 <iostream> | |
int main(void) | |
{ | |
unsigned long long var_RFLAGS = 0; | |
__asm__ ( | |
"pushfq;" // Put RFLAGS into stack | |
"pop %%rax;" // Pop them in rax | |
"mov %%rax, %0" : :"m" (var_RFLAGS) // Retrieve them in a variable | |
); | |
std::cout << std::hex << "RFLAGS : 0x" << var_RFLAGS << "\n"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment