Ryan Houdek
3025a10808
FEXCore: Revert literal optimization from #4884
...
This no longer does anything due to #5123
2025-12-22 10:00:55 -08:00
Ryan Houdek
93f6a8cb4d
Merge pull request #5130 from neobrain/feature_code_cache_validation
...
CodeCache: Implement runtime cache validation
2025-12-22 09:17:51 -08:00
Ryan Houdek
fef1993dd7
Merge pull request #5123 from bylaws/whehsajsreloc
...
Guest relocation support
2025-12-22 09:14:03 -08:00
Tony Wasserka
8fcb84112b
CodeCache: Implement runtime cache validation
2025-12-22 17:52:43 +01:00
Billy Laws
aa73cbc8b0
Dispatcher: Silence warning on ARM64EC
2025-12-22 16:22:03 +00:00
Billy Laws
2f4cd33950
Frontend: Fail gracefully upon encountering unexpected relocations
...
As the decoder can occasionally explore non-code (e.g. after a noreturn
call) it must tolerate cases where when doing so a relocation is
encountered.
2025-12-22 16:19:10 +00:00
Billy Laws
bcf48c21eb
Frontend: Support relocated instruction operands when generating caches
...
When relocations are loaded, all immediates read from memory are checked
against the relocation map and transformed into an appropriately
sign-extended entrypoint-relative variant of the specific operands
addressing mode. As almost every case of an unhandled relocation will
lead to a later, likely harder to debug, crash at runtime just bail out
early if any such cases are encountered. Note that while this
handles/detects all cases of relocated immediates, if relocations were
applied to instructions themselves (occurs in some malware variants)
these would be missed without any errors reported.
2025-12-22 16:19:02 +00:00
Billy Laws
9571a1bc30
Frontend: Clip multiblocks to section boundaries when generating caches
...
When compiling code at runtime there is no harm to including jumps to
different sections within a multiblock, when enforcing as such would
introduce a lookup cost for every decode invocation (or some caching).
However when compiling offline as each cache blob is tied to a specific
library these boundaries should be enforced.
2025-12-22 16:19:02 +00:00
Billy Laws
2878583627
OpcodeDispatcher: Support relocated operand type variants
...
In order to support code caching of 32-bit libraries, any library-base
relative relocations on the guest must be transformed into FEX
relocations so e.g. absolute jumps or loads refer to the correct
location when the library is loaded at a different base address.
2025-12-22 16:19:02 +00:00
Tony Wasserka
9e8915ef9e
Merge pull request #5110 from neobrain/feature_nop_padding
...
ARM64Emitter: Force NOP padding to be enabled
2025-12-15 19:03:44 +00:00
Billy Laws
e4816b5849
BranchOps: Use a RIP reloc for TF-checking direct branches
2025-12-15 16:09:17 +00:00
Billy Laws
cf1701f1e1
BranchOps: Use a RIP reloc for EC calls exiting JIT
2025-12-15 16:08:18 +00:00
Tony Wasserka
70eff81f19
CodeCache: Implement cache loading
2025-12-15 16:12:43 +01:00
Tony Wasserka
602ecece50
CodeCache: Clean up OrderedContainer checks
2025-12-15 12:21:41 +01:00
Changwei Miao
98f66d5028
LookupCache: Fix mistake in nested CacheBlockMapping call
...
Signed-off-by: Changwei Miao <chanthmiao@outlook.com >
2025-12-14 15:43:38 +08:00
Tony Wasserka
e849c1b702
ARM64Emitter: Force NOP padding to be enabled
...
When loading code caches, these constants get patched up for the new guest
address. The new value may be larger than the original, so the padding bytes
ensure the maximum of 16 bytes of encoding space is always available.
2025-12-10 23:29:43 +01:00
Ryan Houdek
2a5c1684de
AllocatorHooks: Add missing header
2025-12-07 10:08:59 -08:00
Ryan Houdek
f7eedc1f06
JIT: Fixes typo
...
A previous PR fixed this in the generated SourceOutline.md file. Add the
typo fix back in the file that generates it.
2025-12-05 17:12:24 -08:00
Ryan Houdek
d0e47f9073
Merge pull request #5096 from neobrain/feature_fexofflinecompiler
...
CodeCache: Implement offline compiler for cache generation
2025-12-05 14:47:58 -08:00
Ryan Houdek
4fd1a35b2a
CMake: Disable some installs when building for Steam
2025-12-04 14:02:42 -08:00
Tony Wasserka
983802da61
CodeCache: Add offline compiler for generating caches
2025-12-04 19:16:51 +01:00
Tony Wasserka
49273e0d59
CodeCache: Add workaround for clang-15's broken std::piecewise_construct
2025-12-04 19:16:51 +01:00
Ryan Houdek
9f584c8014
SVE256: Fixes AVX scalar round with insert
...
We were using the incorrect source registers on SVE256 implementation of
these instructions.
Fixes #5100
2025-12-04 01:43:07 -08:00
Ryan Houdek
90c8fcf393
Merge pull request #5094 from pmatos/fix/issue5084
...
Set current code block in x87 pass
2025-12-02 14:43:54 -08:00
Tony Wasserka
994613260c
CodeCache: Support reverse application of relocations
...
This allows code to be serialized consistently across runs.
2025-12-02 22:27:53 +01:00
Tony Wasserka
1430fa8220
CodeCache: Move ApplyCodeRelocations
2025-12-02 18:38:59 +01:00
Tony Wasserka
33e06058c6
JIT: Move ApplyRelocations to CodeCache
2025-12-02 18:38:59 +01:00
Tony Wasserka
b032d1e1f7
JIT: Make relocations relative to guest base before serialization
...
This ensures consistency of generated code caches across multiple runs.
2025-12-02 18:38:59 +01:00
Tony Wasserka
d6b43b1fe6
Dispatcher: Add public interface to query ExitFunctionLinkerAddress
2025-12-02 17:56:56 +01:00
Paulo Matos
f91ac09f87
Set current code block in x87 pass
...
This resets the constant pool in IREmit used by SelectAddressMode().
Fixes #5084 .
2025-12-02 15:33:08 +01:00
Ryan Houdek
e4fa399412
Merge pull request #5091 from neobrain/feature_better_relocations
...
JIT: Prepare FEX relocations for code caching
2025-12-01 13:21:29 -08:00
Tony Wasserka
952e949e10
JIT: Clean up block tail writing code
2025-12-01 20:13:51 +01:00
Tony Wasserka
3d093d66fb
JIT: Change relocation offset base to CodeBuffer start
2025-12-01 20:13:51 +01:00
Tony Wasserka
05fe2893c7
JIT: Emit relocation from IROP_THUNK
2025-12-01 20:13:51 +01:00
Tony Wasserka
6fc17294b6
JIT: Add relocation for guest RIP stored in jump thunks
2025-12-01 20:13:51 +01:00
Tony Wasserka
6607921bee
JIT: Add relocation for guest RIP stored in block tail
2025-12-01 20:13:51 +01:00
Tony Wasserka
0b0793438f
JIT: Add relocation for constants relative to the guest entrypoint
2025-12-01 20:13:51 +01:00
LC
f290d2f899
Merge pull request #5090 from neobrain/refactor_3waycomp
...
IR: Replace hand-written operators with three-way comparison
2025-12-01 14:05:04 -05:00
Tony Wasserka
a676ad7193
JIT: Add explicit padding to relocation descriptors
...
This ensures zero-initialization, which is required to make code cache
generation produce consistent results.
Also consolidated header fields.
2025-12-01 19:28:39 +01:00
Tony Wasserka
096c408ef6
IR: Replace hand-written operators with three-way comparison
2025-12-01 17:10:06 +01:00
Ryan Houdek
39fb266282
Merge pull request #5087 from neobrain/refactor_simpler_calls
...
OpcodeDispatcher: Simplify convoluted logic for computing call offsets
2025-11-28 10:10:22 -08:00
Tony Wasserka
439c6bb3c0
OpcodeDispatcher: Simplify convoluted logic for computing call offsets
2025-11-28 11:32:11 +01:00
Tony Wasserka
5cedbf9d34
LookupCache: Fix use of invalidated iterators
2025-11-28 11:29:46 +01:00
LC
a12b8927bc
Merge pull request #5076 from Sonicadvance1/5
...
Utils/WritePriorityMutex: Support being forkable
2025-11-27 20:38:37 -05:00
Billy Laws
547135dc2d
JIT: Fix indirect delinker branch distance
...
This is in insts not bytes.
2025-11-27 14:42:56 +00:00
Ryan Houdek
1cffe618d2
CPUID: Fixes #5033
...
This leaf changed to being non-constant on that PR since CPUID function
1h returns APICID now.
2025-11-25 11:25:36 -08:00
Ryan Houdek
f423b110a8
Utils/WritePriorityMutex: Support being forkable
...
This will be useful to fix the mutex locking mess that occurs currently
when forks occur. Instead of needing to be /very/ meticulous with many
futexes, we can instead have working threads shared_lock this one, then
when a fork occurs just only have the forker themselves unique_lock and
let the readers drain out. Since it's write-priority it'll happen quite
quickly, letting the fork get in and out relatively easily.
This is going to take some massaging to get the frontend and FEXCore to
a place that this works but we can get this simple change in early.
2025-11-24 11:50:20 -08:00
Tony Wasserka
e2f4065376
Merge pull request #5065 from Sonicadvance1/1
...
FEXCore/CodeCache: Move spin-loop over to a WFE loop
2025-11-21 14:21:45 +01:00
Ryan Houdek
d3bf87f4f4
Merge pull request #4985 from Sonicadvance1/fex-atomic
...
Support (downstream) kernel-side unaligned atomic handling (The rebase sequel)
2025-11-20 17:09:29 -08:00
Ryan Houdek
6d351ec47f
FEXCore/CodeCache: Moves spin-loop in to a WFE loop
...
Saves power and responds faster. Pass in the atomic to `WaitPred` with
the predicate checking if the buffer has been flushed yet. Same
behaviour as previous code but more efficient on our hardware.
2025-11-20 14:23:01 -08:00