#include #include #include int main() { unsigned short ax, cx, dx; printf("PID = %d\n", (int)getpid()); asm volatile ("mov %[one], %%gs\n\t" "1:\n\t" "mov %%gs, %%eax\n\t" "mov %%gs, %%ecx\n\t" "mov %%gs, %%edx\n\t" "cmpw $1, %%ax\n\tjne 2f\n\t" "cmpw $1, %%cx\n\tjne 2f\n\t" "cmpw $1, %%dx\n\tjne 2f\n\t" "jmp 1b\n\t" "2:" : "=a" (ax), "=c" (cx), "=d" (dx) : [one] "rm" ((unsigned short)1)); printf("ax = %hx, cx = %hx, dx = %hx\n", ax, cx, dx); return 0; }