Add 469782 to NEWS
[valgrind.git] / none / tests / x86 / cmpxchg8b.c
blob9ca56afa66ef2a6b70151f4f4903e93b7437b63e
1 #include "tests/asm.h"
2 #include <stdio.h>
4 typedef unsigned long long int ULong;
5 typedef unsigned int UInt;
7 ULong m64;
9 UInt eax;
10 UInt ebx;
11 UInt ecx;
12 UInt edx;
13 UInt zout;
15 extern void foo ( void );
16 asm("\n"
17 ".text\n"
18 VG_SYM(foo) ":\n"
19 "\tpushl %eax\n"
20 "\tpushl %ebx\n"
21 "\tpushl %ecx\n"
22 "\tpushl %edx\n"
24 "\txorl %eax, %eax\n" // get eflags in a known state
26 "\tmovl " VG_SYM(eax) ",%eax\n"
27 "\tmovl " VG_SYM(ebx) ",%ebx\n"
28 "\tmovl " VG_SYM(ecx) ",%ecx\n"
29 "\tmovl " VG_SYM(edx) ",%edx\n"
30 "\tcmpxchg8b " VG_SYM(m64) "\n"
31 "\tmovl %eax," VG_SYM(eax) "\n"
32 "\tmovl %ebx," VG_SYM(ebx) "\n"
33 "\tmovl %ecx," VG_SYM(ecx) "\n"
34 "\tmovl %edx," VG_SYM(edx) "\n"
35 "\tpushfl\n"
36 "\tpopl %eax\n"
37 "\tmovl %eax," VG_SYM(zout) "\n"
39 "\tpopl %edx\n"
40 "\tpopl %ecx\n"
41 "\tpopl %ebx\n"
42 "\tpopl %eax\n"
43 "\tret\n"
44 ".previous\n"
47 int main ( void )
49 edx = 0x11111111; eax = 0x22222222;
50 ecx = 0x33333333; ebx = 0x44444444;
51 zout = 0x55555555;
52 m64 = 0x1111111122222222ULL;
53 foo();
54 printf("0x%x 0x%x 0x%x 0x%x 0x%x 0x%llx\n",
55 eax, ebx, ecx, edx, zout & 0xFFFF, m64 );
57 edx = 0x11111111; eax = 0x22222222;
58 ecx = 0x33333333; ebx = 0x44444444;
59 zout = 0x55555555;
60 m64 = 0x1111111122222222ULL;
61 m64 += 0x1ULL;
62 foo();
63 printf("0x%x 0x%x 0x%x 0x%x 0x%x 0x%llx\n",
64 eax, ebx, ecx, edx, zout & 0xFFFF, m64 );
66 edx = 0x11111111; eax = 0x22222222;
67 ecx = 0x33333333; ebx = 0x44444444;
68 zout = 0x55555555;
69 m64 = 0x1111111122222222ULL;
70 m64 += 0x100000000ULL;
71 foo();
72 printf("0x%x 0x%x 0x%x 0x%x 0x%x 0x%llx\n",
73 eax, ebx, ecx, edx, zout & 0xFFFF, m64 );
75 edx = 0x11111111; eax = 0x22222222;
76 ecx = 0x33333333; ebx = 0x44444444;
77 zout = 0x55555555;
78 m64 = 0x6666666677777777ULL;
79 foo();
80 printf("0x%x 0x%x 0x%x 0x%x 0x%x 0x%llx\n",
81 eax, ebx, ecx, edx, zout & 0xFFFF, m64 );
83 return 0;