fxos/include/fxos/disassembly.h

44 lines
1.1 KiB
C++

//---
// fxos.disassembly: Disassembler
//---
#ifndef LIBFXOS_DISASSEMBLY_H
#define LIBFXOS_DISASSEMBLY_H
#include <fxos/lang.h>
#include <fxos/semantics.h>
#include <vector>
#include <optional>
namespace FxOS {
/* Register an instruction.
@inst Instruction with [opcode] set to the binary pattern
Typically this is called by loader functions from data tables describing
instructions with parameters, not manually. See <fxos/load.h>. */
void register_instruction(Instruction ins);
/* A loaded instruction with all relevant information, and more. */
class LoadedInstruction
{
private:
/* What instruction it is */
Instruction &m_inst;
/* Operands for arguments, if they have been determined */
// std::vector<std::optional<Operand>> args;
/* Jump targets, used for jump instructions only. The first jmp is for
unconditional jumps; jmpt and jmpf are for conditional jumps. In
many situations the jump is forced on a general instruction by a
preceding branch due to the delay slot mechanism. */
union { uint32_t jmp, jmpt; };
uint32_t jmpf;
};
} /* namespace FxOS */
#endif /* LIBFXOS_DISASSEMBLY_H */