mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 15:00:17 +02:00
Merge pull request #5240 from Sonicadvance1/62
unittests/ASM: Removes superfluous warnings from nasm
This commit is contained in:
13 files changed
+48
-63
No files matched your search
@@ -24,7 +24,11 @@ mov ebp, 4
|
||||
mov esi, 5
|
||||
mov edi, 6
|
||||
|
||||
o16 pusha
|
||||
; operand-size override prefix
|
||||
; Nasm complains if o16 is used
|
||||
; `warning: invalid operand size prefix o16, must be o32`
|
||||
db 0x66
|
||||
pusha
|
||||
|
||||
; Invert the order
|
||||
mov ax, [esp + 2 * 0]
|
||||
|
||||
@@ -33,6 +33,10 @@ push word 0x2
|
||||
push word 0x1
|
||||
push word 0x0
|
||||
|
||||
o16 popa
|
||||
; operand-size override prefix
|
||||
; Nasm complains if o16 is used
|
||||
; `warning: invalid operand size prefix o16, must be o32`
|
||||
db 0x66
|
||||
popa
|
||||
|
||||
hlt
|
||||
@@ -1,41 +0,0 @@
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"RegData": {
|
||||
"RAX": "0x4142434445464748",
|
||||
"RBX": "0x5152535455565758",
|
||||
"RCX": "0x5152535455565758"
|
||||
},
|
||||
|
||||
"MemoryRegions": {
|
||||
"0x7FFFF000": "4096"
|
||||
},
|
||||
|
||||
"MemoryData": {
|
||||
"0x7FFFF000": "48 47 46 45 44 43 42 41"
|
||||
}
|
||||
}
|
||||
%endif
|
||||
|
||||
; Tests to ensure that 64-bit displacement encoding works correctly without being RIP relative.
|
||||
; x86-64 has two displacement encodings, one is RIP relative, one is 32-bit (signed) displacement only.
|
||||
; modrm.mod = 0b00 && modrm.rm = 0b101: Means no SIB, but address mode is RIP + disp32.
|
||||
; modrm.mod = 0b00 && modrm.rm = 0b100: Means SIB, but address mode is disp32.
|
||||
; - if SIB.base = 0b101 && SIB.index = 0b100. Which means no registers for base and index.
|
||||
; Test disp32 by mapping a page at the limit of 2GB and read data from it. Also store and load.
|
||||
; If we were accidentally using RIP relative, then it would be 2GB + <low test base address>, which won't be mapped.
|
||||
|
||||
; Test disp32 load.
|
||||
mov rax, [0x7FFF_F000]
|
||||
|
||||
mov rbx, 0x5152535455565758
|
||||
|
||||
; LEA with disp32.
|
||||
lea rcx, [0x7FFF_FFF8]
|
||||
|
||||
; Test store with disp32 store.
|
||||
mov [0x7FFF_FFF8], rbx
|
||||
|
||||
; Load back with the LEA to ensure it's correct.
|
||||
mov rcx, [rcx]
|
||||
|
||||
hlt
|
||||
@@ -19,7 +19,7 @@
|
||||
%rep 2000
|
||||
add qword [rel data], rbx
|
||||
%endrep
|
||||
lea rax, [%%top]
|
||||
lea rax, [rel %%top]
|
||||
jpe %%top
|
||||
%endmacro
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
%rep 37500
|
||||
add qword [rel data], rbx
|
||||
%endrep
|
||||
lea rax, [%%top]
|
||||
lea rax, [rel %%top]
|
||||
jnz %%top
|
||||
%endmacro
|
||||
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
|
||||
; Simple test to prove that config loader's MemoryData is working
|
||||
|
||||
mov rax, [0x10000000]
|
||||
mov rax, [abs 0x10000000]
|
||||
hlt
|
||||
@@ -18,7 +18,11 @@ mov rsp, 0x6666666681828384
|
||||
; Default: 0x48, 0x63, 0xc4
|
||||
movsxd rax, esp
|
||||
; Default with o16 prefix: 0x66, 0x48, 0x63, 0xc4
|
||||
o16 movsxd rbx, esp
|
||||
; operand-size override prefix
|
||||
; Nasm complains if o16 is used
|
||||
; `warning: invalid operand size prefix o16, must be o64`
|
||||
db 0x66
|
||||
movsxd rbx, esp
|
||||
; No-rex widening prefix
|
||||
db 0x63, 0xcc ; movsxd ecx, esp
|
||||
; o16 prefix with no-rex widening
|
||||
|
||||
@@ -32,27 +32,27 @@ mov [r15 + 8 * 9], rax
|
||||
|
||||
; Test 1 byte offset within 4byte boundary
|
||||
mov rax, 1
|
||||
lock xchg word [r15 + 8 * 0 + 1], ax
|
||||
xchg word [r15 + 8 * 0 + 1], ax
|
||||
mov r14, rax
|
||||
|
||||
; Test 3 byte offset across 4byte boundary
|
||||
mov rax, 1
|
||||
lock xchg word [r15 + 8 * 0 + 3], ax
|
||||
xchg word [r15 + 8 * 0 + 3], ax
|
||||
mov r13, rax
|
||||
|
||||
; Test 7 byte offset across 8byte boundary
|
||||
mov rax, 1
|
||||
lock xchg word [r15 + 8 * 0 + 7], ax
|
||||
xchg word [r15 + 8 * 0 + 7], ax
|
||||
mov r12, rax
|
||||
|
||||
; Test 15 byte offset across 16byte boundary
|
||||
mov rax, 1
|
||||
lock xchg word [r15 + 8 * 0 + 15], ax
|
||||
xchg word [r15 + 8 * 0 + 15], ax
|
||||
mov r11, rax
|
||||
|
||||
; Test 63 byte offset across cacheline boundary
|
||||
mov rax, 1
|
||||
lock xchg word [r15 + 8 * 0 + 63], ax
|
||||
xchg word [r15 + 8 * 0 + 63], ax
|
||||
mov r10, rax
|
||||
|
||||
mov rax, qword [r15 + 8 * 0]
|
||||
|
||||
@@ -31,22 +31,22 @@ mov [r15 + 8 * 9], rax
|
||||
|
||||
; Test 3 byte offset across 4byte boundary
|
||||
mov rax, 1
|
||||
lock xchg dword [r15 + 8 * 0 + 3], eax
|
||||
xchg dword [r15 + 8 * 0 + 3], eax
|
||||
mov r13, rax
|
||||
|
||||
; Test 7 byte offset across 8byte boundary
|
||||
mov rax, 1
|
||||
lock xchg dword [r15 + 8 * 0 + 7], eax
|
||||
xchg dword [r15 + 8 * 0 + 7], eax
|
||||
mov r12, rax
|
||||
|
||||
; Test 15 byte offset across 16byte boundary
|
||||
mov rax, 1
|
||||
lock xchg dword [r15 + 8 * 0 + 15], eax
|
||||
xchg dword [r15 + 8 * 0 + 15], eax
|
||||
mov r11, rax
|
||||
|
||||
; Test 63 byte offset across cacheline boundary
|
||||
mov rax, 1
|
||||
lock xchg dword [r15 + 8 * 0 + 63], eax
|
||||
xchg dword [r15 + 8 * 0 + 63], eax
|
||||
mov r10, rax
|
||||
|
||||
mov rax, qword [r15 + 8 * 0]
|
||||
|
||||
@@ -30,17 +30,17 @@ mov [r15 + 8 * 9], rax
|
||||
|
||||
; Test 7 byte offset across 8byte boundary
|
||||
mov rax, 1
|
||||
lock xchg qword [r15 + 8 * 0 + 7], rax
|
||||
xchg qword [r15 + 8 * 0 + 7], rax
|
||||
mov r13, rax
|
||||
|
||||
; Test 15 byte offset across 16byte boundary
|
||||
mov rax, 1
|
||||
lock xchg qword [r15 + 8 * 0 + 15], rax
|
||||
xchg qword [r15 + 8 * 0 + 15], rax
|
||||
mov r12, rax
|
||||
|
||||
; Test 63 byte offset across cacheline boundary
|
||||
mov rax, 1
|
||||
lock xchg qword [r15 + 8 * 0 + 63], rax
|
||||
xchg qword [r15 + 8 * 0 + 63], rax
|
||||
mov r11, rax
|
||||
|
||||
mov rax, qword [r15 + 8 * 0]
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
mov rsp, 0xe0001000
|
||||
mov rbp, 0xe0001000
|
||||
|
||||
o16 enter 0x10, 0
|
||||
; operand-size override prefix
|
||||
; Nasm complains if o16 is used
|
||||
; `warning: invalid operand size prefix o16, must be o64`
|
||||
db 0x66
|
||||
enter 0x10, 0
|
||||
hlt
|
||||
|
||||
@@ -20,7 +20,12 @@ jmp .end
|
||||
|
||||
.target:
|
||||
mov rax, 1
|
||||
o16 leave
|
||||
|
||||
; operand-size override prefix
|
||||
; Nasm complains if o16 is used
|
||||
; `warning: invalid operand size prefix o16, must be o64`
|
||||
db 0x66
|
||||
leave
|
||||
|
||||
.end:
|
||||
hlt
|
||||
@@ -36,11 +36,16 @@ smsw cx
|
||||
smsw [rsi]
|
||||
mov rdx, [rsi]
|
||||
|
||||
o16 smsw rdi
|
||||
; operand-size override prefix
|
||||
; Nasm complains if o16 is used
|
||||
; `warning: invalid operand size prefix o16, must be o64`
|
||||
db 0x66
|
||||
smsw rdi
|
||||
repe smsw rsp
|
||||
repne smsw rbp
|
||||
|
||||
o16 smsw r8w
|
||||
db 0x66
|
||||
smsw r8w
|
||||
repe smsw r9w
|
||||
repne smsw r10w
|
||||
|
||||
|
||||
Reference in new issue
Block a user