mirror of
https://github.com/cemu-project/idapython.git
synced 2024-11-24 10:09:20 +01:00
bugfix: SetRegEx and GetReg were only working with x86 segment registers
This commit is contained in:
parent
277facf240
commit
d7c6f94f08
@ -1449,15 +1449,6 @@ def SetFlags(ea, flags):
|
|||||||
"""
|
"""
|
||||||
return idaapi.setFlags(ea, flags)
|
return idaapi.setFlags(ea, flags)
|
||||||
|
|
||||||
_REGMAP = {
|
|
||||||
'es' : idaapi.R_es,
|
|
||||||
'cs' : idaapi.R_cs,
|
|
||||||
'ss' : idaapi.R_ss,
|
|
||||||
'ds' : idaapi.R_ds,
|
|
||||||
'fs' : idaapi.R_fs,
|
|
||||||
'gs' : idaapi.R_gs
|
|
||||||
}
|
|
||||||
|
|
||||||
def SetRegEx(ea, reg, value, tag):
|
def SetRegEx(ea, reg, value, tag):
|
||||||
"""
|
"""
|
||||||
Set value of a segment register.
|
Set value of a segment register.
|
||||||
@ -1473,8 +1464,9 @@ def SetRegEx(ea, reg, value, tag):
|
|||||||
|
|
||||||
See also SetReg() compatibility macro.
|
See also SetReg() compatibility macro.
|
||||||
"""
|
"""
|
||||||
if reg in _REGMAP:
|
reg = idaapi.str2reg(reg);
|
||||||
return idaapi.splitSRarea1(ea, _REGMAP[reg], value, tag)
|
if reg >= 0:
|
||||||
|
return idaapi.splitSRarea1(ea, reg, value, tag)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -1885,17 +1877,17 @@ def GetReg(ea, reg):
|
|||||||
@param ea: linear address
|
@param ea: linear address
|
||||||
@param reg: name of segment register
|
@param reg: name of segment register
|
||||||
|
|
||||||
@return: the value of the segment register or 0xFFFF on error
|
@return: the value of the segment register or -1 on error
|
||||||
|
|
||||||
@note: The segment registers in 32bit program usually contain selectors,
|
@note: The segment registers in 32bit program usually contain selectors,
|
||||||
so to get paragraph pointed by the segment register you need to
|
so to get paragraph pointed by the segment register you need to
|
||||||
call AskSelector() function.
|
call AskSelector() function.
|
||||||
"""
|
"""
|
||||||
if reg in _REGMAP:
|
reg = idaapi.str2reg(reg);
|
||||||
return idaapi.getSR(ea, _REGMAP[reg]) & 0xFFFF
|
if reg >= 0:
|
||||||
|
return idaapi.getSR(ea, reg)
|
||||||
else:
|
else:
|
||||||
return False
|
return -1
|
||||||
|
|
||||||
|
|
||||||
def NextAddr(ea):
|
def NextAddr(ea):
|
||||||
"""
|
"""
|
||||||
@ -3342,8 +3334,9 @@ def SetSegDefReg(ea, reg, value):
|
|||||||
"""
|
"""
|
||||||
seg = idaapi.getseg(ea)
|
seg = idaapi.getseg(ea)
|
||||||
|
|
||||||
if seg and reg in _REGMAP:
|
reg = idaapi.str2reg(reg);
|
||||||
return idaapi.SetDefaultRegisterValue(seg, _REGMAP[reg], value)
|
if seg and reg >= 0:
|
||||||
|
return idaapi.SetDefaultRegisterValue(seg, reg, value)
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user