Commit Graph
1716 Commits
Author SHA1 Message Date
Ryan Houdek 834e862dfb FEX: Convert string to fextl 2023-03-16 03:21:46 -07:00
Ryan Houdek b433d7b4cb ELFSymbolDB: Convert string to fextl 2023-03-16 03:21:46 -07:00
Ryan Houdek b6d36f123a Common: Convert string to fextl 2023-03-16 03:21:46 -07:00
Ryan Houdek 0ab2a550b1 FEXCore: Convert string to fextl 2023-03-16 03:21:46 -07:00
Ryan Houdek 1877457c4d FEX: Convert sstream to fextl 2023-03-16 03:21:46 -07:00
Ryan Houdek 3f98eff6e5 AOT: Convert string to fextl 2023-03-16 03:21:46 -07:00
Ryan Houdek fe886716a4 Config: Convert string to fextl
This sprawled out to lots of places as expected
2023-03-16 03:21:45 -07:00
Ryan Houdek e9a0d95c65 Telemetry: Convert string to fextl
Kind of sprawled a bit.
2023-03-16 03:21:45 -07:00
Ryan Houdek 7d226a6b18 SourcecodeResolver: Convert string to fextl 2023-03-16 03:21:45 -07:00
Ryan Houdek 606242472a Convert the rest of map to fextl 2023-03-16 03:03:08 -07:00
Ryan Houdek 8941b8a312 Convert the rest of vector to fextl 2023-03-16 03:03:08 -07:00
Ryan Houdek 37832af818 Allocator: Convert vector to fextl 2023-03-16 03:03:08 -07:00
Ryan Houdek bc42e849e9 TestHarnessRunner: Convert vector to fextl 2023-03-16 03:03:08 -07:00
Ryan Houdek 54c33b07a2 ELFCodeLoader: Convert to fextl
Kind of sprawls all over the place
2023-03-16 03:03:08 -07:00
Ryan Houdek a5b034129e AOTGenerator: Convert vector to fextl 2023-03-16 02:29:05 -07:00
Ryan Houdek 8d57446e88 FEXServerClient: Convert vector to fextl 2023-03-16 02:29:05 -07:00
Ryan Houdek 95a4994200 Cache: Convert over to fextl
Requires #2542 merged first. First commit is cherry-picked from that PR.
2023-03-15 12:22:04 -07:00
Ryan Houdek 728d19dbbe ELFCodeLoader2: Convert list to fextl 2023-03-15 12:22:04 -07:00
Ryan Houdek 4b9c7bd116 FileManager: Convert list to fextl 2023-03-15 12:22:04 -07:00
Ryan Houdek 7b790903c9 AOT: Convert set to fextl
This worms its way all the way to the frontend
2023-03-15 12:16:03 -07:00
Ryan Houdek 149fd2a2b6 ELFContainer: Convert unordered_map to fextl 2023-03-15 12:13:06 -07:00
Ryan Houdek 06211d330d LinuxSyscalls: Convert unordered_map to fextl 2023-03-15 12:12:16 -07:00
Ryan Houdek 18c9e84543 Config: Convert unordered_map to fextl
Needs #2506 merged first. First commit is cherry-picked from it.
2023-03-15 12:11:41 -07:00
Ryan Houdek a4831519cf FileManager: Convert unordered_set to fextl 2023-03-15 12:11:16 -07:00
Ryan Houdek 97565b68db LinuxSyscalls: Convert vector to fextl 2023-03-15 12:10:21 -07:00
Ryan Houdek 6b053d298e VDSOEmulation: Convert vector to fextl
Pipes back to thunk definitions in FEXCore as well.
2023-03-15 12:08:58 -07:00
Ryan Houdek 823222702a ELF parsing: Convert vector to fextl 2023-03-15 12:08:14 -07:00
Ryan Houdek 29963ad5e2 FEXLoader: Move ELFCodeLoader2 to remove 2
We aren't going back to the old code at this point.
2023-03-14 13:35:28 -07:00
Ryan Houdek 335aedc781 Tests: Remove old ELFCodeLoader that isn't used. 2023-03-14 13:32:52 -07:00
Ryan Houdek 64c45ed70a Arm64: Reclaim SRA registers on 32-bit
Causes Portal to go from 85FPS to 120FPS on Lenovo X13s.

When running in 32-bit mode we were wasting 8 GPRs and 8 FPRs by still
allocating the top 8 registers of each even though 32-bit can't use
them.

