mirror of
https://github.com/pound-emu/pound.git
synced 2025-12-14 07:36:58 +00:00
jit/decoder: move decoder to frontend/decoder
Signed-off-by: Ronald Caesar <github43132@proton.me>
This commit is contained in:
parent
fb7a2a6b32
commit
c235e57071
7 changed files with 7 additions and 7 deletions
34
src/jit/frontend/decoder/arm32.c
Normal file
34
src/jit/frontend/decoder/arm32.c
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include "arm32.h"
|
||||
#include "arm32_table_generated.h"
|
||||
#include "common/passert.h"
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define LOG_MODULE "jit"
|
||||
#include "common/logging.h"
|
||||
|
||||
const pvm_jit_decoder_arm32_instruction_info_t *
|
||||
pvm_jit_decoder_arm32_decode (const uint32_t instruction)
|
||||
{
|
||||
/* Extract hash key: Bits [27:20] and [7:4] */
|
||||
const uint32_t major = (instruction >> 20U) & 0xFFU;
|
||||
const uint32_t minor = (instruction >> 4U) & 0xFU;
|
||||
|
||||
const uint16_t index = (uint16_t)((major << 4U) | minor);
|
||||
|
||||
const decode_bucket_t *bucket = &g_decoder_lookup_table[index];
|
||||
|
||||
for (size_t i = 0; i < bucket->count; ++i)
|
||||
{
|
||||
const pvm_jit_decoder_arm32_instruction_info_t *info = bucket->instructions[i];
|
||||
|
||||
if ((instruction & info->mask) == info->expected)
|
||||
{
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_WARNING("Cannot decode instruction 0x%08X", instruction);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue