Commit Graph
251 Commits
Author SHA1 Message Date
Ryan Houdek 1ac36e2ddd Merge pull request #131 from Sonicadvance1/fix_dumb_wait_for_idle
Removes the dumb timer wait for idle
2020-04-24 09:10:10 -07:00
Ryan Houdek f6bdcbbdcf Merge pull request #129 from Sonicadvance1/more_syscalls2
Implements two more syscalls
2020-04-24 09:10:01 -07:00
Ryan Houdek e0ca2e3126 Merge pull request #128 from Sonicadvance1/removes_ssse3
Removes SSSE3 CPUID feature bit
2020-04-24 09:09:51 -07:00
Ryan Houdek 7869a5a40e Merge pull request #127 from Sonicadvance1/fix_x86_regs
Fixes x86 JIT's RA for 16bit and 8bit registers
2020-04-24 09:09:40 -07:00
Ryan Houdek 8cc8472a75 Merge pull request #126 from Sonicadvance1/fix_llvm_logs
Disables LLVM debug messages
2020-04-24 09:09:20 -07:00
Ryan Houdek 2e5db1ddc9 Merge pull request #125 from Sonicadvance1/x87_table
Ensure FLDENV/FNSTENV has correct flags in the x87 table
2020-04-24 09:09:06 -07:00
Ryan Houdek b5c170be41 Merge pull request #123 from Sonicadvance1/fix_32bit_x86_cvtsi2ss
Fixes 32bit Float_FromGPR_S IR op in x86 JIT
2020-04-22 08:37:56 -07:00
Ryan Houdek 0c1fecb6c2 Merge pull request #113 from Sonicadvance1/redundant_ra_allocation
Ensures the JIT constructor's don't reallocate RA
2020-04-20 17:18:51 -07:00
Ryan Houdek 6642734aa8 Removes the dumb timer wait for idle
Turns out my Threadripper stomps these tests so the arbitrary wait time
actually slows down my unit test time.
Don't want to make it shorter since `strace -f` becomes ugly at that
point.
Instead set up a semaphore style waiting structure that waits until
there are no longer any participants in the atomic
2020-04-18 12:37:58 -07:00
Ryan Houdek 56759faff0 Merge pull request #122 from Sonicadvance1/fix_futexes
Fixes some bugs with threads and futexes
2020-04-18 12:35:56 -07:00
Ryan Houdek a901c3cb07 Implements two more syscalls 2020-04-18 11:55:32 -07:00
Ryan Houdek aa9756bffc Merge pull request #121 from Sonicadvance1/new_syscalls
Implements ~20 new syscalls
2020-04-18 11:43:23 -07:00
Ryan Houdek d55ce197b6 Removes SSSE3 CPUID feature bit
Dolphin uses this in a couple of places, so until it is fully supported
leave it disabled.
2020-04-18 11:32:41 -07:00
Ryan Houdek 7c9dca0de9 Fixes x86 JIT's RA for 16bit and 8bit registers
There were four independent arrays for each size of the RA.
Missed the 16bit and 8bit registers when removing a register.
This removes the redundant arrays and just uses one and transforms the
register to the right size depending on what the JIT wants
2020-04-18 11:31:56 -07:00
Ryan Houdek 21cad8f689 Disables LLVM debug messages 2020-04-18 11:27:59 -07:00
Ryan Houdek 4f80a1a3a7 Ensures the JIT constructor's don't reallocate RA
Currently RA is shared between threads(!).
If the RA had been previously allocated then don't allocate it again.
Fixes a race condition when multiple threads are spinning up and one is
compiling code
2020-04-18 11:26:10 -07:00
Ryan Houdek 5a89463c2b Merge pull request #112 from Sonicadvance1/RA_validation
Lets the IR validation pass validate RA
2020-04-18 10:49:29 -07:00
Stefanos Kornilios Mitsis Poiitidis 3edaf6e46e Merge pull request #120 from Sonicadvance1/cpuid_amd
Add a compile define for choosing CPUID manufacturer id
2020-04-18 04:12:49 +03:00
Stefanos Kornilios Mitsis Poiitidis 86b13a9ff7 Merge pull request #119 from Sonicadvance1/implement_movbe
Implements MOVBE
2020-04-18 04:11:43 +03:00
Stefanos Kornilios Mitsis Poiitidis 8642a64733 Merge pull request #118 from Sonicadvance1/remove_bmi
Removes BMI1/BMI2 CPUID bits
2020-04-18 04:10:37 +03:00
Ryan Houdek 36a9388481 Lets the IR validation pass validate RA
Adds some additional validation that an IR op is generating RA for ops
that set a destination.
Ensuring correct register class and that there is a physical register
assigned
2020-04-17 18:09:46 -07:00
Ryan Houdek 37e2a2bb6f Adds validation passes after regular passes
This is required for the forthcoming IRValidation pass change that
validates RA is working
2020-04-17 18:09:46 -07:00
Stefanos Kornilios Mitsis Poiitidis 98c00ba6b1 Merge pull request #106 from Sonicadvance1/vector_op_ir
Move vector op RegisterSize and ElementSize values in to the header struct
2020-04-18 04:00:52 +03:00
Stefanos Kornilios Mitsis Poiitidis 2bb3543827 Merge pull request #102 from Sonicadvance1/ra_class_in_json
Minor IR cleanup
2020-04-18 03:57:46 +03:00
Ryan Houdek 5cdf97e028 Ensure FLDENV/FNSTENV has correct flags in the x87 table 2020-04-17 15:28:48 -07:00
Ryan Houdek 2cac41ee1c Adds a bunch more syscalls
Some of these are just there to get us farther in some cases. They can
result in behaviour the app isn't expecting like when signals are setup
but not handled correctly.
Is fine for the cases that the app doesn't actually use them.
2020-04-17 15:19:09 -07:00
Ryan Houdek d12ac8365d Fixes 32bit Float_FromGPR_S IR op in x86 JIT
x86's cvtsi2ss can take a 32bit or 64bit input and convert it to a 32bit
float.
This ensures the register passed in is 32bit so it uses the 32bit
instruction
2020-04-16 12:09:58 -07:00
Ryan Houdek 902cae7ebc Fixes some bugs with threads and futexes
Fixing some bugs in threading required fixing how the futexes operate.
Instead of the terrible condition variables and atomic values just use
the kernel futex facility directly.
This required fixing some of the threading management since otherwise
there was a issue around the weird mixture of our threads using our
"Futex" class and the kernel expecting real futexes on the values.
Just switch everything over and it ends up being cleaner

