Fix Python 3 samples (#836)

This commit is contained in:
Fangrui Song 2017-05-14 18:11:22 -07:00 committed by Nguyen Anh Quynh
parent 014ccfb94a
commit 85e0a54e35
4 changed files with 4 additions and 4 deletions

View file

@ -53,7 +53,7 @@ def test_arm64():
# now print out some registers # now print out some registers
print(">>> Emulation done. Below is the CPU context") print(">>> Emulation done. Below is the CPU context")
print(">>> As little endian, X15 should be 0x78:"); print(">>> As little endian, X15 should be 0x78:")
x11 = mu.reg_read(UC_ARM64_REG_X11) x11 = mu.reg_read(UC_ARM64_REG_X11)
x13 = mu.reg_read(UC_ARM64_REG_X13) x13 = mu.reg_read(UC_ARM64_REG_X13)

View file

@ -54,7 +54,7 @@ def test_arm64():
# now print out some registers # now print out some registers
print(">>> Emulation done. Below is the CPU context") print(">>> Emulation done. Below is the CPU context")
print(">>> As big endian, X15 should be 0x12:"); print(">>> As big endian, X15 should be 0x12:")
x11 = mu.reg_read(UC_ARM64_REG_X11) x11 = mu.reg_read(UC_ARM64_REG_X11)
x13 = mu.reg_read(UC_ARM64_REG_X13) x13 = mu.reg_read(UC_ARM64_REG_X13)

View file

@ -431,7 +431,7 @@ def test_i386_inout():
def test_i386_context_save(): def test_i386_context_save():
print("Save/restore CPU context in opaque blob") print("Save/restore CPU context in opaque blob")
address = 0 address = 0
code = '\x40' # inc eax code = b'\x40' # inc eax
try: try:
# Initialize emulator # Initialize emulator
mu = Uc(UC_ARCH_X86, UC_MODE_32) mu = Uc(UC_ARCH_X86, UC_MODE_32)

View file

@ -10,7 +10,7 @@ X86_CODE32 = b"\xeb\x19\x31\xc0\x31\xdb\x31\xd2\x31\xc9\xb0\x04\xb3\x01\x59\xb2\
X86_CODE32_SELF = b"\xeb\x1c\x5a\x89\xd6\x8b\x02\x66\x3d\xca\x7d\x75\x06\x66\x05\x03\x03\x89\x02\xfe\xc2\x3d\x41\x41\x41\x41\x75\xe9\xff\xe6\xe8\xdf\xff\xff\xff\x31\xd2\x6a\x0b\x58\x99\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x53\x89\xe1\xca\x7d\x41\x41\x41\x41\x41\x41\x41\x41" X86_CODE32_SELF = b"\xeb\x1c\x5a\x89\xd6\x8b\x02\x66\x3d\xca\x7d\x75\x06\x66\x05\x03\x03\x89\x02\xfe\xc2\x3d\x41\x41\x41\x41\x75\xe9\xff\xe6\xe8\xdf\xff\xff\xff\x31\xd2\x6a\x0b\x58\x99\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x53\x89\xe1\xca\x7d\x41\x41\x41\x41\x41\x41\x41\x41"
X86_CODE64 = "\x48\x31\xff\x57\x57\x5e\x5a\x48\xbf\x2f\x2f\x62\x69\x6e\x2f\x73\x68\x48\xc1\xef\x08\x57\x54\x5f\x6a\x3b\x58\x0f\x05" X86_CODE64 = b"\x48\x31\xff\x57\x57\x5e\x5a\x48\xbf\x2f\x2f\x62\x69\x6e\x2f\x73\x68\x48\xc1\xef\x08\x57\x54\x5f\x6a\x3b\x58\x0f\x05"
# memory address where emulation starts # memory address where emulation starts
ADDRESS = 0x1000000 ADDRESS = 0x1000000