Commit Graph
291 Commits
Author SHA1 Message Date
Ryan Houdek 826464d894 Ensures that Config.json stores to ${CONFIG}/Config.json
Just ensures that it gets stored in the correct XDG or ~/ config
directories.
If these don't exist then it'll get dumped in to PWD or cwdir, whichever
is available as fallback
2020-06-12 15:08:16 -07:00
Ryan Houdek cf546268ea Ensures that Unified Memory is enabled by default 2020-06-12 15:08:16 -07:00
Ryan Houdek b262b59916 Fixes up prefix handling for 32bit
Moves REX to a 64bit only table entry. This allows the missing INC/DEC
instructions to exist in 32bit space
2020-06-10 16:49:06 -07:00
Ryan Houdek 7302ad1996 Adds new FEX config for telling the guest how many CPU cores it can have
This is just a virtual number that the guest can query through the
various means. Will affect mesa with how many helper threads it
generates at the very least
2020-06-04 00:03:41 -07:00
Ryan Houdek 03b885816e Fixes a crash that can occur when the config exists but has nothing
Common when I'm testing and wiping the config away
2020-05-30 18:56:39 -07:00
Ryan Houdek 5e4a75e8a6 Fixes crashes in unit tests
In the case of multiple dozens of tests running, they will end up
loading and saving the config files dozens of times.
This was causing the configuration system to load in half saved files
that were causing common crashes in the posix unit tests.

Theoretically this could have happened at any time but it looks like
with the posix unit tests added, it is just more likely to happen.

Makes it so loading the configuration file is much more robust and
verbose on failure.
Makes it so saving the config file first saves to a temporary and then
moves in to the correct location. This causes the config saving to be
atomic in a sense so the unit tests won't corrupt other processes of FEX
trying to load the config file.
2020-05-27 16:52:45 -07:00
Ryan Houdek 38ff936c81 Adds support for interpreter fallback
The IRHeader itself contains a flag for if a block should fallback to
the interpreter.
This is necessary for the case that an IR is loaded and the Frontend
object no longer has the data necessary to know if it should do an
interpreter fallback.
This is super useful for bisecting JIT versus Intepreter failures, and
also cases where falling back to intepreter for compatibility is a lot
more simple than wiring things through the JIT (ala x87)

This isn't currently utilized, but will be once x87 work lands
2020-05-26 19:08:18 -07:00
Ryan Houdek 7c8f7c732f Fixes some missing includes 2020-05-25 20:04:17 -07:00
Ryan Houdek ba3cb444ee Ensures test harness runner runs in 64bit mode 2020-05-14 01:03:42 -07:00
Ryan Houdek d2cf07a4fd Passes the running mode through from FEX to FEXCore 2020-05-14 00:56:31 -07:00
Ryan Houdek b70176c99a Fixes bug in TypeDefinition elements
Elements of 0 isn't a real thing. Would cause problems in the CPU
backends.
Ensure we have at least 1 element (Which technically means a vector 1
element wide, but that just defines as a scalar)
2020-05-09 12:14:59 -07:00
Ryan Houdek cda734cea2 Adds support for comment lines in the IR parser
Comments start with ';' on the line.
You can also technically have comments after IR ops but that isn't
explicitly supported, just an artifact of how things are parsed.
2020-05-09 12:14:59 -07:00
Ryan Houdek 718b3e6b4c Refactors PassManager to ingest IREmitter class instead of OpDispatcher
The Passmanager passes need very little or zero x86 knowledge to do
their work. They don't need the x86 OpDispatcher handling code at all.
Convert this entirely over to using the IREmitter class so it can
actually optimize IR code from the IRLoader frontend
2020-05-09 12:14:59 -07:00
Ryan Houdek dff0a8fb69 Switch the IRLoader over to using the IREmitter class
Reduces some code duplication
2020-05-08 19:11:31 -07:00
Ryan Houdek 9fd3cd8884 Implements IR loader frontend application
This application loads an IR from an IR file.
It then proceeds to lex the file and translate it to binary IR.
Once the file is loaded it then the IR is passed off to the backend and
it attempts to run the IR.

This will be used when debugging RA and writing unit tests directly in
IR.
This is a necessary evil for ensuring correctness
2020-05-07 17:47:37 -07:00
Ryan Houdek 66dc5ebc54 Merge pull request #179 from FEX-Emu/skmp/fix-exit-code
Propagate guest exit code
2020-05-01 16:58:07 -07:00
Stefanos Kornilios Mitsis Poiitidis d58961ef1e Propagate guest exit code 2020-05-02 02:34:50 +03:00
Stefanos Kornilios Mitsis Poiitidis 3c9be4625c Add silent log 2020-05-02 01:45:22 +03:00
Ryan Houdek 0d83454366 Merge pull request #170 from dmiller423/procfs_auxv
Added dup3 syscall, EmulatedFiles : /proc/{self,$PID}/auxv, modified …
2020-04-29 16:06:30 -07:00
David Miller 09f119a3ce removed front end header / class from EmulatedFiles.cpp 2020-04-29 16:39:40 -04:00
David Miller 306cca33d7 Added dup3 syscall, EmulatedFiles : /proc/{self,$PID}/auxv, modified OpenAt() to normalize path to canonical if possible or lexically_normal. Note: canonical will change symlinks, ensure the map keys take this into account. 2020-04-29 16:00:59 -04:00
Ryan Houdek 3528b30684 Fixes loading EXEC applications in to memory.
If we are loading EXEC then we actually need to start loading in to the
lower 32bits of memory.
This lets the frontend code loader handle the memory base instead of
hiding it behind some core magic instead.

