Commit graph

38 commits

Author SHA1 Message Date
Ronald Caesar
b9b62574bf
jit: Implement build-time generation of jit infrastructure
generate_jit_assets.py expands the automatated code generation to
include:

- Opcode enumerations in arm32_opcodes.h.
- Decoder lookup tables in arm32_table.c
- Computed-goto jump tables foe the interpreter in handler_table.inc.

Relocates arm32.inc to src/jit/common/a32_instructions.inc.

Implements the primary execution loop in
src/jit/interpreter/arm32/instruction.c. The code is messy and will be
rewritten in the future.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-12-06 00:31:46 -04:00
Ronald Caesar
e714dc47d0
jit/decoder: rename decoder script
Renames generate_decoder_tests.py to generate_jit_decoder_tests.py.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-12-06 00:16:18 -04:00
Ronald Caesar
d454bea4cc
Convert codebase to C
Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-12-04 07:26:16 -04:00
Ronald Caesar
d1e3919a8c
jit/decoder: Add generated arm32 tests
Introduces the first unit tests for the ARM32 JIT decoder. A new script
automatically generates a test case for every instruction in arm32.inc,
providing 100% of the isa.

This also includes a critical rework of the decoder's lookup table
generation logic. The previous hashing method was flawed, causing
build-time overflows and incorrect instruction matching (shadowing) for
patterns with wildcards. The new algorithm correctly populates the
lookup table.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-11-30 06:14:03 -04:00
Ronald Caesar
2b5131e56c
refactor: Humongous Commit
Major architectural refactorbto focus exclusively on JIT development.

JIT & Decoder Architecture
-    Implemented scripts/generate_jit_decoder_a32_table.py to parse
     instruction definitions at build-time rather than runtime.
-    Moves decoder lookup tables from RAM to ROM.

Scope Reduction:
-    Removed frontend, GUI, and rendering dependencies.
-    delete src/frontend, src/target, and associated design docs.

Most importantly, this commit starts the transition of this codebase
from C++ to C. I cant stand creating C++ code, and since no one else
is contributing to this project this change shouldnt matter.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-11-29 14:53:02 -04:00
Ronald Caesar
04b5af2517 build: Disable most 3rd party dependencies
SDL3, ImGUI, and OpenGL are unused dependencies. They will be enabled
once a GUI becomes necessary

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-11-28 04:04:15 -04:00
Ronald Caesar
21c0f0bdef
Remove PVM folder
The folder will be rewritten once the JIT compiler is completed.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-11-25 22:58:50 -04:00
Ronald Caesar
d6c29e412a
Fix formatting compiler warnings
Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-11-23 04:54:41 -04:00
Ronald Caesar
bd0bf1deba
jit/ir: Implement IR instruction management
Introduces IR instruction management, including instruction_t and
instruction_list_t definitions and their implementations. It also added
const-correctness to the value_t API.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-11-22 22:12:22 -04:00
Ronald Caesar
304aeed9f6
tests/jit: Add IR tests
Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-11-08 16:37:41 -04:00
Ronald Caesar
a57ce183a1
extern/googletest: Add testing library
Need a testing framework to test the IR layer. GoogleTest is a popular
choice so it was chosen.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-11-08 15:41:04 -04:00
Ronald Caesar
a0ed4382a5
jit: Implement arm32 instruction decoding logic
Introduces the core Arm32 decoder, including the instruction parsing
mechanism and an initial set of defined instructions.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-10-26 02:19:35 -04:00
Xphalnos
8c40261fee Revert SDL3 Submodule Update 2025-10-08 13:45:49 +02:00
Xphalnos
328292ce55 Minor Changes
Signed-off-by: Xphalnos <yiga.steam@gmail.com>
2025-10-07 07:47:31 +02:00
Ronald Caesar
ccedf3b251
jit: Instruction decoder temp
Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-10-04 22:17:36 -04:00
Ronald Caesar
9d7b05d6ae
rename kvm references to pvm
The term KVM is missleading because we are not using linux kernel
virtualization. PVM stands for "Pound Virtual Machine" which is more
accurate.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-09-30 18:13:48 -04:00
Ronald Caesar
6bdfd6fcea
Big Commit
The changes affects multiple places in the repo and this one of the rare
instances where I cant be bothered writing a comprehensive commit. Look
at the diff for changes.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-09-27 09:16:49 -04:00
Ronald Caesar
4d363ea3b2 Remove fmt library
This library wasnt used anywhere in the source code.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-09-21 18:37:06 -04:00
Ronald Caesar
f94022057a build: remove commented code
Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-09-21 12:29:02 -04:00
Ronald Caesar
ba82ab5e9b common: add assert framework dedign doc
Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-09-20 20:52:46 -04:00
Ronald Caesar
5b0e750c01 common: Implement logging framework
Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-09-20 20:42:12 -04:00
Ronald Caesar
d0857d83f0 common: Implement logging framework
Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-09-20 04:59:09 -04:00
Ronald Caesar
a3ed44003b build: Refactor CMake build system
This new architecture decomposes the project into several distict static
libraries: common, host, kvm, and frontend.

