2830 Commits

Author SHA1 Message Date
Ryan Houdek
6ac942266f Implements support for cpack debian package building
This doesn't currently install thunks which can come a bit later.
We require a postinst and prerm step for importing and unimporting the binfmt_misc files.
Easy enough
2021-06-23 18:47:04 -07:00
Ryan Houdek
24a2a0c4eb Switches binfmt_misc install step to use registration files
This is easier to represent than the raw files. Once we do a debian file install then
this becomes more important
2021-06-22 20:22:09 -07:00
Stefanos Kornilios Mitsis Poiitidis
910c624a8b
Merge pull request #1104 from Sonicadvance1/implement_32bit_iret
Implements 32-bit iret instruction
2021-06-22 09:22:00 +03:00
Stefanos Kornilios Mitsis Poiitidis
767ea0fc9e
Merge pull request #1103 from Sonicadvance1/deprioritize_aot
Lower priority of AOT compilation threads.
2021-06-22 09:20:23 +03:00
Stefanos Kornilios Mitsis Poiitidis
087e5a9576
Merge pull request #1102 from Sonicadvance1/implement_truncate64
Implements 32-bit truncate64 syscall
2021-06-22 09:20:04 +03:00
Stefanos Kornilios Mitsis Poiitidis
67e6ffbc93
Merge pull request #1101 from Sonicadvance1/fixed_stack_fix
Fixes fixed stack offset for 32-bit applications
2021-06-22 09:19:36 +03:00
Stefanos Kornilios Mitsis Poiitidis
6734d745c6
Merge pull request #1099 from Sonicadvance1/fix_strace_32
Fixes debug strace output
2021-06-22 09:17:14 +03:00
Stefanos Kornilios Mitsis Poiitidis
332123a38c
Merge pull request #1098 from Sonicadvance1/fix_more_gdt
Fixes a 32-bit processes wanting another TLS space
2021-06-22 09:16:40 +03:00
Stefanos Kornilios Mitsis Poiitidis
24fdbe4e6d
Merge pull request #1096 from Sonicadvance1/fix_kotor2
Fix Star Wars Knights of the Old Republic 2
2021-06-22 09:14:02 +03:00
Ryan Houdek
d587485383 Implements 32-bit iret instruction
This is necessary for wine and some wine-like emulation layers.

With this implemented then some Saint's Row games start running.

Fixes #1100
2021-06-21 00:20:44 -07:00
Ryan Houdek
c9211ae77a Lower priority of AOT compilation threads.
Set these threads to minimum priority to not complete starve the system if there are other tasks running.
Fixes #1075
2021-06-20 17:24:36 -07:00
Ryan Houdek
7cbe9579ba Fixes 32-bit allocator returning 64-bit pointers on old kernels
In the case of a kernel older than 4.17 then MAP_FIXED_NOREPLACE doesn't exist.
This adds a check in to see if the pointer returned was valid but not what we asked for
2021-06-20 17:22:26 -07:00
Ryan Houdek
ca482e3e96 Implements 32-bit truncate64 syscall
A 32-bit game was using this syscall and now it gets farther in game
2021-06-20 01:10:19 -07:00
Ryan Houdek
eaa3df9cba Fixes fixed stack offset for 32-bit applications
Instead of forcing a fixed offset for the stack. Allow it to get placed automatically.
64-bit was already doing this; Now we can also do it in 32-bit.
This is possible because the mapper that is mapping the code will always map in the 32-bit space
for a 32-bit guest.
2021-06-20 01:07:58 -07:00
Ryan Houdek
c252dc99fc Fixes debug strace output
This custom definition was missing
2021-06-19 22:01:47 -07:00
Ryan Houdek
70dc5217ec Fixes a 32-bit processes wanting another TLS space
Currently our 32-bit code only gave one TLS slot and crashed
if you needed more.

First switch over to the same initial slot as the Linux kernel.
Then allow searching the slots for a free spot.
This allows us to more closely match the behaviour of the Linux kernel just in case
anything has hardcoded the TLS slots

This makes it so Saints Row: The Third stops crashing at boot, plays a few intro videos, then hangs instead.
2021-06-19 21:58:49 -07:00
Ryan Houdek
1745bcceb6 Fixes 32bit statfs and fstatfs
These 32bit syscalls use a compat statfs which is only 64bytes in size.
This was overwriting data on the guest stack and causing crashes.

