PROLEAD
A Probing-Based Leakage Detection Tool for Hardware and Software
Loading...
Searching...
No Matches
disassembler.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <string>
6
7namespace mulator
8{
10 {
11 public:
14
15 /*
16 * Getters for internals.
17 */
20
21 /*
22 * Resets the disassembler by clearing the IT state.
23 */
24 void reset();
25
26 /*
27 * Decode and disassemble a single instruction from a byte array.
28 *
29 * @param[in] address - current address
30 * @param[in] code - pointer to the first byte of the instruction
31 * @param[in] code_size - length of the remaining bytes in byte array
32 */
33 ReturnCode disassemble(u32 address, const u8* code, u32 code_size);
34
35 /*
36 * Disassemble a single already decoded instruction.
37 *
38 * @param[in] instr - the instruction to disassemble
39 */
41
42 /*
43 * Getters for disassembled data.
44 */
46 std::string get_mnemonic() const;
47 std::string get_operands() const;
48 std::string get_string() const;
49
50 private:
51 InstructionDecoder m_decoder;
52 u32 m_it_state;
53
54 std::string format_name(const Instruction& instr) const;
55 std::string format_shift(const Instruction& instr) const;
56 std::string format_immediate(u32 value, bool add_flag = true, bool decimal = false, bool print_signed = false) const;
57
58 bool is_load_operation(const Mnemonic& mnemonic) const;
59 bool is_store_operation(const Mnemonic& mnemonic) const;
60 bool is_shift_operation(const Mnemonic& mnemonic) const;
61
62 Instruction m_instruction;
63 std::string m_mnemonic;
64 std::string m_operands;
65
66 bool in_IT_block() const;
67 bool last_in_IT_block() const;
68 Condition pop_IT_condition();
69 };
70
71} // namespace mulator
std::string get_mnemonic() const
Architecture get_architecture() const
Instruction get_instruction() const
ReturnCode disassemble(u32 address, const u8 *code, u32 code_size)
ReturnCode disassemble(Instruction instr)
Disassembler(Architecture arch)
std::string get_string() const
std::string get_operands() const
InstructionDecoder get_decoder() const
uint32_t u32
Definition: types.h:12
uint8_t u8
Definition: types.h:10