Commit Graph
127 Commits
Author SHA1 Message Date
Stefanos Kornilios Mitsis Poiitidis 9ecde7a0b8 Interpreter: Move execution to IntepreterOps::ExecuteIR, single core refactor 2021-01-29 15:17:37 +02:00
Stefanos Kornilios Mitsis Poiitidis 972219043d Core: Refactor compilation driver, lifetime of objects 2021-01-29 10:42:55 +02:00
Stefanos Kornilios Mitsis Poiitidis 513112919b RA: Move allocation data to RAData 2021-01-29 10:42:40 +02:00
Stefanos Kornilios Mitsis Poiitidis 0c9e05ed8f Rename BlockCache to LookupCache 2021-01-29 01:31:48 +02:00
Ryan Houdek a5d9e62cc6 More improvements to BRK handling
Base size is now only one page in size. We will then increment that BRK
size by 8MB alignments. 256MB for 32bit applications was causing some
applications on the edge to run out of virtual memory
I was hitting some 32bit applications that were being fairly mean with
BRK. They were allocating all of BRK space then running out of virtual
memory space with its mmap handler fallback after freeing BRK space.

This means we now munmap BRK pages on release for the guest, similar to
behaviour that Linux does.

Additionally I had an application that was getting very upset that BRK
wasn't actually at the end of program space. So allocate at the end of
program space like expected.

brk test now passes from gvisor
2021-01-27 10:12:25 -08:00
Ryan Houdek 5673a0e213 Puts the FEX describe tag in CPUID
This is what shows up in /proc/cpuinfo

example on tagged release:   'model name      : FEX-2101'
example on untagged release: 'model name      : FEX-2101-64-g536be23f'

Fixes #661
2021-01-27 07:20:14 -08:00
Stefanos Kornilios Mitsis Poiitidis b0365871b6 OpDisp: Address most 32-bit rip size issues 2021-01-25 15:04:12 +02:00
Stefanos Kornilios Mitsis Poiitidis 3bd8731b26 IR: Add CONFIG_VALIDATE_IR_PARSER, enable it on TestHarnessRunner 2021-01-21 21:38:41 +02:00
Stefanos Kornilios Mitsis Poiitidis fb57e5183a IR: Fix TypeDefinition to actually fit used vector sizes 2021-01-21 21:10:11 +02:00
Stefanos Kornilios Mitsis Poiitidis 74160f38c4 IR: Fix IREmitter::Copy 2021-01-21 21:01:27 +02:00
Stefanos Kornilios Mitsis Poiitidis 072067b5fd IR: Split parser from IRLoader, add IR::Parse() 2021-01-21 19:17:51 +02:00
Ryan Houdek 108992de80 Merge pull request #653 from Sonicadvance1/add_O0
Adds an option to disable optimization passes
2021-01-18 00:10:48 -08:00
Ryan Houdek 544a1f307f Adds an option to disable optimization passes
Instead of forcing someone to test by modifying code, allow a -O0 option
to be passed in.
Also added to FEXConfig GUI for easily touching.

Fixes #652
2021-01-17 23:51:22 -08:00
Stefanos Kornilios Mitsis Poiitidis 2e038c788b IREmitter: Fix CreateNewCodeBlockAfter to append at the end when asked so, don't order block storage 2021-01-15 22:22:50 +02:00
Stefanos Kornilios Mitsis Poiitidis 41d0f84710 OpDisp: Improve block ordering interface, optimize branching order and conds 2021-01-15 21:05:29 +02:00
Stefanos Kornilios Mitsis Poiitidis 5fdbb8a9b2 OpDisp: Improve block ordering for multi-block ops 2021-01-15 21:05:29 +02:00
Ryan Houdek 1084ecf2d3 Fixes more 16bit modrm addressing problems
In the case of an instruction that used 16bit addressing mode. It would
calculate the amount of displacement needing to be read using a 32bit
modrm mode. It would then read calculate modrm displacement again and
read the correct number of bytes.

Leftover bytes would then be in a mismatched state which means if an
instruction was using 16bit addressing + modrm + literal at /that/ point
the number of literal bytes remaining would be calculated as a negative.