Reallocate them to be register allocated registers when running 32-bit
applications which reduces spills and lowers the cost of
spilling/filling SRA registers.

Quite a significant speed boost for a little bit of work.
2023-03-14 07:15:05 -07:00
Mai 1aeab04c9f Merge pull request #2491 from Sonicadvance1/remove_unused_fd_mapping
FM: Remove unused FD to Name mapping
2023-03-13 16:17:45 -04:00
Ryan Houdek 89f1e61779 CMake: Get past configuration when mingw is used
Right now cmake doesn't even get past the configuration stage when mingw
is used.
If mingw is detected, setup cmake so it can at least configure itself.
Will be necessary for cleaning up the rest of the codebase.
2023-03-12 16:37:35 -07:00
Ryan Houdek 3ff7cf19c0 FM: Remove unused FD to Name mapping
This was completely unused so this just reduces some syscall signal
mutex locking around FD operations.
2023-03-10 16:30:49 -08:00
Ryan Houdek 3bc484b586 x32: Fixes clock_nanosleep syscall
Alwa's Awakening had an issue where it was spamming clock_nanosleep and
getting EINVAL, consuming a CPU thread to 100%.

This is due to two things in the previous implementation
1) glibc helper does some data munging and validation of inputs
2) We were updating remain even if TIMER_ABSTIME was used

This only cropped up because this error would only occur when EINTR
occured. Since the game is a mono game, the thread that would be
sleeping would get interrupted and then spin forever with corrupted
data.
2023-03-07 11:11:40 -08:00
Mai 2fca207e14 Merge pull request #2462 from Sonicadvance1/fix_proton_2
FileManagement: Fixes Proton
2023-03-04 11:29:07 -05:00
Ryan Houdek b6ac26e0e9 FEXRootFSFetcher: Update link to rootfs links file
Switches to the new CDN which is significantly faster and has other
benefits.

In order to make sure we don't break old clients, switch to the new link
for a few months while leaving the old one operational.

The links file in the old CDN still points to the new rootfs links so
they get the performance improvement on old clients still.
2023-03-04 01:59:44 -08:00
Ryan Houdek ecd144de6a FileManagement: Fixes Proton
Need to ensure that dirfd is AT_FDCWD and also need to check flags
correctly.

Flags were incorrectly checking mode for O_WRONLY and also we should
check for O_APPEND. Split it out to a helper function just so it is
easier to see what is going on.

Fixes the issue of proton not finding `/lib64/ld-linux-x86-64.so.2`
2023-03-03 13:44:17 -08:00
Ryan Houdek 37ec68421c FileManagement: Skip opening emulated writable files
In the case that a file is getting opened to be created or writable then
skip EmuFD and rootfs searching for this file.
This fixes an edge case where if FEX was run with an unpacked rootfs
that was writable then pressure-vessel would break.

Fixes pressure-vessel with unpacked rootfs.
2023-03-02 00:26:34 -08:00
Mai 545a216da6 Merge pull request #2448 from Sonicadvance1/optimize_openat
EmulatedFiles: Optimize openat handler
2023-03-01 17:20:14 -05:00
Mai 70aefc9db2 Merge pull request #2450 from Sonicadvance1/fix_fexserver_zombie
FEXServerClient: Fixes instance where FEXServer can create a zombie
2023-02-28 10:58:11 -05:00
Ryan Houdek 84060cd947 FEXServerClient: Fixes instance where FEXServer can create a zombie
When FEXServer is daemonizing through an instance of FEXLoader or
FEXInterpreter, it would leave a zombie process which was waiting for us
to read the process status.
Since we don't care about the child status and don't want to get blocked
by waitpid, just ignore the signal.

This tells the kernel that we don't care about the signal and will kill
the zombie process immediately.
Didn't notice this before since FEXServer started failing to daemonize.
2023-02-28 05:09:16 -08:00
Ryan Houdek aaf17b6d41 FEXServer: Change systemd service environment variable key
It looks like `SYSTEMD_EXEC_PID` can leak through to the executable
environment in regular situations. Instead let's key off of
`INVOCATATION_ID` which doesn't leak through.

Fixes an edge case behaviour where FEXServer wouldn't daemonize in some
systemd environments.
2023-02-28 05:07:02 -08:00
Ryan Houdek 8ded25ada7 EmulatedFiles: Optimize openat handler
Fixes #2443
I found out with some profiling that this we were spending a decent
amount of time with the `openat` syscall in heavily utilized situations.
While not super common in active gameplay situations, it matters
significantly in loading screens that this is fairly optimal.

