xref: /openbmc/qemu/tests/tcg/i386/test-i386-vm86.S (revision 503bb0b9)
1        .code16
2        .globl vm86_code_start
3        .globl vm86_code_end
4
5#define GET_OFFSET(x) ((x) - vm86_code_start + 0x100)
6
7vm86_code_start:
8        movw $GET_OFFSET(hello_world), %dx
9        movb $0x09, %ah
10        int $0x21
11
12        /* prepare int 0x90 vector */
13        xorw %ax, %ax
14        movw %ax, %es
15        es movw $GET_OFFSET(int90_test), 0x90 * 4
16        es movw %cs, 0x90 * 4 + 2
17
18        /* launch int 0x90 */
19
20        int $0x90
21
22        /* test IF support */
23        movw $GET_OFFSET(IF_msg), %dx
24        movb $0x09, %ah
25        int $0x21
26
27        pushf
28        popw %dx
29        movb $0xff, %ah
30        int $0x21
31
32        cli
33        pushf
34        popw %dx
35        movb $0xff, %ah
36        int $0x21
37
38        sti
39        pushfl
40        popl %edx
41        movb $0xff, %ah
42        int $0x21
43
44#if 0
45        movw $GET_OFFSET(IF_msg1), %dx
46        movb $0x09, %ah
47        int $0x21
48
49        pushf
50        movw %sp, %bx
51        andw $~0x200, (%bx)
52        popf
53#else
54        cli
55#endif
56
57        pushf
58        popw %dx
59        movb $0xff, %ah
60        int $0x21
61
62        pushfl
63        movw %sp, %bx
64        orw $0x200, (%bx)
65        popfl
66
67        pushfl
68        popl %edx
69        movb $0xff, %ah
70        int $0x21
71
72        movb $0x00, %ah
73        int $0x21
74
75int90_test:
76        pushf
77        pop %dx
78        movb $0xff, %ah
79        int $0x21
80
81        movw %sp, %bx
82        movw 4(%bx), %dx
83        movb $0xff, %ah
84        int $0x21
85
86        movw $GET_OFFSET(int90_msg), %dx
87        movb $0x09, %ah
88        int $0x21
89        iret
90
91int90_msg:
92        .string "INT90 started\n$"
93
94hello_world:
95        .string "Hello VM86 world\n$"
96
97IF_msg:
98        .string "VM86 IF test\n$"
99
100IF_msg1:
101        .string "If you see a diff here, your Linux kernel is buggy, please update to 2.4.20 kernel\n$"
102
103vm86_code_end:
104