This lets us get EXEC programs working.
So now we support EXEC, DYN, and static applications
2020-04-26 18:11:48 -07:00
Ryan Houdek 0c88f12801 Merge pull request #159 from dmiller423/cmake_pkg_find
CMake checks for Boost && Nasm in ./Source/Tests/CMakeLists.txt
2020-04-25 11:58:56 -07:00
David Miller 9b8871fee6 added checks for ./Source/Tests/ {Boost,NASM} 2020-04-25 14:55:28 -04:00
David Miller c77a3c0c02 changed default value of FEXCore::Context::Config::UnifiedMemory to proper location 2020-04-25 14:34:34 -04:00
David Miller e9003acf36 Ensure TestHarnessRunner doesn't enable UnifiedMemory. 2020-04-25 12:56:37 -04:00
David Miller 0c51baf7a8 Added default Config::UnifiedMemory value to true 2020-04-25 12:49:41 -04:00
David Miller 1589b9a351 Added EnvLoader to frontend binaries, called prior to ArgLoader 2020-04-24 19:53:28 -04:00
David Miller 75ee8f0604 EnvironmentLoader, clean merge 2020-04-24 19:25:57 -04:00
David Miller 5999e7477f Added guard around llvm/IR/IntrinsicsX86.h inclusion, seems to only be needed for version 10?\nMore Investigation needed here.\nChanged Debugger/IMGui.{h,cpp} to IMGui_I so it will build in filesystems that aren't case sensitive.\nAdded CMakeSettings.json that has profiles to build from VisualStudio, using env variables to control system specific options. \n Currently only the WSL is tested (and working). \nRemote should work as well, if correct string for preconfigured remote is in env variable fexremote.\nCross compile (to linux) untested, using sysroot in env variable fexsysroot 2020-04-23 16:12:28 -04: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 3424326987 Removes accurate-std command line argument
This is an option that has been removed
2020-04-09 18:01:29 -07:00
Ryan Houdek 5298379fb9 Ensure the ELFLoader doesn't end up in the lower 32bit address space
We need to reserve that space for EXEC apps and 32bit apps. Hard throw a
warning if any of our mapping space ends up in the lower 32bits.

PIE and potentially a custom dynamic linker can enforce this.
2020-04-08 13:35:29 -07:00
Ryan Houdek 15d5ba6fc1 Adds RootFS search path in ELFLoader
Fixes #69, makes it less annoying to run things on non x86 hosts
2020-04-04 23:17:40 -07:00
Ryan Houdek 3fd1475d30 Plumbs ELFLoader arguments through the CodeLoader
This is necessary for execve in the future to keep everything in sync
2020-03-21 15:19:31 -07:00
Ryan Houdek e5dc72ad69 Fixes the dynamic linker detection
Fixes #49

Makes it so we no longer have to pass in the ld location to the
ELFLoader application.

Once we switch over to the dynamic linker, the program being executed to
us is no longer a dynamic program.
But the frontend ELF loader also still needs to know that we are
executing the dynamic linker so it can append the linker to the
arguments.
2020-03-20 13:08:33 -07:00
Ryan Houdek 4ea18647ed Make the unit test runner allocate less SHM space
It doesn't need 64GB of virtual memory, so knock it down to its minimum
virtual memory required
2020-03-17 09:34:20 -07:00
Ryan Houdek a2afd684ae Allows ELF loader to pull in all environment variables
This will leak some host state which is fine.
Necessary to allow access to things like DISPLAY and XAUTHORITY and
various other bits
2020-03-06 09:08:50 +02:00
Ryan Houdek b75647f9a8 Be better behaved with the Test harness helper results 2020-03-06 09:08:50 +02:00
Ryan Houdek 03f068ec1d Adds support for unified memory option in ELFLoader application 2020-03-06 09:08:50 +02:00
Ryan Houdek d698feae53 Update ELFLoader CodeLoader to support unified memory and auxp values
auxp is required for most applications
2020-03-06 09:08:50 +02:00
Ryan Houdek c32d7b84bc Make environment variable setting less vocal 2020-03-06 09:08:47 +02:00
Scott Mansell d4cffa5354 Add x87/MMX registers to test harness 2020-03-06 09:08:47 +02:00
Ryan Houdek 3a460b4bf0 Support setting the library rootfs in the ELFLoader 2020-03-06 09:08:46 +02:00
Ryan Houdek 13d681558e Adds accurate STD output option to ELFLoader 2020-03-06 09:08:44 +02:00
Scott Mansell 149ab3f6f7 TestHarnessRunner: Abuse CompareStates to verify
Bit of a hack, but it gets verification against the expected values.
2020-03-06 09:08:35 +02:00
Scott Mansell 213b739f12 Add GdbServer intergraton 2020-03-06 09:08:34 +02:00
Scott Mansell 81b9810f36 FEXCore: Refactor context start/pause/step interface 2020-03-06 09:08:28 +02:00
Ryan Houdek c0b3a94e4f Fixes up stack space for argv and envp
These were messy and we were previously losing a page for random
"redzone" which doesn't matter.
We only needed 16bytes more for some additional padding that was needed
for something
2020-03-06 09:08:25 +02:00
Scott Mansell 3300587e6a Fix ENV pointers overwriting args 2020-03-06 09:08:25 +02:00