Describe a 32-bit statfs struct and ensure with struct verifier that it matches.

Fixes a crash in KOTOR2 that would happen just before the main menu.
2021-06-19 07:26:41 -07:00
Ryan Houdek
cc8fa9d934 Fixes 32bit sysinfo syscall
This was altered in kernel 2.3.23 to include a mem_unit variable.
mem_unit states what each of the memory units is scaled by.

The kernel will always have this be 1 or page size on x86, so follow that behaviour.
Instead of maxing out the values to what uint32_t can handle, scale all of these by page size instead.

This fixes a crash in KOTOR2's boot sequence where it would divide by zero if everything was maxed out.
2021-06-19 07:23:25 -07:00
Ryan Houdek
424b93b5f8
Merge pull request #1095 from Sonicadvance1/disable_flake2
Disable flaky posix test
2021-06-17 15:12:59 -07:00
Ryan Houdek
5fccf5f741 Disable flaky posix test
Test sleeps for 1 second and expects to come back within 10ms of the time.
When the CPU is doing other things then it can end up missing that timeframe. Thus flake.

Just disable it
2021-06-17 07:51:37 -07:00
Ryan Houdek
42f1dfeede
Merge pull request #1094 from Sonicadvance1/fix_fexbash_squashfs
Fixes FEXBash with squashfs
2021-06-17 07:47:04 -07:00
Ryan Houdek
21fa93f3b3 Fixes FEXBash with squashfs
FEXBash wasn't setting up a squashfs on its end. This meant that it couldn't find any
x86-64 libraries and would fail
2021-06-17 06:41:07 -07:00
Ryan Houdek
f088d97060
Merge pull request #1093 from lioncash/cast
General: Resolve -Wcast-qual warnings
2021-06-16 23:28:52 -07:00
Lioncash
e369626929 BitUtils: Add BitCast
libc++ doesn't implement std::bit_cast, so we can provide our own for
the time being.
2021-06-17 01:30:07 -04:00
Lioncash
cba4ca7d01 General: Resolve -Wcast-qual warnings
Ensures that qualifiers are preserved on references and pointers to
prevent undefined behavior.
2021-06-17 01:25:39 -04:00
Ryan Houdek
fb7964e6b1
Merge pull request #1092 from lioncash/ignored-qual
General: Resolve -Wignored-qualifiers warnings
2021-06-16 19:52:39 -07:00
Lioncash
ef7aff796f General: Resolve -Wignored-qualifiers warnings
Removes const qualifiers that don't do anything to the interface.
2021-06-16 21:51:45 -04:00
Ryan Houdek
d2771669e6
Merge pull request #1091 from lioncash/unused
Core: Remove unused DefaultFallbackCore
2021-06-16 17:32:56 -07:00
Lioncash
e6e170805e Core: Remove unused DefaultFallbackCore
This doesn't seem to be hooked up to anything.
2021-06-16 19:58:05 -04:00
Ryan Houdek
1f89ca7218
Merge pull request #1090 from lioncash/array
Frontend: Make lookup tables static in MapModRMToReg
2021-06-16 14:44:35 -07:00
Ryan Houdek
adcee99625
Merge pull request #1089 from lioncash/gprsize
Context: Move GPR size retrieval to its own function
2021-06-16 14:03:20 -07:00
Lioncash
a9623f0e2a Frontend: Shrink MapModRMToReg array size from uint64_t to uint32_t
This function only returns a 32-bit value, so we can save some space by
using uint32_t instead.
2021-06-16 16:59:56 -04:00
Lioncash
c40ca14b5b Frontend: Make lookup tables static in MapModRMToReg
Allows clang to emit better code, since it doesn't need to push all the
values onto the stack and off again for every invocation.
2021-06-16 16:47:12 -04:00
Lioncash
100bc4c833 Context: Move GPR size retrieval to its own function
This is repeated in quite a few spots, so we can place it in a utility
function and just call it instead.
2021-06-16 16:14:26 -04:00
Ryan Houdek
a8855a330a
Merge pull request #1088 from lioncash/table
OpcodeDispatcher: Make GPR indices in SyscallOp constexpr
2021-06-16 12:17:18 -07:00
Lioncash
72a625da4a OpcodeDispatcher: Make gpr indices in SyscallOp constexpr
Places them in RO where they can't be modified.

