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