See FEXCore/Readme.md for more details
- Splatter: a code generator backend that concaternates configurable macros instead of doing isel
- IR: Intermediate Representation, our high-level opcode representation, loosely modeling arm64
- SSA: Single Static Assignment, a form of representing IR in memory
- Basic Block: A block of instructions with no control flow, terminated by control flow
- Fragment: A Collection of basic blocks, possibly an entire guest function or a subset of it
IR to host code generation
- ALUOps.cpp
- Arm64Relocations.cpp: relocation logic of the arm64 splatter backend
- AtomicOps.cpp
- BranchOps.cpp
- ConversionOps.cpp
- EncryptionOps.cpp
- FlagOps.cpp
- JIT.cpp: Main glue logic of the arm64 splatter backend
- JITClass.h
- MemoryOps.cpp
- MiscOps.cpp
- MoveOps.cpp
- VectorOps.cpp
- ALUOps.cpp
- AtomicOps.cpp
- BranchOps.cpp
- ConversionOps.cpp
- EncryptionOps.cpp
- F80Ops.cpp
- FlagOps.cpp
- MemoryOps.cpp
- MiscOps.cpp
- MoveOps.cpp
- VectorOps.cpp
- ALUOps.cpp
- AtomicOps.cpp
- BranchOps.cpp
- ConversionOps.cpp
- EncryptionOps.cpp
- FlagOps.cpp
- JIT.cpp: Main glue logic of the x86-64 splatter backend
- JITClass.h
- MemoryOps.cpp
- MiscOps.cpp
- MoveOps.cpp
- VectorOps.cpp
- x64Relocations.cpp: relocation logic of the x86-64 splatter backend
- Frontend.cpp: Extracts instruction & block meta info, frontend multiblock logic
Metadata that drives the frontend x86/64 decoding
- BaseTables.cpp
- DDDTables.cpp
- EVEXTables.cpp
- H0F38Tables.cpp
- H0F3ATables.cpp
- PrimaryGroupTables.cpp
- SecondaryGroupTables.cpp
- SecondaryModRMTables.cpp
- SecondaryTables.cpp
- VEXTables.cpp
- X86Tables.h
- X87Tables.cpp
- XOPTables.cpp
- X86Tables.cpp
- Crypto.cpp: Handles x86/64 Crypto instructions to IR
- Flags.cpp: Handles x86/64 flag generation
- Vector.cpp: Handles x86/64 Vector instructions to IR
- X87.cpp: Handles x86/64 x87 to IR
- X87F64.cpp: Handles x86/64 x87 to IR
- OpcodeDispatcher.cpp: Handles x86/64 ops to IR, no-pf opt, local-flags opt
Logic that binds various parts together
- LookupCache.cpp: Stores information about blocks, and provides C++ implementations to lookup the blocks
Emulation mainloop related glue logic
- Core.cpp: Glues Frontend, OpDispatcher and IR Opts & Compilation, LookupCache, Dispatcher and provides the Execution loop entrypoint
- GdbServer.cpp: Provides a gdb interface to the guest state
- GdbServer.h
FEXCore side of thunks: Registration, Lookup
- X86HelperGen.cpp: Guest-side assembly helpers used by the backends
- X86HelperGen.h
IR -> Text
C++ Functions to generate IR. See IR.json for spec.
IR to IR Optimization
- PassManager.cpp: Defines which passes are run, and runs them
- PassManager.h
- ConstProp.cpp: ConstProp, ZExt elim, addressgen coalesce, const pooling, fcmp reduction, const inlining
- DeadCodeElimination.cpp
- DeadContextStoreElimination.cpp: Transforms ContextLoad/Store to temporaries, similar to mem2reg
- DeadStoreElimination.cpp: Cross block store-after-store elimination
- IRCompaction.cpp: Sorts the ssa storage in memory, needed for RA and others
- IRValidation.cpp: Sanity checking pass
- LongDivideRemovalPass.cpp: Long divide elimination pass
- PhiValidation.cpp: Sanity checking pass
- RedundantFlagCalculationElimination.cpp: This is not used right now, possibly broken
- RegisterAllocationPass.cpp
- RegisterAllocationPass.h
- SyscallOptimization.cpp: Removes unused arguments if known syscall number
- ValueDominanceValidation.cpp: Sanity Checking
Text -> IR
- CPUID.cpp: Handles presented capability bits for guest cpu
- Crypto.cpp: Handles x86/64 Crypto instructions to IR
- Flags.cpp: Handles x86/64 flag generation
- Vector.cpp: Handles x86/64 Vector instructions to IR
- X87.cpp: Handles x86/64 x87 to IR
- X87F64.cpp: Handles x86/64 x87 to IR
- OpcodeDispatcher.cpp: Handles x86/64 ops to IR, no-pf opt, local-flags opt
See ThunkLibs/README.md for more details
These are generated + glue logic 1:1 thunks unless noted otherwise
- libEGL_Guest.cpp: Depends on glXGetProcAddress thunk
- libEGL_Host.cpp
- libGL_Guest.cpp: Handles glXGetProcAddress
- libGL_Host.cpp: Uses glXGetProcAddress instead of dlsym
- libSDL2_Guest.cpp: Handles sdlglproc, dload, stubs a few log fns
- libSDL2_Host.cpp
- libVDSO_Guest.cpp: Linux VDSO thunking
- libX11_Guest.cpp: Handles callbacks and varargs
- libX11_Host.cpp: Handles callbacks and varargs
- libXext_Guest.cpp
- libXext_Host.cpp
- libXfixes_Guest.cpp
- libXfixes_Host.cpp
- libXrender_Guest.cpp
- libXrender_Host.cpp
- Guest.cpp: Handles allocations between guest and host thunks
- Host.cpp: Handles allocations between guest and host thunks
- Guest.cpp: Delays malloc symbol replacement until it is safe to run constructors
- Host.cpp: Allows FEX to export allocation symbols
- FEXLoader.cpp: Glues the ELF loader, FEXCore and LinuxSyscalls to launch an elf under fex
- IRLoader.cpp: Used to run IR Tests
- TestHarnessRunner.cpp: Used to run Assembly tests
- UnitTestGenerator.cpp: Brute forces generation of tests for x86/64, incomplete, unused right now
Linux syscall emulation, marshaling and passthrough
- EmulatedFiles.cpp: Emulated /proc/cpuinfo, version, osrelease, etc
- EmulatedFiles.h
- FileManagement.cpp: Rootfs overlay logic
- FileManagement.h
- SignalDelegator.cpp: Handles host -> host and host -> guest signal routing, emulates procmask & co
- SignalDelegator.h
- Syscalls.cpp: Glue logic, brk allocations
- Syscalls.h: Glue logic, STRACE magic
- SyscallsSMCTracking.cpp: SMC/MMan Tracking
- SyscallsVMATracking.cpp: VMA Tracking
Syscall implementations shared between x86 and x86-64
- EPoll.cpp
- FD.cpp
- FS.cpp
- IO.cpp
- IOUring.cpp
- Info.cpp
- Key.cpp
- Memory.cpp
- Msg.cpp
- Namespace.cpp
- NotImplemented.cpp
- SHM.cpp
- Sched.cpp
- Semaphore.cpp
- Signals.cpp
- Socket.cpp
- Stubs.cpp
- Thread.cpp
- Thread.h
- Time.cpp
- Timer.cpp
x86-32 specific syscall implementations
- EPoll.cpp
- FD.cpp
- FS.cpp
- IO.cpp
- Info.cpp
- Memory.cpp
- Msg.cpp
- NotImplemented.cpp
- Sched.cpp
- Semaphore.cpp
- Signals.cpp
- Socket.cpp
- Stubs.cpp
- Syscalls.cpp
- Syscalls.h
- SyscallsEnum.h
- Thread.cpp
- Thread.h
- Time.cpp
- Timer.cpp
- Types.h
x86-64 specific syscall implementations
- EPoll.cpp
- FD.cpp
- IO.cpp
- Info.cpp
- Ioctl.cpp
- Memory.cpp
- Msg.cpp
- NotImplemented.cpp
- Sched.cpp
- Semaphore.cpp
- Signals.cpp
- Socket.cpp
- Syscalls.cpp
- Syscalls.h
- SyscallsEnum.h
- Thread.cpp
- Thread.h
- Time.cpp
- Types.h
See unittests/Readme.md for more details