Fixes random mutex failures that were happening in various applications
2020-04-15 11:58:26 -07:00
Ryan Houdek 46692d72c0 Adds new syscalls to the jump tables 2020-04-15 11:18:37 -07:00
Ryan Houdek 6471b6e833 Adds two new thread syscall functions
Adds getppid and kill

kill signals sent to emulator local threads may or may not behave as
expected until signals are implemented here
2020-04-15 11:16:14 -07:00
Ryan Houdek 565b8a6b54 Adds new FD syscall functions
flock, fsync, fdatasync, and fchmod
2020-04-15 11:14:23 -07:00
Ryan Houdek 12e8e63be7 Adds epoll_create syscall function 2020-04-15 11:13:36 -07:00
Ryan Houdek 8c8216584a Add a compile define for choosing CPUID manufacturer id
This can prove useful for applications that change some of their checks
depending what the vendor is
2020-04-15 11:08:32 -07:00
Ryan Houdek 46402e3244 Implements MOVBE in the OpDispatcher
This is pretty easy to implement. Kind of flies in the face of why the
instruction implementation exists (icache and frontend issue overhead
savings) but it is easy to implement.
2020-04-13 17:43:33 -07:00
Ryan Houdek 494e27c87d Fixes the MOVBE instruction table definitions
CRC32 was overlapping the MOVBE instruction with 66 prefix
2020-04-13 17:43:33 -07:00
Ryan Houdek faa596f735 Fixes 16bit REV in the JITs 2020-04-13 17:43:33 -07:00
Ryan Houdek d431223710 Removes BMI1/BMI2 CPUID bits
BMI1 would be straightforward to implement, BMI2 would take a bit more
effort because of the PDEP, PEXT, and BZHI instructions.

