Add basic i8086 support (#835)

pull/842/head
xmcp 5 years ago committed by GitHub
parent f096be7d89
commit ea11f862df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,6 +32,7 @@ def fix_arch(arch):
return arch
@pwndbg.events.start
@pwndbg.events.stop
@pwndbg.events.new_objfile
def update():
m = sys.modules[__name__]

@ -28,6 +28,7 @@ CapstoneArch = {
'armcm': CS_ARCH_ARM,
'aarch64': CS_ARCH_ARM64,
'i386': CS_ARCH_X86,
'i8086': CS_ARCH_X86,
'x86-64': CS_ARCH_X86,
'powerpc': CS_ARCH_PPC,
'mips': CS_ARCH_MIPS,
@ -52,6 +53,7 @@ CapstoneMode = {
VariableInstructionSizeMax = {
'i386': 16,
'x86-64': 16,
'i8086': 16,
'mips': 8,
}
@ -85,6 +87,10 @@ def get_disassembler(pc):
else:
# The ptrsize base modes cause capstone.CsError: Invalid mode (CS_ERR_MODE)
extra = 0
elif pwndbg.arch.current == 'i8086':
extra = CS_MODE_16
else:
extra = None

@ -162,7 +162,6 @@ i386 = RegisterSet( pc = 'eip',
'di','si','bp','sp','ip'),
retval = 'eax')
# http://math-atlas.sourceforge.net/devel/assembly/elfspec_ppc.pdf
# r0 Volatile register which may be modified during function linkage
# r1 Stack frame pointer, always valid
@ -242,6 +241,7 @@ mips = RegisterSet( frame = 'fp',
arch_to_regs = {
'i386': i386,
'i8086': i386,
'x86-64': amd64,
'mips': mips,
'sparc': sparc,
@ -289,6 +289,8 @@ class module(ModuleType):
value = get_register(attr)
size = pwndbg.typeinfo.unsigned.get(value.type.sizeof, pwndbg.typeinfo.ulong)
value = value.cast(size)
if attr.lower() == 'pc' and pwndbg.arch.current == 'i8086':
value += self.cs * 16
value = int(value)
return value & pwndbg.arch.ptrmask

Loading…
Cancel
Save