mirror of
https://github.com/pound-emu/pound.git
synced 2026-01-31 01:15:20 +01:00
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>
75 lines
1.9 KiB
C
75 lines
1.9 KiB
C
/**
|
|
* @file arm32.h
|
|
* @brief A32 Instruction Decoder Interface.
|
|
*
|
|
* @details
|
|
* This module provides the interface for decoding 32-bit ARM instructions
|
|
* into internal metadata structures.
|
|
*
|
|
*/
|
|
|
|
#ifndef POUND_JIT_DECODER_ARM32_H
|
|
#define POUND_JIT_DECODER_ARM32_H
|
|
|
|
#include "arm32_opcodes.h"
|
|
#include <stdint.h>
|
|
|
|
/* Extern C for unit tests. */
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/*! @brief Represents static metadata associated with a specific ARM32
|
|
* instruction. */
|
|
typedef struct
|
|
{
|
|
|
|
/*! @brief The instruction mnemonic (e.g., "ADD", "LDR"). */
|
|
const char *name;
|
|
/*!
|
|
* @brief The raw bitstring representation.
|
|
* @details Used during initialization to calculate mask and expected
|
|
* values.
|
|
*/
|
|
const char *bitstring;
|
|
|
|
/*! @brief The instruction's unique enum identifier. */
|
|
pvm_jit_decoder_arm32_opcode_t opcode;
|
|
|
|
/*!
|
|
* @brief The bitmask indicating which bits in the instruction word are
|
|
* significant.
|
|
* @details 1 = significant bit, 0 = variable field (register, immediate,
|
|
* etc.).
|
|
*/
|
|
uint32_t mask;
|
|
|
|
/*!
|
|
* @brief The expected value of the instruction after applying the mask.
|
|
* @details (instruction & mask) == expected.
|
|
*/
|
|
uint32_t expected;
|
|
} pvm_jit_decoder_arm32_instruction_info_t;
|
|
|
|
/*!
|
|
* @brief Decodes a raw 32-bit ARM instruction.
|
|
*
|
|
* @details
|
|
* Performs a hash lookup on the provided instruction word to find a matching
|
|
* definition.
|
|
*
|
|
* @param[in] instruction The raw 32-bit ARM machine code to decode.
|
|
*
|
|
* @return A pointer to the instruction metadata if a match is found.
|
|
* @return `nullptr` if the instruction is undefined or invalid.
|
|
*
|
|
* @post The returned pointer (if not null) points to static read-only memory.
|
|
*/
|
|
const pvm_jit_decoder_arm32_instruction_info_t *pvm_jit_decoder_arm32_decode(
|
|
const uint32_t instruction);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif // POUND_JIT_DECODER_ARM32_H
|