本文整理汇总了Python中memory.Memory.make_free方法的典型用法代码示例。如果您正苦于以下问题:Python Memory.make_free方法的具体用法?Python Memory.make_free怎么用?Python Memory.make_free使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类memory.Memory
的用法示例。
在下文中一共展示了Memory.make_free方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from memory import Memory [as 别名]
# 或者: from memory.Memory import make_free [as 别名]
#.........这里部分代码省略.........
def cond_eq(self):
return self.ZF
def load_data_segments(self, input):
for k in input.rodata:
self.mem.write(NValue(k), NValue(ord(input.rodata[k])),8)
def checkfunction(self,ins,ip,offset, is_test_driver=False):
self.ip = ip
while True:
self.instcount+=1
if(self.instcount % 10000 == 0):
print self.instcount, " instructions" , hex(self.ip + offset)
if self.ip not in ins:
raise UndefinedInstrException()
i = ins[self.ip]
nextip = self.ip + i.size
m = i.mnemonic
if(self.ip + offset in self.breakpoints):
ipdb.set_trace()
if debug:
print hex(self.ip + offset), i.mnemonic, " ", i.op_str
if m == "push":
self.regs[X86_REG_RSP] = self.regs[X86_REG_RSP] - 8
self.mem.write(self.regs[X86_REG_RSP], self.readoperand(i,0), i.op_size*8)
elif m == "pop":
self.writeoperand(i,0, self.mem.read(self.regs[X86_REG_RSP], i.op_size*8))
self.regs[X86_REG_RSP] = self.regs[X86_REG_RSP] + 8
#TODO: model pushing
elif m == "ret":
self.regs[X86_REG_RSP] = self.regs[X86_REG_RSP] + 8
break
elif m == "call":
if(is_test_driver):
self.mem.make_free()
self.regs[X86_REG_RSP] = self.regs[X86_REG_RSP] -8
rspval = self.regs[X86_REG_RSP]
self.mem.write(rspval, NValue(nextip),64)
self.checkfunction(ins,self.readoperand(i,0).as_long(), offset)
rspval.assert_equal(self.regs[X86_REG_RSP] -8 )
self.mem.read(rspval,64).assert_equal(NValue(nextip))
elif m == "jmp":
nextip = self.readoperand(i,0).as_long()
elif m == "je":
if(self.ZF.as_long() != 0):
nextip = self.readoperand(i,0).as_long()
elif m == "jne":
if(self.ZF.as_long() == 0):
nextip = self.readoperand(i,0).as_long()
elif m == "and":
self.carry = NValue(0)
a = self.readoperand(i,0)
b = self.readoperand(i,1)
self.writeoperand(i,0, a & b)
self.resflags(a&b)
elif m == "test":
self.carry = NValue(0)
a = self.readoperand(i,0)
b = self.readoperand(i,1)
c = a & b
self.resflags(c)
elif m == "cmp":
a = self.readoperand(i,0)
b = self.readoperand(i,1)
c = a - b
self.carry = b>a
self.resflags(c)