By using static libraries, changes within one module will only require
that library to be re-linked, rather than recompiling and re-linking the
entire executable.

The third party library ImGui is now built as a static library target.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-09-14 18:40:30 -04:00
Ronald Caesar
8b483849f4 arm64/mem: Refactor guest memory access and made it endian aware
Refactors the core guest memory access subsystem (guest.h) to be safer
and portable accross host systems with different endianness. The
previous implementation used direct pointer casting, which is not endian
safe.

1. All read and write functions have been converted from unsafe pointer
   casts to memcpy(). This resolves alignment warning -Wcast-align.

2. The access functions no longer rely on asserts for error checking.
   They now perform explicit boundary and alignment checking and returns
   a guest_mem_access_result_t status code.

3. A new header (endian.h) provides cross platform byte swapping macros.
   The memory access functions use these macros to ensure that the guest
   always sees memory in the correct endian format, regardless of the
   host's native byte order. The host endianness is now automatically
   detected via CMake.

3. Asserts are now explicitly enabled in release builds to catch
   critical errors.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-09-13 23:14:26 -04:00
Ronald Caesar
c6706dd8a0 kvm: Add framework for machine types and MMIO dispatch
The core of the machine-type support is the new operations table,
kvm_ops_t. This acts as a standard C-style virtual table decoupling the
generic KVM core logic from target specific hardware emualtion. The
kvm_t VM instance now points to an ops table, which defines the
"personality" of the guest. A kvm_probe() factory function has been
added to initialize a kvm_t instance with the correct ops table for a
given machine type (eg, Switch 1).

The ops table's .mmio_read and .mmio_write function pointers are the
link between the armv8 CPU core and this new MMIO dispatcher. When a
physical memory access is determined to be MMIO, the VM will call the
appropriate function pointer, which in turn will use the MMIO dispatcher
to find and execute the correct device handler.

The initial implementation for the Switch 1 target
(targets/switch1/hardware/probe.cpp) is a stub. The bootstrapping
logic will be added in subsequent patches.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-08-24 21:45:32 -04:00
Ronald Caesar
05c4f7025f Major project restructuring
Remove unecessary files and made the tree much more cleaner.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-08-23 17:23:33 -04:00
Ronald Caesar
13b2e741b9 arm64/mem: Add initial software page table walker
Introduce a software-based page table walker for the arm64 MMU
emulation. This is foundational component for handling GVA-GPA
translations when a request missses the (future) software TLB.

For now, it handles only Page descriptors and does not yet support Block
descriptors or permission checks. These will be added in subsequent
patches.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-08-23 02:28:28 -04:00
Ronald Caesar
a62aa833c0 Fix cmake errors
Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-08-23 02:21:51 -04:00
Ronald Caesar
6f5b6b8742 Switch build mode to Debug
I was wondering why my asserts wasn't working.

Signed-off-by: Ronald Caesar <github43132@proton.me>
2025-08-16 21:46:10 -04:00
Carlo Pezzotti
2bb666a088 feat(gui): Extract and modularize GUI system from main.cpp
- Create modular GUI architecture with base Panel class
- Implement GUIManager to handle window lifecycle and panel management
- Add Window wrapper class for SDL3/OpenGL context management
- Create specialized panels:
  - ConsolePanel: Colored log output with timestamps
  - CPUPanel: CPU debugging with tabs for registers, memory, and disassembly
  - PerformancePanel: Real-time FPS and frame time monitoring
- Apply modern dark theme with purple accents
- Add comprehensive menu bar (File, Emulation, View, Tools, Help)
- Update CMakeLists.txt to include new gui/ directory structure
- Refactor main.cpp to use the new GUI system
- Cutom theme on switch colors
2025-07-09 09:07:32 +02:00
Chewico
cda778ff04 Implmented ImGui 2025-06-23 15:58:53 +02:00
Xphalnos
677893b4b7 SDL3 Basic Window 2025-06-20 21:14:51 +02:00
Xphalnos
6104a70822 Update rem (Windows Support) 2025-06-18 21:58:21 +02:00
Xphalnos
a552b11c24 Update rem 2025-06-18 21:02:06 +02:00
¥IGA
1f2af0b19e
Adding REM 3rd_Party (#18) 2025-06-18 18:45:14 +01:00
Xphalnos
436c8d40e5 Adding Pound Icon to Executable 2025-06-18 19:09:53 +02:00
Xphalnos
014b236228 Import Strong Logger & Config System 2025-06-18 18:30:21 +02:00
Xphalnos
548b99e2e3 CMake, Big Cleanup, CI Build and 3rd_Party 2025-06-17 18:51:46 +02:00