Rizin
unix-like reverse engineering framework and cli tools
ppc.py
Go to the documentation of this file.
1 # Capstone Python bindings, by Nguyen Anh Quynnh <aquynh@gmail.com>
2 
3 import ctypes
4 from . import copy_ctypes_list
5 from .ppc_const import *
6 
7 # define the API
8 class PpcOpMem(ctypes.Structure):
9  _fields_ = (
10  ('base', ctypes.c_uint),
11  ('disp', ctypes.c_int32),
12  )
13 
14 class PpcOpCrx(ctypes.Structure):
15  _fields_ = (
16  ('scale', ctypes.c_uint),
17  ('reg', ctypes.c_uint),
18  ('cond', ctypes.c_uint),
19  )
20 
21 class PpcOpValue(ctypes.Union):
22  _fields_ = (
23  ('reg', ctypes.c_uint),
24  ('imm', ctypes.c_int64),
25  ('mem', PpcOpMem),
26  ('crx', PpcOpCrx),
27  )
28 
29 class PpcOp(ctypes.Structure):
30  _fields_ = (
31  ('type', ctypes.c_uint),
32  ('value', PpcOpValue),
33  )
34 
35  @property
36  def imm(self):
37  return self.value.imm
38 
39  @property
40  def reg(self):
41  return self.value.reg
42 
43  @property
44  def mem(self):
45  return self.value.mem
46 
47  @property
48  def crx(self):
49  return self.value.crx
50 
51 
52 class CsPpc(ctypes.Structure):
53  _fields_ = (
54  ('bc', ctypes.c_uint),
55  ('bh', ctypes.c_uint),
56  ('update_cr0', ctypes.c_bool),
57  ('op_count', ctypes.c_uint8),
58  ('operands', PpcOp * 8),
59  )
60 
62  return (a.bc, a.bh, a.update_cr0, copy_ctypes_list(a.operands[:a.op_count]))
63 
def imm(self)
Definition: ppc.py:36
def reg(self)
Definition: ppc.py:40
def crx(self)
Definition: ppc.py:48
def mem(self)
Definition: ppc.py:44
def get_arch_info(a)
Definition: ppc.py:61
def copy_ctypes_list(src)
Definition: __init__.py:326