While we're in the area, we can use an alias to prevent duplicated array
types, and also add a static assert to ensure the arrays are always the
same size.

This allows us to avoid needing to bounds check several accesses in a
row that we know will always be successful.
2021-06-16 14:24:45 -04:00
Stefanos Kornilios Mitsis Poiitidis
a67bdddbdc
Merge pull request #1087 from Sonicadvance1/fix_typoe
Fixes typo on extension check for squashfs
2021-06-16 10:03:48 +03:00
Ryan Houdek
8274058895 Fixes typo on extension check for squashfs
Accidentally deleted the period on this
2021-06-15 23:03:46 -07:00
Stefanos Kornilios Mitsis Poiitidis
52426ae9f3
Merge pull request #1086 from Sonicadvance1/support_squashfs
Support Squashfs based rootfs files
2021-06-16 08:50:29 +03:00
Ryan Houdek
4ff3705ff0 Update fusermount location
fuse3 package installs this to /usr/fusermount
Try both locations on failure
2021-06-15 19:50:39 -07:00
Ryan Houdek
e5d3699b26 FEXConfig: Adds support for squashfs files in FEXConfig
Searches the RootFS path in the fex-emu config folder for squashfs files and displays them
Allows easy configuration of squashfs
2021-06-15 19:34:42 -07:00
Ryan Houdek
a5f07f1d01 FEXLoader: Set up the squashfs rootfs in FEXLoader 2021-06-15 19:34:42 -07:00
Ryan Houdek
d4789895a0 Adds a helper function for setting up a squashfs rootfs
This function does everything required for setting up a squashfs as a rootfs.
- Checks if the file is a valid squashfs
- Executes the FEXMountDaemon
- Error checks to ensure it was mounted correctly
- Updates CONFIG_ROOTFS to point to the mounted location
- Takes 200-400ms more startup time
2021-06-15 19:34:42 -07:00
Ryan Houdek
86cbf06778 Adds a FileFormatCheck for checking if a file format is squashfs
This will be used to ensure a squashfs file that is selected is sane
2021-06-15 19:20:19 -07:00
Ryan Houdek
d77a503510 Adds new FEXMountDaemon tool
This is a tool that communicates with FEXLoader/FEXInterpreter to automatically mount
squashfs based rootfs files on execve.

This tool will launch automatically if you have a squashfs based rootfs selected.
Once the rootfs is mounted, it will watch for the parent FEX processe to completely exit.
Once the parent FEX exits it will unmount and cleanup after itself.

This tool has a dependency on your host having FUSE, fusermount, and squashfuse applications.
If anything goes wrong in the bringup process then it propagates the erro up the chain and will
let FEX know that it couldn't mount.
2021-06-15 19:08:54 -07:00
Ryan Houdek
9b4b136121 Move Config.h to ConfigDefines.h
We already have a Config.h which conflicts with this file.
In issue cropped up if you need to include Config.h (the generated one)
from inside Common/ then it would only pull the Common/Config.h file.

Just change the name to not be confusing
2021-06-15 19:06:49 -07:00
Stefanos Kornilios Mitsis Poiitidis
779aca7e95
Merge pull request #1085 from Sonicadvance1/transparent_huge_pages
Enables transparent huge pages in our 64-bit VA allocator
2021-06-14 17:04:40 +03:00
Stefanos Kornilios Mitsis Poiitidis
3252f793df
Merge pull request #1084 from Sonicadvance1/cleanup_stacks_after_fork
Core: After fork make sure to cleanup stacks
2021-06-14 17:03:49 +03:00
Stefanos Kornilios Mitsis Poiitidis
9635b34450
Merge pull request #1083 from Sonicadvance1/more_cpuid_fixes
CPUID: Improvements to have a more sane configuration
2021-06-14 10:14:34 +03:00
Stefanos Kornilios Mitsis Poiitidis
afd35be91f
Merge pull request #1082 from Sonicadvance1/remove_numa_really
Removes more libnuma references
2021-06-14 10:12:35 +03:00