Introduces the translation stage fod the ARM32 interpreter and
significantly hardens the application's core logic to meet my high
integrity standards.
- translator.c converts raw ARM32 guest code into an array of
interpreter op-codes
- main.c was completly rewritten to be as safe as possible.
- pmath.h provides safe, checked arithmetic functions to prevent integer
overflow.
- adds binary files in src/ for testing the interpreter.
Signed-off-by: Ronald Caesar <github43132@proton.me>
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>
## Description
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
Just a simple typo in this one README file to adjust.
## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [X] Documentation update
- [ ] Refactoring (no functional change, code cleanup)
- [ ] Performance improvement
## Code Review Process
**IMPORTANT**: This project maintains an extremely high standard for
code quality and correctness. By submitting this pull request, you
acknowledge and agree to the following:
1. **You must be able to defend every single line of code you have added
or modified**
2. **You must be prepared to explain the reasoning behind every design
decision**
3. **You must be able to discuss and justify your approach to solving
the problem**
4. **You must be ready to address all feedback and make requested
changes**
5. **You must have thoroughly tested your changes and be confident in
their correctness**
The code review process for this project is intentionally tedious and
thorough. Do not submit a pull request unless you are prepared to defend
your PR changes.
## Breaking Changes
If this change introduces any breaking changes, please describe them
here.
## Checklist
- [X] My code follows the project's coding style guidelines
- [X] I have commented my code, particularly in hard-to-understand areas
- [X] I have made corresponding changes to the documentation
- [X] My changes generate no new warnings
- [X] I have read the project's CONTRIBUTING guidelines
- [X] I understand and agree to the rigorous code review process
described above
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>