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
32
|
CPU not support 32-bit stack in 32-bit unreal mode
QEMU version 5.0.0 supports 32-bit and 16-bit unreal mode. Great!
Unfortunately, QEMU does not support 32-bit stack in unreal 32-bit mode.
After the INT instruction, the stack is switched to 16-bit, which should not be the case.
At BOCHS, my code works 100%. At QEMU not works.
Sample code to find out:
use32
cli
mov ax,cs
shl eax,16
mov ax,NewInt80h
mov [IDT32+4*80h],eax
mov edx,esp
mov esp,0x10000
int 80h
NewInt80h:
xchg esp,edx
cmp edx,0x10000-6
jnz IsStack16Bit
Stack selector loaded from GDT:
GDT:
real32_GDT
dq 0
dw 0xFFFF,0x0000,9A00h,0xCF ; 32-bit code descriptor
dw 0xFFFF,0x0000,9200h,0x8F ; 4 GB data descriptor
dw 0xFFFF,0x0000,9A00h,0x00 ; 16-bit code descriptor
dw 0xFFFF,0x0000,9200h,0xCF ; 32-bit data descriptor stack
|