1 /* test segment register getting */ 2 #include <stdio.h> 3 4 int main() 5 { 6 unsigned short gsw; 7 unsigned long gsl; 8 9 asm ("mov $~0, %0; movl %%gs, %0" : "=r" (gsl)); 10 asm ("mov $~0, %0; movw %%gs, %0" : "=r" (gsw)); 11 12 printf("%s\n", gsl == gsw ? "PASS" : "FAIL"); 13 14 return 0; 15 } 16