Rizin
unix-like reverse engineering framework and cli tools
sparc.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 .sparc_const import *
6 
7 # define the API
8 class SparcOpMem(ctypes.Structure):
9  _fields_ = (
10  ('base', ctypes.c_uint8),
11  ('index', ctypes.c_uint8),
12  ('disp', ctypes.c_int32),
13  )
14 
15 class SparcOpValue(ctypes.Union):
16  _fields_ = (
17  ('reg', ctypes.c_uint),
18  ('imm', ctypes.c_int64),
19  ('mem', SparcOpMem),
20  )
21 
22 class SparcOp(ctypes.Structure):
23  _fields_ = (
24  ('type', ctypes.c_uint),
25  ('value', SparcOpValue),
26  )
27 
28  @property
29  def imm(self):
30  return self.value.imm
31 
32  @property
33  def reg(self):
34  return self.value.reg
35 
36  @property
37  def mem(self):
38  return self.value.mem
39 
40 
41 class CsSparc(ctypes.Structure):
42  _fields_ = (
43  ('cc', ctypes.c_uint),
44  ('hint', ctypes.c_uint),
45  ('op_count', ctypes.c_uint8),
46  ('operands', SparcOp * 4),
47  )
48 
50  return (a.cc, a.hint, copy_ctypes_list(a.operands[:a.op_count]))
51 
def mem(self)
Definition: sparc.py:37
def imm(self)
Definition: sparc.py:29
def reg(self)
Definition: sparc.py:33
def get_arch_info(a)
Definition: sparc.py:49
def copy_ctypes_list(src)
Definition: __init__.py:326