PROLEAD
A Probing-Based Leakage Detection Tool for Hardware and Software
Loading...
Searching...
No Matches
Projects
PROLEAD
inc
Software
mulator
instruction_decoder.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
Software/mulator/instruction.h
"
4
#include "
Software/mulator/return_codes.h
"
5
#include <tuple>
6
7
namespace
mulator
8
{
9
10
class
InstructionDecoder
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
*/
22
InstructionDecoder
(
Architecture
arch);
23
24
/*
25
* Get the architecture this decoder was instantiated for.
26
*/
27
Architecture
get_architecture
()
const
;
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
mulator::InstructionDecoder
Definition:
instruction_decoder.h:11
mulator::InstructionDecoder::decode_instruction
std::pair< ReturnCode, Instruction > decode_instruction(u32 address, const u8 *bytes, u32 code_size, bool in_IT_block, bool last_in_IT_block)
mulator::InstructionDecoder::get_instruction_size
static u8 get_instruction_size(const u8 *bytes)
mulator::InstructionDecoder::InstructionDecoder
InstructionDecoder(Architecture arch)
mulator::InstructionDecoder::get_architecture
Architecture get_architecture() const
instruction.h
mulator
Definition:
architectures.h:7
mulator::u32
uint32_t u32
Definition:
types.h:12
mulator::Architecture
Architecture
Definition:
architectures.h:10
mulator::u8
uint8_t u8
Definition:
types.h:10
return_codes.h
Generated by
1.9.6