mirror of
https://github.com/FEX-Emu/FEX.git
synced 2025-01-25 07:57:03 +00:00
6b7a84bef2
Just noticed this while casually reading the x86 architecture manuals. The move segment registers instructions ignore the REX.R prefix on the segment register. Previously this was expected to create an invalid register selection. A little bit silly but sure, support it.
46 lines
639 B
NASM
46 lines
639 B
NASM
%ifdef CONFIG
|
|
{
|
|
"RegData": {
|
|
"RAX": "0x4142",
|
|
"RBX": "0x4143",
|
|
"RCX": "0x4144"
|
|
}
|
|
}
|
|
%endif
|
|
; This relies on some behaviour that isn't guaranteed in 64bit mode
|
|
|
|
; Technically this can result in an invalid selector which can cause faults
|
|
; We currently don't do any selector validation to enforce this
|
|
mov rax, 0x4142
|
|
|
|
db 0x44 ; REX.R
|
|
mov es, ax
|
|
|
|
inc rax
|
|
|
|
db 0x44 ; REX.R
|
|
mov ss, ax
|
|
|
|
inc rax
|
|
|
|
db 0x44 ; REX.R
|
|
mov ds, ax
|
|
|
|
; Can't test FS/GS here
|
|
; Behaviour is ill-defined and needs to be worked through
|
|
|
|
mov rax, 0
|
|
mov rbx, 0
|
|
mov rcx, 0
|
|
|
|
db 0x44 ; REX.R
|
|
mov ax, es
|
|
|
|
db 0x44 ; REX.R
|
|
mov bx, ss
|
|
|
|
db 0x44 ; REX.R
|
|
mov cx, ds
|
|
|
|
hlt
|