aboutsummaryrefslogtreecommitdiff
path: root/test/transform-dis-cases-i386.S
blob: c02a044e1e2151046096f4b4b6369f873e820982 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#define GIVEN .ascii "GIVEN";
#define EXPECT .ascii "EXPECT";
#define EXPECT_ERR .ascii "EXPECT_ERR";

GIVEN call 0f; 0: pop %edx
/* XXX the extra push isn't necessary in 32-bit mode */
EXPECT push %eax; push %eax; mov $0xdead0005, %eax; mov %eax, 4(%esp); pop %eax; pop %edx

GIVEN jmp 0f; 0: nop
EXPECT_ERR

GIVEN jne .+0x1000
/* we expect to generate an unnecessarily long jump, so hardcode it the 0x10000
 * is because we pretend our trampoline is 0x10000 bytes before the original
 * function */
EXPECT 2: .byte 0x0f, 0x85; .long 2; jmp 1f; 0: jmp .+0x10000+0x1000-8; 1:

GIVEN loopne .+0x80
EXPECT loopne 0f; jmp 1f; 0: jmp .+0x10000+0x80-4; 1:

GIVEN call .+0x1000; nop
EXPECT_ERR

GIVEN call *%edi
EXPECT call *%edi

GIVEN call *%edi; nop
EXPECT_ERR

GIVEN call *(%edi); nop
EXPECT_ERR