-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathppc.py
More file actions
52 lines (43 loc) · 1018 Bytes
/
ppc.py
File metadata and controls
52 lines (43 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""PowerPC architecture definition."""
from arch.base_arch import BaseArch, FlagRegister
class PPC(BaseArch):
"""
These are currently hardcoded for PowerPC.
"""
bits = 32
gpr_registers = [
"r0",
"r1",
"r2",
"r3",
"r4",
"r5",
"r6",
"r7",
"r8",
"r9",
"r10",
"r11",
"r12",
"r13",
"pc", # program counter
"msr", # machine state register
"lr", # link register
"ctr", # counter
]
gpr_key = "general purpose"
_xer_register_bit_masks = {
"summary_overflow": 0x80000000,
"overflow": 0x40000000,
"carry": 0x20000000,
}
_cr_register_bit_masks = {
"cr0_lt": 0x80000000,
"cr0_gt": 0x40000000,
"cr0_eq": 0x20000000,
"cr0_so": 0x10000000,
}
flag_registers = [
FlagRegister("cr", _cr_register_bit_masks),
FlagRegister("xer", _xer_register_bit_masks),
]