Fix RISCV Python bindings

The structs had changed and the `need_effective_addr` element wasn't exposed.
This commit is contained in:
Peace-Maker 2023-06-05 15:09:45 +02:00
parent 89549ccffb
commit 11be359590
2 changed files with 4 additions and 4 deletions

View File

@ -726,7 +726,7 @@ class CsInsn(object):
elif arch == CS_ARCH_BPF:
(self.operands) = bpf.get_arch_info(self._raw.detail.contents.arch.bpf)
elif arch == CS_ARCH_RISCV:
(self.operands) = riscv.get_arch_info(self._raw.detail.contents.arch.riscv)
(self.need_effective_addr, self.operands) = riscv.get_arch_info(self._raw.detail.contents.arch.riscv)
elif arch == CS_ARCH_TRICORE:
(self.update_flags, self.operands) = tricore.get_arch_info(self._raw.detail.contents.arch.tricore)

View File

@ -7,7 +7,7 @@ from .riscv_const import *
# define the API
class RISCVOpMem(ctypes.Structure):
_fields_ = (
('base', ctypes.c_uint8),
('base', ctypes.c_uint),
('disp', ctypes.c_int64),
)
@ -39,11 +39,11 @@ class RISCVOp(ctypes.Structure):
class CsRISCV(ctypes.Structure):
_fields_ = (
('need_effective_addr', ctypes.c_bool),
('need_effective_addr', ctypes.c_bool),
('op_count', ctypes.c_uint8),
('operands', RISCVOp * 8),
)
def get_arch_info(a):
return (copy_ctypes_list(a.operands[:a.op_count]))
return (a.need_effective_addr, copy_ctypes_list(a.operands[:a.op_count]))