Commit graph

198 commits

Author SHA1 Message Date
MerryMage 7360a2579b mp: Implement metaprogramming library 2020-04-22 20:46:19 +01:00
MerryMage 4ab029c114 fp: Implement FPUnpack 2020-04-22 20:46:19 +01:00
MerryMage 9c4f234417 fuzz_with_unicorn: Avoid self-modifying code
* Don't immediately terminate when unicorn raises an interrupt
* Detect self-modifying code
2020-04-22 20:46:19 +01:00
MerryMage 9f8c6f60f5 fuzz_with_unicorn: Configure as per qemu max configuration 2020-04-22 20:46:19 +01:00
Lioncash 64d4e40081 tests/A32/testenv: Add type aliases for register arrays
Allows avoiding duplicating std::array instance sizes and types.
2020-04-22 20:46:19 +01:00
Lioncash a25bacc436 tests/unicorn: Add type aliases to the Unicorn class
Centralizes all register and vector array definitions to a single set of
aliases, so if these are ever changed, then the rest of the testing code
will follow suit without the need to manually change them.
2020-04-22 20:46:19 +01:00
MerryMage 8c65d58cb8 tests/A64: Randomize FPCR.RMode for single random instruction 2020-04-22 20:46:18 +01:00
Lioncash 7d52d7bef8 inst_gen: Compress loop into std::any_of in IsInvalidInstruction()
Same behavior, but using a more self-documenting function.
2020-04-22 20:46:18 +01:00
Lioncash d909b0919e fuzz_with_unicorn: Move std::vector outside loop in small random block test case
Avoids constructing and destructing the vector repeatedly, we can just
alter the contents of the vector on each iteration instead. Also move
out the std::array instances as well, like with the floating-point test
case and the single random instruction test case.

We can also use the regular form of std::generate and avoid hardcoding
size values twice.
2020-04-22 20:46:18 +01:00
MerryMage ef57d75b32 fuzz_with_unicorn: Temporarily disable FDIV 2020-04-22 20:46:18 +01:00
MerryMage ec0a91d6ee tests/A64: Test small blocks 2020-04-22 20:46:18 +01:00
MerryMage 330e6111fa fuzz_with_unicorn: Randomize FPCR.RMode 2020-04-22 20:46:18 +01:00
MerryMage eb3ca7f65b tests: Add print_info program
Eases debugging by printing out dynarmic IR for a given A64 instruction, along with
information about what instruction dynarmic thinks it is.

Also prints an LLVM disassembly of the instruction.
2020-04-22 20:46:18 +01:00
MerryMage 8c90fcf58e IR: Implement FPMulAdd 2020-04-22 20:46:18 +01:00
Lioncash e64978ed89 fuzz_with_unicorn: Make float_numbers in floating-point tests constexpr
Given this is just a lookup table, this can be made immutable.
2020-04-22 20:46:18 +01:00
Lioncash 329137a277 fuzz_with_unicorn: Remove exclusion of FMOV (imm) for FP-16 floats
Qemu, or rather, Unicorn now supports FP-16, since I backported support
for the recent changes to mainline Qemu relating to FP-16 support.
2020-04-22 20:46:18 +01:00
Lioncash 0c63e8f396 fuzz_with_unicorn: Silence unused variable warning
Currently, structured bindings don't provide a way to ignore unused variables.
2020-04-22 20:46:17 +01:00
Lioncash cd0b71159a CMake: Make FindUnicorn introduce a unicorn target
Makes the find module do all the work of properly setting up the target instead of needing to do it in the main CMakeLists file.
2020-04-22 20:46:16 +01:00
Lioncash ab58bbddc8 unicorn: Be explicit about casting away const to const-incorrect APIs
Uses C++ casts which silence relevant warnings in Xcode 9.3

