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>
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>
Fixes `relevant_mask` calculation in arm32_init() to use bitwise AND
instead of OR. The previous logic incorrectly validated bits outside the
hash region, preventing valid instructions like 'BX` from being added to
the lookup table.
Increased LOOKUP_TABLE_MAX_BUCKET_SIZE from 8 to 16. Instructions with
wildcard bits in the hash region (eg, AND, EOR) must map to multiple
buckets to ensure O(1) lookup.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Rewrites the Arm32 instruction decoder to align with high integrity
software standards such as MISRA C and BARR-C.
Key Architectural Changes:
- Added compile time validation.
- Removed dependency on memory allocator. The decoder now uses
statically allocated global storage.
- Implement a hash-based lookup table to reduce decoding complexity to
O(1).
- Removed decoder_t in favour of a singleton pattern.
- Add documentation stating thread safety, preconditions, and
postconditions for all public functions.
Signed-off-by: Ronald Caesar <github43132@proton.me>
SDL3, ImGUI, and OpenGL are unused dependencies. They will be enabled
once a GUI becomes necessary
Signed-off-by: Ronald Caesar <github43132@proton.me>
Although this is mandated in the Barr C style guide, I find this
specific rule uneccesarry and tedious.
Signed-off-by: Ronald Caesar <github43132@proton.me>
The linked list was implemented to store instructions in a basic block.
Instructions will now be stored in arrays to keep logic simple and
straight-foward.
Signed-off-by: Ronald Caesar <github43132@proton.me>
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>
Xphalnos says:
==============
The memory arena is created but not destroyed at the end of execution.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Introduces jit/ir/value.h, which defines the value_t structure which is
a polymorphic container designed to hold various kinds of data that IR
instructions operate on or produce.
Signed-off-by: Ronald Caesar <github43132@proton.me>
A new header, jit/a32_types.h, defines a32_register_t, an enum for Arm32
general purpose register's R0-R15, including standard aliases for SP,
LR, and PC.
Signed-off-by: Ronald Caesar <github43132@proton.me>
This type is designed to hold various kinds of data that IR instructions
operate on, starting with immediate integer constants.
Signed-off-by: Ronald Caesar <github43132@proton.me>
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>
Munmap can fail if the length argument is 0, and the address being freed
is not a multiple of the host's page size.
Signed-off-by: Ronald Caesar <github43132@proton.me>
Strengthens the decoder's foundation but does not yet implement the core
instruction lookup table logic or the public arm32_decode API. These
will be addressed in future patches.
Signed-off-by: Ronald Caesar <github43132@proton.me>
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>
The mmio will not be touchwd for a couple months while we focus on
executing arm instructions. Once we get to that point this design doc
will be rewritten.
Signed-off-by: Ronald Caesar <github43132@proton.me>