2015-08-23 21:01:58 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
# By Ryan Hileman, issue #16
|
|
|
|
|
|
|
|
from unicorn import *
|
|
|
|
from unicorn.arm_const import *
|
2015-08-24 01:50:55 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
uc = Uc(UC_ARCH_ARM, UC_MODE_32)
|
2015-08-24 04:51:53 +00:00
|
|
|
uc.reg_write(UC_ARM_REG_SP, 4)
|
2015-08-24 01:50:55 +00:00
|
|
|
print 'Writing 4 to SP'
|
2015-08-24 04:51:53 +00:00
|
|
|
print 'SP =', uc.reg_read(UC_ARM_REG_SP)
|
2015-08-24 01:50:55 +00:00
|
|
|
except UcError as e:
|
|
|
|
print("ERROR: %s" % e)
|
|
|
|
|
|
|
|
try:
|
|
|
|
print "==========="
|
|
|
|
uc = Uc(UC_ARCH_ARM, UC_MODE_ARM)
|
2015-08-24 04:51:53 +00:00
|
|
|
uc.reg_write(UC_ARM_REG_SP, 4)
|
2015-08-24 01:50:55 +00:00
|
|
|
print 'Writing 4 to SP'
|
2015-08-24 04:51:53 +00:00
|
|
|
print 'SP =', uc.reg_read(UC_ARM_REG_SP)
|
2015-08-24 01:50:55 +00:00
|
|
|
except UcError as e:
|
|
|
|
print("ERROR: %s" % e)
|