This didn't actually break things since instructions that have modrm +
literal and can safely use 16bit addressing without breaking in a 32bit
environment is impossible on Linux. Due to the inability to map a memory
range in 16bit range.
2021-01-13 12:02:19 -08:00
Stefanos Kornilios Mitsis Poiitidis f951bc969e Merge pull request #628 from Sonicadvance1/more_syscalls
Implements more syscalls
2021-01-13 20:45:02 +02:00
Stefanos Kornilios Mitsis Poiitidis 271d5898fb Merge pull request #642 from Sonicadvance1/fix_llvm_asan
Fixes 64bit ELF loading when LLVM ASAN is used
2021-01-13 12:55:58 +02:00
Ryan Houdek 433162004a Implements more syscalls 2021-01-12 14:50:17 -08:00
Ryan Houdek 43af4e26d1 Fixes 64bit ELF loading when LLVM ASAN is used
Instead of hardcoding 64bit dynamic ELF files to 0x1'0000'0000 we
instead calculate the size of the ELF in memory. Then allocate the
ELF base up front.

LLVM ASAN steals a large amount of virtual memory space that intersected
with the original hardcoded range which caused memory allocations to
fail.
2021-01-11 09:07:16 -08:00
Ryan Houdek aa3b77e4c8 Uninstalls LogManager handlers on shutdown
In case something manages to have stayed alive and tried throwing a
message, this will no longer crash.

Noticed this with the previous commit
2021-01-11 09:03:56 -08:00
Ryan Houdek ee8dfb8fc5 Merge pull request #606 from duck-37/sigsegv-fail-tests
Have tests that throw a non-HLT SIGSEGV fail
2021-01-06 15:28:38 -08:00
duck f9cd0f0179 Have tests that throw a non-HLT SIGSEGV fail
Patch moves HandleSIGSEGV in HostFactory.cpp to a non-frontend host signal handler, then registers its own frontend signal handler to catch unhandled segfaults.
2021-01-06 05:07:47 -05:00
Stefanos Kornilios Mitsis Poiitidis 81756b2346 IR: Add opreator != for NodeWrapperBase 2021-01-05 17:14:57 +02:00
Ryan Houdek 4907bda639 Adds support for proper sized GPR->FPR sized conversions
Both x86 and AArch64 support converting from one sized GPR to another
sized FPR. Expose it in our IR op.

Fixes a bug in CVTSI2SS with a 64bit source and it was treating the
input source as a 32bit value.

eg:
0x0000'0000'FFFF'FFFF was treated as converting to -1 float, which was wrong since it is a 64bit value
2020-12-30 10:07:12 -08:00
Stefanos Kornilios Mitsis Poiitidis ef75b8e4ec Merge pull request #582 from Sonicadvance1/move_syscalls
Moves FEXCore's SignalDelegator and SyscallHandler to the frontend
2020-12-16 12:52:39 +02:00
Ryan Houdek 7eb708afee Shuts up a c++20 warning
This operator== is claiming to be ambiguous.
Just make the function const to make it unambiguous
2020-12-14 03:57:56 -08:00
Ryan Houdek 37983006f0 Moves FEXCore's SignalDelegator and SyscallHandler to the frontend
Sadly these things can't be split without breaking functionality so it
turns in to a bit of a mess.

SyscallHandler is very much something that is a Linux only construct and
shouldn't be in FEXCore itself. Lets the frontend register a
Syscallhandler with FEXCore. FEXCore itself is then aware of the current
syscall ABI and handles the ABI in an optimal fashion.
So it is not a 100% clean break otherwise we would lose performance.

The SignalDelegator then needs to move to the frontend since the
SyscallHandler requires it for signal based syscalls.
The CPU backend signal handling still needs to happen in FEXCore because
it is a very tight coupling with the CPU backend.
Once we need to support more Signal handling we can give the backends
cleaner support to select which specific OS handler to handle.
2020-12-13 22:38:04 -08:00
Ryan Houdek 36b24ad141 Removes all uses of non-unified memory and SHM regions
Let's just delete the whole thing!
2020-12-10 02:09:52 -08:00
Ryan Houdek 01831ec264 Check for binfmt_misc install and run directly only if installed
If we want to execve files directly we need to ensure that the
binfmt_misc interpreter path is installed.
If it isn't installed then we need to fall down the regular path of
pushing FEX to the front of the argument list.
2020-12-09 20:34:03 -08:00
Ryan Houdek 4603b92b9f Adds an option for determining if we were interpreter executed
Will be necessary soon
2020-12-08 07:28:50 -08:00
Ryan Houdek a23c045c23 Adds a ELFLoader helper to determine supported ELF file
We will need to check if an application can be executed through the
interpreter by checking program getting executed
2020-12-08 07:28:50 -08:00
Ryan Houdek f14cd54791 Switches over to having a correctly layered configuration system
Instead of having the configuration being loaded and stored in to a
frontend system. First moves the backing store of the configuration in
to FEXCore.

