Implement address size modifier handling in CMPSOp and SCASOp#5062
Implement address size modifier handling in CMPSOp and SCASOp#5062Sonicadvance1 merged 4 commits intoFEX-Emu:mainfrom
Conversation
|
As a note here, we can't support 16-bit addressing modes because Linux reserves the lowest 16-bits of VA space. Requires the use of segments to offset everything, which isn't setup at all. |
62d6f1f to
89ec103
Compare
|
which games out of interest? |
89ec103 to
eb95bd7
Compare
Good question - need to rerun the last batch to tell you. I will get back to you on this. |
7485230 to
6d33794
Compare
|
It looks like you've run afoul of out of all the string operating instructions, stos and scas both will fault if attempting to get used with a null-selector for the ES segment register. This patch to the ASM generation will fix it. diff --git a/unittests/32Bit_ASM/CMakeLists.txt b/unittests/32Bit_ASM/CMakeLists.txt
index 462b319d4..187a5a675 100644
--- a/unittests/32Bit_ASM/CMakeLists.txt
+++ b/unittests/32Bit_ASM/CMakeLists.txt
@@ -30,7 +30,7 @@ foreach(ASM_SRC ${ASM_SOURCES})
add_custom_command(OUTPUT ${TMP_FILE}
DEPENDS "${ASM_SRC}"
COMMAND "cp" ARGS "${ASM_SRC}" "${TMP_FILE}"
- COMMAND "sed" ARGS "-i" "-e" "\'1s;^;BITS 32\\norg 10000h\\nmov eax, 0x17\\nmov ds, ax\\n;\'" "-e" "\'\$\$a\\ret\\n\'" "${TMP_FILE}"
+ COMMAND "sed" ARGS "-i" "-e" "\'1s;^;BITS 32\\norg 10000h\\nmov eax, 0x17\\nmov ds, ax\\nmov es, ax\\n;\'" "-e" "\'\$\$a\\ret\\n\'" "${TMP_FILE}"
)
set(OUTPUT_NAME "${OUTPUT_ASM_FOLDER}/${ASM_NAME}.bin") |
0ab9142 to
c7792c6
Compare
Thanks I was adding that to the tests but clearly there it's better. Still there's still a failure I need to investigate: |
oh, i see, the cmakelists patch screwed got_calculation. will fix that now. |
c7792c6 to
cee9132
Compare
A few games were generating "Can't handle adddress size". I implemented 0x67 prefix handling for CMPSOp and SCASOP and improved the error messages for the remainder. This will implement the address modifier on 64bit systems, and keep issuing an error on 32bits.
cee9132 to
de10154
Compare
I have seen this in more but Overcooked 2 has several:
errors. |
|
That's just the JIT exploring garbage code, it isn't actually used. |
Sonicadvance1
left a comment
There was a problem hiding this comment.
Very cool. Even though the message only occurred with code exploration, nice that all of this is implemented so if we /do/ hit a game that uses it, it'll work fine.
A few games were generating "Can't handle adddress size".
I implemented 0x67 prefix handling for CMPSOp and SCASOP and improved the error messages for the remainder.
This modified the address to be 32bits on 64bits and to 16bits on 32bits.