The bulk of the time is spent in the emulated files handler to ensure
that whatever path we are given, we can capture file paths that we need
to emulate. The largest contributor being the std::filesystem::canonical
function call.

A couple of optimizations in place here.
1) Do a quick hashmap check right at the start to see if we exactly fit
2) Change from `std::fs::canonical` to `realpath`
3) Switch `GetEmulatedFDPath` to not use optional so it stops building
   on the stack

I'm still not super happy with the performance of `realpath` and also
not happy that we still need to use `lexically_normal` in one code path.
But short of writing a super hand-optimized `realpath` that fits our
constraints, I don't think we can do better.

Micro benchmark needs to test four different situations due to this
optimization.
1) Non-EmuFD path
2) Non-EmuFD path with dirfs
3) EmuFD path
4) EmuFD path with dirfs

And the performance improvement for each situation respectively
1) 12% performance improvement
  - 213413 openat syscalls/s -> 238999 syscalls/s
2) 17% performance improvement
  - 202085 openat syscalls/s -> 237309 syscalls/s
3) 17% performance improvement (/proc/cpuinfo)
  - 56616 openat syscalls/s -> 66231 syscalls/s
  - Includes overhead of generating temp FD and close syscall
4) 5% performance improvement (/proc/cpuinfo)
  - 51080 openat syscalls/s -> 53956 syscalls/s
  - Includes overhead of generating temp FD and close syscall

And for sake of comparison to the non-emulated system; My test system
can hit around 1-1.1 million openat syscalls per second in the same
microbench.

Nice little performance uplift.
2023-02-28 04:00:28 -08:00
Ryan Houdek 98f0f22f41 FileManagement: Optimize GetEmulatedFDPath with an FD!
Performance stats up front:
This improves pressure-vessel startup time on my test device by 10.1%
Improving the startup time from 9.71425 seconds to 8.7421 seconds.

Most filesystem based syscalls support a file descriptor version with an
*at suffix. This allows us to do these syscalls with pathnames that are
relative to the directory FD that is passed to the syscall.

This is pretty much exactly what we want when we are searching for files
inside of our rootfs. The only quirk ends up being that we are getting
passed absolute paths. This ends up being very simple to workaround by
stripping off the front '/' character. Doing this is just offsetting the
pointer passed to the syscall by one byte.

This does require having two temporary buffers of size PATH_MAX passed
to the handler since just like in the other implementation, we need to
keep the previous result around. The difference being now that we aren't
doing a bunch of std::string temporary manipulation and now we are
returning one of the passed in buffers back depending on the result.
2023-02-22 01:25:40 -08:00
Ryan Houdek 35af4bd42a FEXCore: Removes C wrapper interface
This has been a long time coming. The C interface has been a thorn in
our side for no reason for a long time.

The purpose of this step is to remove the C interface without changing
behaviour as much as possible. This means that with this commit there
are still some bad practices but the remaining issues will be solved
with followup PRs.

Primarily, we still have a `DestroyContext(CTX)` static function which calls
the Context implementation's `DestroyContext` and does a raw C++ delete.

Follow up PR will remove that, but I didn't want to touch it yet since
it'll require checking to ensure the unique_ptr changes play nice with
our allocator hooking. Which this is already a huge PR without trying to
change behaviour.
2023-02-19 11:59:11 -08:00
Mai 143ef57141 Merge pull request #2345 from Sonicadvance1/user_sigreturn
Support user supplied signal restorer.
2023-02-08 20:11:47 -05:00
Ryan Houdek be02cafb05 FEXBash: Move to Tools folder
Just a cleanup, no functional change.
2023-02-07 07:40:46 -08:00
Mai c4b66b41cd Merge pull request #2379 from Sonicadvance1/rename_fstatat64
Syscalls: Renamed fstatat64 to fstatat_64
2023-02-06 16:47:02 -05:00
Mai a5762b6faa Merge pull request #2375 from Sonicadvance1/inject_libsegfault
ELFCodeLoader: Adds an option to inject libSegFault
2023-02-06 16:44:52 -05:00
Joshua Ashton d7d8a4e28a Fix SDL2 directfb includes under Alpine Linux 2023-02-06 02:14:36 +00:00