Commit Graph
41 Commits
Author SHA1 Message Date
Alyssa Rosenzweig 80ac824dd9 Unittests: Fix bogus lahf tests
Logical ops leave AF undefined so we can't expect it to be zero after. Mask the
result of lahf to avoid testing UB. These unit tests would regress from the work
in this MR otherwise.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
2023-09-05 14:21:18 -04:00
Ryan Houdek 2e93d10eba OpcodeDispatcher: Fixes ROR imm OF calculation
Turns out this was calculating OF incorrectly, breaking Denuvo early in
its execution.

Changes the ROL imm OF calculation code as well to be more consistent
and not keep src1 alive longer than it needs to be.

Also adds two new unit tests to ensure this stays correct.
2022-10-31 10:28:47 -07:00
Ryan Houdek 2a50416fc3 unittests: Ensures overloaded shifts don't result in JIT failure 2022-10-14 23:38:35 -07:00
Ryan Houdek ce514d9f83 unittests: Adds ROL and ROR CF flag calculation tests
This would have failed prior to the last commit
2022-10-14 23:37:46 -07:00
Ryan Houdek ce4380e136 unittests: Adds basic PAUSE test 2022-05-26 08:51:00 -07:00
Ryan Houdek 6b7a84bef2 OpcodeDispatcher: Fixes weirdo edge case in segment moving
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.
2022-02-07 21:12:53 -08:00
Ryan Houdek 28b3bc3508 unittests: Hotfix for older nasm
Newer nasm takes the size specifier for LEA, older ones do not
2021-08-22 21:59:57 -07:00
Ryan Houdek 8931ddc382 unittests: Duplicates rep string unit tests with repne
These are exactly the same except using the other prefix.
Hardware tests confirm that this behave the same
2021-08-21 20:19:38 -07:00
Ryan Houdek 09296fe73e unittests: Adds IRET unit tests 2021-08-20 23:52:42 -07:00
Ryan Houdek 9a0fc4e7e8 Workaround quick with memory allocator. Aligned 4GB regions are hard to allocate 2021-05-01 07:39:14 -07:00
Ryan Houdek 2706c9aaae Adds unittests for locked ADC and SBB 2021-03-11 00:24:03 -08:00
Ryan Houdek f848957e17 Implements unit tests for the new unaligned atomics
Tests all the unaligned atomic ops we support now
2021-02-22 18:25:25 -08:00
Stefanos Kornilios Mitsis Poiitidis 5fdbb8a9b2 OpDisp: Improve block ordering for multi-block ops 2021-01-15 21:05:29 +02:00
Stefanos Kornilios Mitsis Poiitidis 2fbf22a9de Hotfix: Disable ConstProp/RemoveUselessMasking, add a test for it 2020-12-25 15:04:27 +02:00
Ryan Houdek 2a81468663 Adds a new test for push 8bit immediate
On 64bit this will operate as a 64bit or a 16bit push, with the
immediate being sign extended.

We were only previously testing the 64bit variant
2020-10-22 19:10:28 -07:00
Ryan Houdek 811e956df5 Fixes move memoffset tests to have address size override prefix
Required for the 32bit literal offset
2020-09-23 10:43:20 -07:00
Ryan Houdek d8e5495780 Fixes CMPSB unit tests
These were confirmed by host runner
2020-09-23 10:03:33 -07:00
Ryan Houdek aef0f81a23 Ensures eflags matches real state
0x2 is the default state for hardware boot, but it isn't the state we
boot applications in.

When an application boots under Linux it is actually set to 0x202
because interrupts have been enabled.
Since we can't disable interrupts we will just always have at least
0x202 in the eflags.

This modifies the unit tests to first clear the full eflags state then
loads it so we hit "default". Once we hit the unit test runner we won't
have known the eflags state at that point, so we need to clear it
initially.
2020-09-23 00:09:35 -07:00
Ryan Houdek 0c7c7ba670 Removes undefined behaviour in our unit tests
Most of these were relying on the upper 16bits of the 80bit MM registers
to be zero.
This isn't necessarily true as one will find out when running this under
the host runner.
2020-09-22 18:32:19 -07:00
Ryan Houdek 1d68d9ac1f Adds new LEA unit test for address size override
This adds a mixture of address size override and operand size override
usage for testing
2020-09-16 19:17:35 -07:00
Stefanos Kornilios Mitsis Poiitidis 0736b13800 Tests: Add xchg 32 and 64 bit 2020-08-20 10:32:38 +03:00
Ryan Houdek 3ff179c39c Adds unit test for mov to and from segment register 2020-06-12 18:50:24 -07:00
Ryan Houdek 1c56b489b9 Implements unit test for enter instruction 2020-06-06 11:52:51 -07:00
Stefanos Kornilios Mitsis Poiitidis f1173a3bca Merge pull request #218 from Sonicadvance1/implements_lods
Implements LODS instruction
2020-05-31 12:02:11 +03:00
Ryan Houdek 4db38f389a Implements SCAS unit tests 2020-05-29 23:38:27 -07:00
Ryan Houdek 6cf5c00fe9 Implements LODS unit tests 2020-05-29 23:37:27 -07:00
Ryan Houdek f8eabf8648 Implements a unit test for XLAT 2020-04-29 18:26:03 -07:00
Ryan Houdek 1223df2e84 Implements unit tests for the three new loop instructions 2020-04-29 17:20:09 -07:00
Ryan Houdek 772e47bf22 Merge pull request #165 from Sonicadvance1/pushf_unittest
Pushf and Popf unit tests
2020-04-29 12:31:11 -07:00
Ryan Houdek 2005a2ea3d Merge pull request #164 from Sonicadvance1/fwait
Implements fwait as a nop
2020-04-29 12:30:45 -07:00
Ryan Houdek 589b6e6368 Implements a popf unit test 2020-04-26 00:14:51 -07:00
Ryan Houdek bdf0008c61 Implements a pushf unit test
Missed this during the implementation.
Checks to make sure we get the default initialization value for rflags
2020-04-26 00:14:43 -07:00
Ryan Houdek 0665599e30 Implements an fwait unit test
Just ensures execution works since we don't have exception support
2020-04-25 23:54:09 -07:00
Ryan Houdek 2dce16190d Implements JRCXZ unit test 2020-04-25 22:07:24 -07:00
Ryan Houdek 6412b5fcbf Adds more unit tests for Sign extension 2020-04-04 23:11:48 -07:00
Ryan Houdek d9bde8cfcf Implements unit tests for CMPS
Isn't all encompassing, we're still missing REPNE tests for the larger sizes
2020-03-10 18:18:36 -07:00
Stefanos Kornilios Mitsis Poiitidis 963de98276 Merge pull request #7 from Sonicadvance1/unittests/primary_1
Primary table unit tests and a couple fixes
2020-03-10 15:26:05 +02:00
Stefanos Kornilios Mitsis Poiitidis e2e9e1eb41 Merge pull request #9 from Sonicadvance1/unittests/stos
Adds unit tests for the STOS instruction family
2020-03-10 15:25:49 +02:00
Ryan Houdek c51341294b Adds STOS unit tests
Tests all sizes that STOS supports, with the DF going up AND down.
2020-03-09 22:59:59 -07:00
Ryan Houdek 51458f75fb Adds MOVS unit tests
Tests all the sizes that MOVS supports, with the DF going up AND down.
2020-03-09 22:33:20 -07:00
Ryan Houdek ee410cf1be Implements Primary table unit tests
Not full coverage, skips the string ops and doesn't confirm that flag
setting is correct. Those are forthcoming
2020-03-09 18:15:43 -07:00