jit/decoder: move decoder to frontend/decoder

Signed-off-by: Ronald Caesar <github43132@proton.me>
This commit is contained in:
Ronald Caesar 2025-11-29 15:49:57 -04:00
parent fb7a2a6b32
commit c235e57071
No known key found for this signature in database
GPG key ID: 04307C401999C596
7 changed files with 7 additions and 7 deletions

View 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;
}