Add 469782 to NEWS
[valgrind.git] / none / tests / x86 / pushpopseg.c
blob352776a542555a6ce56f9c11e1cc48d94be1c488
1 #include <stdio.h>
2 #include <stdlib.h>
4 int main(int argc, char **argv)
6 unsigned long sp1;
7 unsigned long sp2;
8 unsigned long sp3;
9 unsigned short fs1;
10 unsigned short fs2;
12 fs1 = 0x0003;
14 asm("movw %4, %%fs\n"
15 "movl %%esp, %0\n"
16 "pushw %%fs\n"
17 "movl %%esp, %1\n"
18 "popw %%fs\n"
19 "movl %%esp, %2\n"
20 "movw %%fs, %3\n"
21 : "=r" (sp1), "=r" (sp2), "=r" (sp3), "=r" (fs2)
22 : "r" (fs1)
23 : "ax"
26 printf("sp change after push = %ld\n", sp2 - sp1);
27 printf("sp change after pop = %ld\n", sp3 - sp2);
28 printf("fs after push and pop = %04x\n", fs1);
30 asm("movw %4, %%fs\n"
31 "movl %%esp, %0\n"
32 "pushl %%fs\n"
33 "movl %%esp, %1\n"
34 "popl %%fs\n"
35 "movl %%esp, %2\n"
36 "movw %%fs, %3\n"
37 : "=r" (sp1), "=r" (sp2), "=r" (sp3), "=r" (fs2)
38 : "r" (fs1)
39 : "ax"
42 printf("sp change after push = %ld\n", sp2 - sp1);
43 printf("sp change after pop = %ld\n", sp3 - sp2);
44 printf("fs after push and pop = %04x\n", fs1);
46 exit(0);