ROSE
0.9.6a
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
DisassemblerArm.h
Go to the documentation of this file.
1
/* Disassembly specific to the ARM architecture. */
2
3
#ifndef ROSE_DISASSEMBLER_ARM_H
4
#define ROSE_DISASSEMBLER_ARM_H
5
7
class
DisassemblerArm
:
public
Disassembler
{
8
public
:
9
DisassemblerArm
()
10
:
decodeUnconditionalInstructions
(true),
ip
(0),
insn
(0),
cond
(arm_cond_unknown) {
11
init
();
12
}
13
14
DisassemblerArm
(
const
DisassemblerArm
& other)
15
:
Disassembler
(other),
decodeUnconditionalInstructions
(other.
decodeUnconditionalInstructions
),
16
ip
(other.
ip
),
insn
(other.
insn
),
cond
(other.
cond
) {
17
}
18
19
virtual
~DisassemblerArm
() {}
20
21
virtual
Disassembler
*
clone
()
const
{
22
return
new
DisassemblerArm
(*
this
);
23
}
24
26
virtual
bool
can_disassemble
(
SgAsmGenericHeader
*)
const
;
27
29
virtual
SgAsmInstruction
*
disassembleOne
(
const
MemoryMap
*map,
rose_addr_t
start_va,
AddressSet
*successors=NULL);
30
32
virtual
void
assembleOne
(
SgAsmInstruction
*,
SgUnsignedCharList
&) {abort();}
33
35
virtual
SgAsmInstruction
*
make_unknown_instruction
(
const
Exception&);
36
37
private
:
41
class
ExceptionArm
:
public
Exception {
42
public
:
43
ExceptionArm
(
const
std::string &mesg,
const
DisassemblerArm
*d,
size_t
bit=0)
44
: Exception(mesg, d->
ip
) {
45
/* Convert four-byte instruction to little-endian buffer. FIXME: assumes little-endian ARM system */
46
bytes.push_back(d->
insn
& 0xff);
47
bytes.push_back((d->
insn
>>8) & 0xff);
48
bytes.push_back((d->
insn
>>16) & 0xff);
49
bytes.push_back((d->
insn
>>24) & 0xff);
50
this->bit = bit;
51
}
52
};
53
54
static
SgAsmArmInstruction
*
makeInstructionWithoutOperands
(uint32_t address,
const
std::string& mnemonic,
int
condPos,
55
ArmInstructionKind kind, ArmInstructionCondition
cond
,
56
uint32_t
insn
);
57
SgAsmArmRegisterReferenceExpression
*
makeRegister
(uint8_t reg)
const
;
58
SgAsmArmRegisterReferenceExpression
*
makePsrFields
(
bool
useSPSR, uint8_t fields)
const
;
59
SgAsmArmRegisterReferenceExpression
*
makePsr
(
bool
useSPSR)
const
;
60
61
SgAsmExpression
*
makeRotatedImmediate
()
const
;
62
SgAsmExpression
*
makeShifterField
()
const
;
63
SgAsmArmInstruction
*
makeDataProcInstruction
(uint8_t opcode,
bool
s,
SgAsmExpression
* rn,
SgAsmExpression
* rd,
64
SgAsmExpression
* rhsOperand);
65
SgAsmIntegerValueExpression
*
makeSplit8bitOffset
()
const
;
66
SgAsmIntegerValueExpression
*
makeBranchTarget
()
const
;
67
SgAsmExpression
*
decodeMemoryAddress
(
SgAsmExpression
* rn)
const
;
68
SgAsmArmInstruction
*
decodeMediaInstruction
()
const
;
69
SgAsmArmInstruction
*
decodeMultiplyInstruction
()
const
;
70
SgAsmArmInstruction
*
decodeExtraLoadStores
()
const
;
71
SgAsmArmInstruction
*
decodeMiscInstruction
()
const
;
72
SgAsmArmInstruction
*
disassemble
();
73
75
void
init
();
76
78
void
startInstruction
(
rose_addr_t
start_va, uint32_t c) {
79
ip
= start_va;
80
insn
= c;
81
cond
= arm_cond_unknown;
82
}
83
84
/* Per-instruction data members (mostly set by startInstruction()) */
85
bool
decodeUnconditionalInstructions
;
86
uint32_t
ip
;
87
uint32_t
insn
;
88
ArmInstructionCondition
cond
;
89
};
90
91
#endif
rose-edg4x
src
frontend
Disassemblers
DisassemblerArm.h
Generated on Mon May 5 2014 17:29:21 for ROSE by
1.8.4