Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- static unsigned long long _xgetbv(unsigned int index){
- unsigned int eax, edx;
- /* original code
- __asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
- */
- /* Nokia code */
- __asm__ __volatile__(".byte 0x0f, 0x01, 0xd0"
- : "=a"(eax), "=d"(edx) : "c"(index));
- /* modified code, segfaults
- __asm__ __volatile__ (".byte 0x0f\n");
- __asm__ __volatile__ (".byte 0x01\n");
- __asm__ __volatile__ (".byte 0xd0\n" // xgetbv instruction
- : "=a"(eax), "=d"(edx) : "c"(index));
- */
- return ((unsigned long long)edx << 32) | eax;
- }
- int main() {
- printf("666 is %i\n", _xgetbv(666));
- }
Advertisement
Add Comment
Please, Sign In to add comment