Bigger problem is that we don't support VEX three operand decoding in
the frontend at all.
Disable these until then
2020-04-13 17:34:01 -07:00
Stefanos Kornilios Mitsis Poiitidis 15d008d389 Merge pull request #115 from Sonicadvance1/fix_memory_allocation
Fixes memory allocation
2020-04-13 09:58:29 +03:00
Stefanos Kornilios Mitsis Poiitidis bf130e28a5 Merge pull request #114 from Sonicadvance1/cvtsd2si
Implements CVTSD2SI
2020-04-13 09:57:13 +03:00
Stefanos Kornilios Mitsis Poiitidis 7abd7f358d Merge pull request #111 from Sonicadvance1/waitforidle_race
Fixes a race condition in WaitForIdle
2020-04-13 09:53:13 +03:00
Stefanos Kornilios Mitsis Poiitidis 25d30597b5 Merge pull request #110 from Sonicadvance1/fix_clone_fork
Fixes clone syscall when VFORK flag is used
2020-04-13 09:51:48 +03:00
Stefanos Kornilios Mitsis Poiitidis 40c7da0b53 Merge pull request #109 from Sonicadvance1/fix_affinity_syscall
Fixes the getaffinity syscall
2020-04-13 09:50:46 +03:00
Stefanos Kornilios Mitsis Poiitidis 374e6f397c Merge pull request #108 from Sonicadvance1/mlock_syscall
Implements the mlock syscalls
2020-04-13 09:49:54 +03:00
Ryan Houdek 780278a7f6 Fixes memory allocation
4GB virtual memory is too small and causes things to fault.
Previously we were at `1 << 36` but it caused oom issues on devices with
smaller amounts of memory.
This time ensure the the SHM memory is allocated with MEM_NORESERVE so
devices can actually allocate the virtual memory region.
2020-04-12 18:39:00 -07:00
Ryan Houdek b79083e510 Implements CVTSD2SI 2020-04-12 17:46:42 -07:00
Ryan Houdek f74bca4fdb Fixes a race condition in WaitForIdle
This is something that TSAN caught was happening.
Grabs the thread creation mutex when checking for idle and extends the
sleep time for WaitForIdle to something that is still below unit test
run time
2020-04-12 17:31:11 -07:00
Ryan Houdek 9233589ccc Fixes clone syscall when VFORK flag is used
The VFORK flag lets clone behaviour similarly to a fork.
The parent will be suspended until the resulting thread is exited
The mutex is removed because everything that touches state is already
wrapped by mutexes. So we don't need this one
2020-04-12 17:29:46 -07:00
Ryan Houdek 94b0ea4be3 Fixes the getaffinity syscall
This was implemented with the glibc API originally which was incorrect.
The syscall API is just a simple bitmask of for the affinity of the
number of CPU cores and a size check that the resulting structure is
large enough to store the number of bits.
2020-04-12 12:44:37 -07:00
Ryan Houdek 6f7573d726 Implements the mlock syscalls
Saw this when running Dolphin
2020-04-12 12:38:37 -07:00
Ryan Houdek 2ec41070da Ensure that anything opened with openat is tracked in our FD map
Missing this was an accident, this was how it was supposed to be.
It's very helpful to map FDs to filenames when tracking mmap mappings
2020-04-12 12:36:20 -07:00