unittests: Adds unit tests for storing segment register sizes

This commit is contained in:
Ryan Houdek committed 2021-08-21 17:43:39 -07:00
1 parent 6e5fc5cdde
commit 23fb4baf46
2 files changed
+64

No files matched your search

@@ -0,0 +1,37 @@
%ifdef CONFIG
{
"RegData": {
"RAX": "0xFFFF0033",
"RBX": "0xFFFF0033",
"RCX": "0xFFFF0033"
},
"Mode": "32BIT"
}
%endif
mov eax, 0x33
mov gs, ax
mov fs, ax
mov es, ax
mov eax, 0xFFFFFFFF
mov ebp, 0xe0000000
; Store 32bits of data
mov dword [ebp + 0], eax
mov dword [ebp + 4], eax
mov dword [ebp + 8], eax
; Ensure that the segment store only writes 16-bits
mov word [ebp + 0], gs
mov word [ebp + 4], fs
mov word [ebp + 8], es
mov eax, 0
mov ebx, 0
mov ecx, 0
mov eax, dword [ebp + 0]
mov ebx, dword [ebp + 4]
mov ecx, dword [ebp + 8]
hlt
@@ -0,0 +1,27 @@
%ifdef CONFIG
{
"RegData": {
"RAX": "0xFFFF0033",
"RBX": "0x33",
"RCX": "0x33"
},
"Mode": "32BIT"
}
%endif
mov eax, 0x33
mov gs, ax
mov fs, ax
mov es, ax
mov eax, 0xFFFFFFFF
mov ebx, 0xFFFFFFFF
mov ecx, 0xFFFFFFFF
; 16-bit insert
mov ax, gs
; 32-bit zext
mov ebx, fs
mov ecx, es
hlt