Python: Add aliases for some registers

This commit is contained in:
Vicki Pfau 2020-08-24 01:59:12 -07:00
parent 4c8e08d2b0
commit c7d50956b3
1 changed files with 28 additions and 0 deletions

View File

@ -22,8 +22,36 @@ class _ARMRegisters:
class ARMCore:
SP = 13
LR = 14
PC = 15
def __init__(self, native):
self._native = ffi.cast("struct ARMCore*", native)
self.gprs = _ARMRegisters(self)
self.cpsr = self._native.cpsr
self.spsr = self._native.spsr
@property
def sp(self):
return self.gprs[self.SP]
@sp.setter
def sp(self, value):
self.gprs[self.SP] = value
@property
def lr(self):
return self.gprs[self.LR]
@lr.setter
def lr(self, value):
self.gprs[self.LR] = value
@property
def pc(self):
return self.gprs[self.PC]
@pc.setter
def pc(self, value):
self.gprs[self.PC] = value