FEX/unittests/ASM/Primary/Primary_9D.asm
Ryan Houdek aef0f81a23 Ensures eflags matches real state
0x2 is the default state for hardware boot, but it isn't the state we
boot applications in.

When an application boots under Linux it is actually set to 0x202
because interrupts have been enabled.
Since we can't disable interrupts we will just always have at least
0x202 in the eflags.

This modifies the unit tests to first clear the full eflags state then
loads it so we hit "default". Once we hit the unit test runner we won't
have known the eflags state at that point, so we need to clear it
initially.
2020-09-23 00:09:35 -07:00

44 lines
517 B
NASM

%ifdef CONFIG
{
"RegData": {
"RAX": "0x202",
"RBX": "0x202"
},
"MemoryRegions": {
"0x100000000": "4096"
}
}
%endif
mov rax, 0x0
mov rbx, 0x0
mov rsp, 0xe0000010
; Setup to default state
mov rax, 0
push rax
popfq
; These pushes will end up being the default rflags initialization value
pushfq
cmp rax, 1
popfq
pushfq
mov rax, qword [rsp]
; These pushes will end up being the default rflags initialization value
db 0x66
pushfq
cmp rax, 1
db 0x66
popfq
db 0x66
pushfq
mov bx, word [rsp]
hlt