Skip to content

Instantly share code, notes, and snippets.

@zyxar
Created March 25, 2013 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zyxar/5235827 to your computer and use it in GitHub Desktop.
Save zyxar/5235827 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <inttypes.h>
static inline void
vidcpu()
{ uint32_t v0=0;
uint32_t v1=0;
asm volatile ("pushf\n"
"popl %0\n"
"movl %0, %1\n"
"xorl $0x00200000, %0\n"
"pushl %0\n"
"popf\n"
"pushf\n"
"popl %0\n"
: "=a" (v0), "=d" (v1)
:
: "cc");
printf("eax=%08x\nebx=%08x\n", v0, v1);
}
int main(int argc, char** argv){
vidcpu();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment