PROLEAD
A Probing-Based Leakage Detection Tool for Hardware and Software
Loading...
Searching...
No Matches
instruction_decoder.h
Go to the documentation of this file.
1#pragma once
2
5#include <tuple>
6
7namespace mulator
8{
9
11 {
12 public:
13 /*
14 * Returns the size (2 or 4 bytes) of the instruction starting with the given bytes.
15 * The supplied array has to be at least 2 bytes long.
16 */
17 static u8 get_instruction_size(const u8* bytes);
18
19 /*
20 * Constructs a new decoder for the given architecture.
21 */
23
24 /*
25 * Get the architecture this decoder was instantiated for.
26 */
28
29 /*
30 * Decodes an instruction from the byte stream.
31 * If decoding was not successful, the returned instruction will still be filled with as much correct information as possible.
32 *
33 * @param[in] address - the logical address of the current instruction
34 * @param[in] bytes - a pointer to the first byte of the instruction
35 * @param[in] code_size - the number of remaining bytes in the byte stream
36 * @param[in] in_IT_block - indicates whether the instruction is to be decoded as if execution is currently in an If-Then (IT) block
37 * @param[in] last_in_IT_block - indicates whether the instruction is the last one in an If-Then (IT) block
38 *
39 * @returns A pair of return code and decoded instruction. Only for return code "OK" the instruction was decoded from valid Assembly.
40 */
41 std::pair<ReturnCode, Instruction> decode_instruction(u32 address, const u8* bytes, u32 code_size, bool in_IT_block, bool last_in_IT_block);
42
43 private:
44 Architecture m_arch;
45 std::string m_error_message;
46 };
47
48} // namespace mulator
std::pair< ReturnCode, Instruction > decode_instruction(u32 address, const u8 *bytes, u32 code_size, bool in_IT_block, bool last_in_IT_block)
static u8 get_instruction_size(const u8 *bytes)
InstructionDecoder(Architecture arch)
Architecture get_architecture() const
uint32_t u32
Definition: types.h:12
uint8_t u8
Definition: types.h:10