The following code will fail under valgrind like this: vex x86->IR: unhandled instruction bytes: 0xF 0x1 0x45 0xDE #include <iostream> #include <pthread.h> // Compile and run: // g++ -m64 sgdtq.cc -lpthread && valgrind ./a.out void *sgdtq(void *) { char ret_val[16] __attribute__((__aligned__(16))); // valgrind will fail here: __asm__ __volatile__("sgdtq %0" : "=m" (ret_val[6])::"memory"); uint64_t id = *reinterpret_cast<uint64_t *>(&ret_val[8]); std::cout << id << std::endl; } int main() { const int N = 100; pthread_t t[N]; sgdtq(NULL); // start many threads. On a multi-cpu machine // this progam should print several different numbers. for (int i = 0; i < N; i++) { pthread_create(&t[i], 0, sgdtq, 0); } for (int i = 0; i < N; i++) { pthread_join(t[i], 0); } }
I'm a bit confused - the error you quote is "vex x86->IR" which suggests you are running 32 bit code but the test program says to compile as 64 bit, and indeed it won't compile as 32 bit because gcc says that the "sgdt" instruction is not recognised.
Well it compiles and runs OK as 64 bit anyway, and as 32 bit after the q suffix is dropped from that instruction. Looks like VEX r1982 fixed it.