mirror of
https://github.com/pound-emu/ballistic.git
synced 2026-01-31 01:15:21 +01:00
decoder: rewrite docs for cdoc
Signed-off-by: Ronald Caesar <github43132@proton.me>
This commit is contained in:
@@ -18,55 +18,40 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/// Represents static metadata aasociated with a specific ARM instruction.
|
||||||
* @brief Represents static metadata associated with a specific ARM32
|
|
||||||
* instruction.
|
|
||||||
*/
|
|
||||||
BAL_ALIGNED(32) typedef struct
|
BAL_ALIGNED(32) typedef struct
|
||||||
{
|
{
|
||||||
/*!
|
/// The instruction mnemonic.
|
||||||
* @brief The instruction mnemonic (e.g., "ADD", "LDR").
|
|
||||||
*/
|
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
/*!
|
/// A bitmask indicating which bits in the instruction word are
|
||||||
* @brief The bitmask indicating which bits in the instruction word are
|
/// significant for decoding.
|
||||||
* significant.
|
///
|
||||||
*
|
/// A value of `1` indicates a fixed bit used for identification,
|
||||||
* @details 1 = significant bit, 0 = variable field (register,
|
/// while `0` indicates a variable field (e.g, imm, shamt, Rn).
|
||||||
* immediate, etc.).
|
|
||||||
*/
|
|
||||||
uint32_t mask;
|
uint32_t mask;
|
||||||
|
|
||||||
/*!
|
/// The expected pattern of the instruction after applying the `mask`.
|
||||||
* @brief The expected value of the instruction after applying the mask.
|
/// `(instruction & mask) == expected`.
|
||||||
* @details (instruction & mask) == expected.
|
|
||||||
*/
|
|
||||||
uint32_t expected;
|
uint32_t expected;
|
||||||
|
|
||||||
/*!
|
/// The IR opcode equivalent to this instruction's mnemonic.
|
||||||
* @brief The IR opcode equivalent to this instruction's mnemonic.
|
|
||||||
*/
|
|
||||||
bal_opcode_t ir_opcode;
|
bal_opcode_t ir_opcode;
|
||||||
|
|
||||||
|
/// Padding to maintain 32 byte alignment.
|
||||||
char _pad[8];
|
char _pad[8];
|
||||||
} bal_decoder_instruction_metadata_t;
|
} bal_decoder_instruction_metadata_t;
|
||||||
|
|
||||||
/*!
|
/// Decodes a raw ARM64 instruction.
|
||||||
* @brief Decodes a raw ARM64 instruction.
|
///
|
||||||
*
|
/// Returns a pointer to [`bal_decoder_instruction_metadata_t`] describing
|
||||||
* @details
|
/// the instruction if a match is found, or `NULL` if the instruction is
|
||||||
* Performs a hash lookup on the provided instruction word to find a
|
/// invalid.
|
||||||
* matching definition.
|
///
|
||||||
*
|
/// # Safety
|
||||||
* @param[in] instruction The raw ARM64 machine code to decode.
|
///
|
||||||
*
|
/// The pointer refers to static readonly memory. It is valid for the
|
||||||
* @return A pointer to the instruction metadata if a match is found.
|
/// lifetime of the program and must not be freed.
|
||||||
* @return `NULL` if the instruction is undefined or invalid.
|
|
||||||
*
|
|
||||||
* @post The returned pointer (if not null) points to static read-only
|
|
||||||
* memory.
|
|
||||||
*/
|
|
||||||
BAL_HOT const bal_decoder_instruction_metadata_t *bal_decoder_arm64_decode(
|
BAL_HOT const bal_decoder_instruction_metadata_t *bal_decoder_arm64_decode(
|
||||||
const uint32_t instruction);
|
const uint32_t instruction);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user