Each layer that is constructed then loads its particular configuration.
After the layers are loaded, then a meta layer is constructed that
merges the layers flat.

This means we will no longer hit the problem where a configuration is
stored in the "main" configuration file, then environment and arguments
passed manage to overwrite it.

The order of the layers going from inner most layer to outer most, with
outermost overwriting previous layer configurations is as follows:

Main < Global application < Local application < Arguments < Environment

One step that needs to be changed in the future is that FEXCore can then
just load its configuration from the layers directly since the data is
in FEXCore now. This will be reserved for a future change so we are less
disruptive.
2020-12-07 11:15:48 -08:00
Ryan Houdek a0149dff07 Merge pull request #554 from FEX-Emu/skmp/cmt-around-select
CMT: Move unary ops before selects
2020-12-03 20:20:45 -08:00
Ryan Houdek c7c2e56ae5 Merge pull request #552 from FEX-Emu/skmp/perblock-debug-data
JITSYMS: Per-block symbol information
2020-12-03 20:13:34 -08:00
Stefanos Kornilios Mitsis Poiitidis b2d862a8c7 IR: Replace Sext with Sbfe 2020-12-03 20:08:08 +02:00
Stefanos Kornilios Mitsis Poiitidis c802b82450 CMT: Move unary ops before selects, if both True & False values are consts 2020-12-03 19:11:25 +02:00
Stefanos Kornilios Mitsis Poiitidis 28bff432e5 DebugData: Add Subblock list, populate it from arm64 backend 2020-12-03 18:43:38 +02:00
Ryan Houdek a28df9f5c1 Moves SonicUtils in to FEXCore
Removes the extraneous and dead VM CPU backend
2020-11-29 00:30:28 -08:00
Scott Mansell 5b1d4eadd4 IR: Make BFI sizes explicit
Otherwise they can be quite hard to get right.
2020-11-26 12:40:37 +13:00
Ryan Houdek 6605c6e6eb Removes dead TLS setting code
This is no longer necessary now that phire fixed mapping of static elfs
2020-11-25 13:18:57 -08:00
Ryan Houdek 830d8146cf Support unity+mono+bdwgc sigsuspend GC shenanigans 2020-11-20 01:07:54 -08:00
Ryan Houdek 4503f41957 Merge pull request #473 from FEX-Emu/skmp/memops-addressgen
Complex address generation for Load/StoreMem
2020-11-19 23:57:20 -08:00
Ryan Houdek c430f10c86 Implements a threaded compile service routine
This is made to be completely synchronous to a thread
2020-11-18 10:07:47 -08:00
Stefanos Kornilios Mitsis Poiitidis 59c9138282 Merge pull request #511 from Sonicadvance1/compile_service_shared_data
Adds function for copying data required for threaded compiler
2020-11-18 20:03:27 +02:00
Ryan Houdek 47d47fac86 Adds function for copying data required for threaded compiler
These structures need to be shared to the threaded compiler, so set it
up for copying.

Will be necessary for the compile service
2020-11-17 13:48:10 -08:00
Ryan Houdek 1b21bb7699 Allow copying of an IRListView copy
This will be useful with the compile service coming up to keep
IRListViews coherent across threads
2020-11-17 12:31:53 -08:00
Stefanos Kornilios Mitsis Poiitidis f38179913a IR: Swith MemoryOffsetType to a type from uint8_t 2020-11-17 16:23:50 +02:00
Stefanos Kornilios Mitsis Poiitidis 9fdd2a5b10 LoadMem/StoreMem: Add OffsetType, OffsetScale 2020-11-17 16:23:50 +02:00