diff options
Diffstat (limited to 'disasm.h')
-rw-r--r-- | disasm.h | 41 |
1 files changed, 32 insertions, 9 deletions
@@ -11,16 +11,39 @@ enum class TracedNodeType { kData, }; -constexpr size_t kMnemonicBufferSize{10}; -constexpr size_t kArgsBufferSize{50}; +constexpr size_t kRefsCountPerBuffer = 10; + +constexpr size_t kMnemonicBufferSize = 8; +constexpr size_t kArgsBufferSize = 64; +constexpr size_t kMarkBufferSize = 64; + +struct ReferenceNode { + ReferenceNode *next{}; + uint32_t refs[kRefsCountPerBuffer]; + uint32_t refs_count{}; +}; struct DisasmNode { - TracedNodeType type{}; - uint32_t offset{}; - size_t size{kInstructionSizeStepBytes}; // Instruction size in bytes + const TracedNodeType type{}; + /// Absolute offset of the instruction (PC value basically) + const uint32_t offset{}; + /// Instruction size in bytes + size_t size{kInstructionSizeStepBytes}; + /// Indicates whether `branch_addr` should be interpreted bool has_branch_addr{}; - uint32_t branch_addr{}; // Absolute address of where to branch to - char mnemonic[kMnemonicBufferSize]{}; // Mnemonic of the instruction at the current offset - char arguments[kArgsBufferSize]{}; // Formatted arguments of the instruction - void Disasm(const DataBuffer &code); + /// Absolute address of where to branch to + uint32_t branch_addr{}; + /// Mnemonic of the instruction at the current offset + char mnemonic[kMnemonicBufferSize]{}; + /// Formatted arguments of the instruction; + char arguments[kArgsBufferSize]{}; + /// Additional instruction specific info to put in a comment + char additional[kArgsBufferSize]{}; + /// Additional instruction specific info to put in a comment + ReferenceNode *ref_by{}; + ReferenceNode *last_ref_by{}; + void Disasm(const DataBuffer &code, const Settings&); + void AddReferencedBy(uint32_t offset); + ~DisasmNode(); +private: }; |