def function_start_initialization(self):
     self.registers['sp'] = SSV.SimStackAddress(SV.simZero)  # stackpointer
     for reg in [
             'ra', 'gp', 'fp', 's0', 's1', 's2', 's3', 's4', 's5', 's6',
             's7'
     ]:
         self.registers[reg] = SSV.SimSymbol(reg + '_in')
     self.simsupport.do_initialization(self)
 def __init__(self, asmfn):
     self.asmfn = asmfn  # AsmFunction
     self.imagebase = None
     self.uninitializedregion = None
     self.flags = {}  # flagname -> SimBoolValue
     self.registers = {}  # register name -> SimDoubleWordValue
     self.globalmem = M.SimGlobalMemory(self)
     self.stackmem = M.SimStackMemory(self)
     self.fnlog = {}  # iaddr -> msg list
     self.registers['esp'] = SSV.SimStackAddress(0)
     self.registers['ebp'] = SV.mk_symbolic_simvalue('ebp-in')
     self.registers['eax'] = SV.mk_symbolic_simvalue('eax-in')
     self.registers['ecx'] = SV.mk_symbolic_simvalue('ecx-in')
     self.stackmem.set(0, 0, SSV.SimReturnAddress())
     self.flags['DF'] = SV.simflagclr  # direction forward
     self.flags['CF'] = SV.simflagclr  # no carry
     self.flags['PF'] = SV.simflagclr  # even parity
     self.flags['ZF'] = SV.simflagclr  # no zero result
     self.flags['SF'] = SV.simflagclr  # unsigned result
     self.flags['OF'] = SV.simflagclr  # no overflow occurred
 def pop_value(self, iaddr):
     stackoffset = self.get_regval(iaddr, 'esp').get_offset()
     newoffset = stackoffset + 4
     self.registers['esp'] = SSV.SimStackAddress(newoffset)
     return self.stackmem.get(iaddr, stackoffset, 4)
 def push_value(self, iaddr, simval):
     stackoffset = self.get_regval(iaddr, 'esp').get_offset()
     newoffset = stackoffset - 4
     self.registers['esp'] = SSV.SimStackAddress(newoffset)
     self.stackmem.set(iaddr, newoffset, simval)