mirror of
https://github.com/pound-emu/pound.git
synced 2025-12-19 04:37:03 +00:00
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>
This commit is contained in:
parent
2e2b5df20c
commit
a0ed4382a5
5 changed files with 308 additions and 337 deletions
|
|
@ -7,22 +7,14 @@
|
|||
|
||||
namespace pound::jit::decoder
|
||||
{
|
||||
typedef uint32_t arm32_opcode_t;
|
||||
typedef uint32_t arm32_instruction_t;
|
||||
|
||||
typedef struct arm32_decoder arm32_decoder_t;
|
||||
typedef void (*arm32_handler_fn)(arm32_decoder_t* decoder, arm32_instruction_t instruction);
|
||||
typedef void (*arm32_handler_fn)(arm32_decoder_t* decoder, uint32_t instruction);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* name;
|
||||
arm32_opcode_t mask;
|
||||
arm32_opcode_t expected;
|
||||
arm32_handler_fn handler;
|
||||
|
||||
/* Use to order instructions in the lookup table. The more specific
|
||||
* instructions are checked first */
|
||||
uint8_t priority;
|
||||
uint32_t mask;
|
||||
uint32_t expected;
|
||||
} arm32_instruction_info_t;
|
||||
|
||||
struct arm32_decoder
|
||||
|
|
@ -31,23 +23,11 @@ struct arm32_decoder
|
|||
arm32_instruction_info_t* instructions;
|
||||
size_t instruction_count;
|
||||
size_t instruction_capacity;
|
||||
|
||||
struct
|
||||
{
|
||||
arm32_instruction_info_t** bucket;
|
||||
size_t count;
|
||||
size_t capacity;
|
||||
} lookup_table[4096]; /* 2^12 entries. */
|
||||
};
|
||||
|
||||
extern arm32_decoder_t g_arm32_decoder;
|
||||
|
||||
void arm32_init(pound::host::memory::arena_t allocator, arm32_decoder_t* decoder);
|
||||
|
||||
void arm32_add_instruction(arm32_decoder_t* decoder, const char* name, arm32_opcode_t mask, arm32_opcode_t expected,
|
||||
arm32_handler_fn handler);
|
||||
void arm32_ADD_imm_handler(arm32_decoder_t* decoder, arm32_instruction_t instruction);
|
||||
|
||||
|
||||
} // namespace pound::jit::decoder
|
||||
#endif // POUND_JIT_DECODER_ARM32_H
|
||||
arm32_instruction_info_t* arm32_decode(arm32_decoder_t* decoder, uint32_t instruction);
|
||||
}
|
||||
#endif // POUND_JIT_DECODER_ARM32_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue