def __init__(self): # Holds a instance of our PyCPU class self.cpu = None # Holds an instance of our PyOS class self.os = None # Tells the emulator whether we are emulating self.emulating = True # Whether to use a frame pointer for stack offsets self.frame_pointer = True # Class members to hold stack and heap limits self.stack_base = 0x0 self.stack_size = 0x0 self.heap_base = 0x0 self.heap_size = 0x0 # Holds an instance of our PyMemory class self.memory = "" # A list of names for public methods self.register_names = {} self.stack_variable_names = {} self.stack_argument_names = {} # A list of our user handlers for various aspects of emulation self.mnemonic_handlers = {} self.opcode_handlers = {} self.register_handlers = {} self.pc_handlers = {} self.exception_handlers = {} self.interrupt_handlers = {} self.library_handlers = {} self.memory_handlers = {} self.memory_read_handler = None self.memory_write_handler = None self.memory_access_handler = None self.stack_read_handler = None self.stack_write_handler = None self.stack_access_handler = None self.heap_read_handler = None self.heap_write_handler = None self.heap_access_handler = None # Instantiate a CPU for use in the emulator self.cpu = PyCPU(self) # Determine which os we are on to instantiate the proper PyOS if os.name == 'nt': self.os = PyWindows() elif os.name == 'posix': # Yea I realize self.os = PyLinux()
def __init__(self): # Holds a instance of our PyCPU class self.cpu = None # Holds an instance of our PyOS class self.os = None # Tells the emulator whether we are emulating self.emulating = True # Whether to use a frame pointer for stack offsets self.frame_pointer = True # Class members to hold stack and heap limits self.stack_base = 0x0 self.stack_size = 0x0 self.heap_base = 0x0 self.heap_size = 0x0 # Holds an instance of our PyMemory class self.memory = None # A list of names for public methods self.register_names = {} self.stack_variable_names = {} self.stack_argument_names = {} # A list of our user handlers for various aspects of emulation self.mnemonic_handlers = {} self.opcode_handlers = {} self.register_handlers = {} self.pc_handlers = {} self.exception_handlers = {} self.interrupt_handlers = {} self.library_handlers = {} self.memory_handlers = {} self.memory_read_handler = None self.memory_write_handler = None self.memory_access_handler = None self.instruction_parsed_handle = None self.instruction_executed_handle = None self.stack_read_handler = None self.stack_write_handler = None self.stack_access_handler = None self.heap_read_handler = None self.heap_write_handler = None self.heap_access_handler = None # Instantiate a CPU for use in the emulator self.cpu = PyCPU(self)