From 3e2ba6d835c28137e36376b7e9bebade4dad4609 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 2 Dec 2023 13:02:12 -0800 Subject: [PATCH] unittests/ASM: Adds test for TestNZ bug Would trigger the bug before it was fixed. --- unittests/ASM/FEX_bugs/ShiftConstantBug.asm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 unittests/ASM/FEX_bugs/ShiftConstantBug.asm diff --git a/unittests/ASM/FEX_bugs/ShiftConstantBug.asm b/unittests/ASM/FEX_bugs/ShiftConstantBug.asm new file mode 100644 index 000000000..99ad3b314 --- /dev/null +++ b/unittests/ASM/FEX_bugs/ShiftConstantBug.asm @@ -0,0 +1,15 @@ +%ifdef CONFIG +{ + "RegData": { + "RAX": "0x500000020" + } +} +%endif + +; FEX had a bug in its `TestNZ` opcode where it would try to load a constant in to the tst instruction +; If the constant didn't fit in a logical encoding it would generate invalid instructions and also crash. +; This snippet of code was found in libGLX.so.0.0.0 when trying to load steamwebhelper. +mov eax, 0x28000001 +shl rax, 0x5 + +hlt