Also migrates relevant Read function equivalents over for consistency.
2020-04-22 20:46:16 +01:00
MerryMage c490a45af6 fuzz_with_unicorn: Correct GenRandomInst
UnallocatedEncoding is now handled in ShouldTestInst
2020-04-22 20:46:15 +01:00
MerryMage be57608353 A64: Partially implement FCVTZU (scalar, fixed-point) and FCVTZS (scalar, fixed-point) 2020-04-22 20:46:15 +01:00
MerryMage 9e4e4e9c1d A64: Implement system register CNTPCT_EL0 2020-04-22 20:46:15 +01:00
MerryMage 44a5b57f2a fuzz_with_unicorn: QEMU's implementation of FCVT is incorrect 2020-04-22 20:46:14 +01:00
MerryMage 1311f67b4a fuzz_with_unicorn: Explicitly test floating point instructions 2020-04-22 20:46:14 +01:00
MerryMage e97581d063 fuzz_with_unicorn: Print AArch64 disassembly 2020-04-22 20:46:14 +01:00
MerryMage 1f5b3bca43 Exclusive fixups
* Incorrect size of exclusive_address
* Disable tests on exclusive memory instructions for now
2020-04-22 20:46:14 +01:00
MerryMage f6a2104ab3 fuzz_with_unicorn: Speed up tests by not initializing/tearing down constantly 2020-04-22 20:46:14 +01:00
MerryMage ef02658049 fuzz_with_unicorn: Fix read-past-end access via jit_iter 2020-04-22 20:46:14 +01:00
MerryMage 5edd623b9d Implement DC instructions 2020-04-22 20:46:14 +01:00
MerryMage f378d2ef1b Forward declare IR::Opcode and IR::Type where possible 2020-04-22 20:46:14 +01:00
MerryMage a78e13ff19 fuzz_arm: Use SCOPE_FAIL 2020-04-22 20:46:13 +01:00
MerryMage cc9efd13c9 A64: Implement STLLRB, STLLRH, STLLR, LDLARB, LDLARH, LDLAR 2020-04-22 20:46:13 +01:00
Lioncash 12c6f841c2 inst_gen: Make invalid_instructions a static inline variable 2020-04-22 20:46:13 +01:00
Lioncash f96e83c486 fuzz_with_unicorn: Move instruction generator vector into GenRandomInst
Keeps scope localized and prevents potential static initialization issues.
2020-04-22 20:46:13 +01:00
MerryMage 47661b746b basic_block: Fix bogus GCC maybe-uninitialized warning 2020-04-22 20:46:13 +01:00
MerryMage ca38225e08 fuzz_with_unicorn: Skip instructions that need to be interpreted 2020-04-22 20:46:13 +01:00
MerryMage 4be55b8b84 A64: Implement FMOV (scalar, immediate) 2020-04-22 20:46:13 +01:00
MerryMage 7e0f14303c fuzz_with_unicorn: Print information on test failure 2020-04-22 20:46:12 +01:00
MerryMage d7044bc751 assert: Use fmt in ASSERT_MSG 2020-04-22 20:46:12 +01:00
Lioncash 71422c2b48 fuzz_with_unicorn: Move data outside loop
Given we know we're only ever going to use one instruction, we can just presize the vector and reassign to it
instead of potentially reallocating the same memory 100000 times
2020-04-22 20:46:12 +01:00
Lioncash cd69c6a17c fuzz_with_unicorn: Dehardcode some constants 2020-04-22 20:46:12 +01:00
MerryMage 98ec9c5f90 A32: Change UserCallbacks to be similar to A64's interface 2020-04-22 20:46:12 +01:00
Lioncash d3b1a72bca unicorn: Display EC and ISS separately beside the full ESR value
Makes it a little nicer to pick out the exception class details at a glance
2020-04-22 20:44:38 +01:00
Lioncash 8fa9849c25 unicorn: Use static_cast instead of reinterpret_cast
It's well-defined to cast from void* back to the original pointer type.
2020-04-22 20:44:38 +01:00
Lioncash cf824fb2b2 unicorn_load: Minor Windows-related changes
- Add missing include
- Fix a potential compilation issue where the constructor wouldn't be able to execute, as it would be private.
2020-04-22 20:44:38 +01:00
MerryMage a8ed248a13 tests/A64: Test memory writes 2020-04-22 20:44:38 +01:00
Lioncash f1057aa362 tests: Fix truncation in GetFpcr() 2020-04-22 20:44:38 +01:00
MerryMage e1df7ae621 IR: Add IR instructions A64Memory{Read,Write}128
This implementation only works on macOS and Linux.
2020-04-22 20:44:37 +01:00
MerryMage 1749780929 interface: Move Vector typedef to config.h 2020-04-22 20:44:37 +01:00
MerryMage 2a493f8b50 fuzz_with_unicorn: Compare vectors 2020-04-22 20:42:46 +01:00