def _create_vlib(self, lib_info, fake, lib_cfg=None): # get lib ctx name = lib_info.get_name() ctx = self.ctx_map.get(name, None) # create new context? if not ctx: ctx = LibCtx(self.machine) self.ctx_map[name] = ctx self._add_ctx_extra_attr(ctx) # get impl if fake: impl = None else: name = lib_info.get_name() impl_cls = self.lib_reg.get_lib_impl(name) if impl_cls: impl = impl_cls() # adjust version? if lib_info.version == 0: lib_info.version = impl.get_version() else: return None # create lib vlib = self.creator.create_lib(lib_info, ctx, impl, lib_cfg) # store vlib in context ctx.vlib = vlib return vlib
def __init__(self, machine, alloc, seg_loader, path_mgr, vamos): LibCtx.__init__(self, machine) self.alloc = alloc self.path_mgr = path_mgr self.seg_loader = seg_loader self.vamos = vamos # compat for process self.process = None self.exec_lib = None self.dos_lib = None
def __init__(self, machine, alloc, seg_loader, path_mgr): LibCtx.__init__(self, machine) self.machine = machine self.traps = machine.get_traps() self.cpu_type = machine.get_cpu_type() self.ram_size = self.mem.get_ram_size_bytes() self.label_mgr = machine.get_label_mgr() self.alloc = alloc self.seg_loader = seg_loader self.path_mgr = path_mgr self.process = None
def __init__(self, machine, alloc, seg_loader, path_mgr): LibCtx.__init__(self, machine) self.machine = machine self.traps = machine.get_traps() self.cpu_type = machine.get_cpu_type() self.cpu_name = machine.get_cpu_name() self.ram_size = self.mem.get_ram_size_bytes() self.label_mgr = machine.get_label_mgr() self.alloc = alloc self.seg_loader = seg_loader self.path_mgr = path_mgr self.process = None
def __init__(self, cpu, mem, cpu_type, ram_size, label_mgr, alloc, traps, seg_loader, path_mgr): LibCtx.__init__(self, cpu, mem) self.cpu_type = cpu_type self.ram_size = ram_size self.label_mgr = label_mgr self.lib_mgr = None self.alloc = alloc self.traps = traps self.process = None self.seg_loader = seg_loader self.path_mgr = path_mgr
def __init__(self, machine, alloc, seg_loader, path_mgr, run_command, start_sub_process): LibCtx.__init__(self, machine) self.alloc = alloc self.path_mgr = path_mgr self.seg_loader = seg_loader self.run_command = run_command self.start_sub_process = start_sub_process # compat for process self.process = None self.exec_lib = None self.dos_lib = None
def __init__(self, machine, alloc, seg_loader, path_mgr, scheduler, odg_base): LibCtx.__init__(self, machine) self.alloc = alloc self.path_mgr = path_mgr self.seg_loader = seg_loader self.scheduler = scheduler self.odg_base = odg_base # compat for process self.process = None self.exec_lib = None self.dos_lib = None
def setup(): mem = MockMemory(fill=23) traps = MockTraps() cpu = MockCPU() alloc = MemoryAlloc(mem) ctx = LibCtx(cpu, mem) return mem, traps, alloc, ctx
def setup(): machine = MockMachine(fill=23) mem = machine.get_mem() traps = machine.get_traps() cpu = machine.get_cpu() alloc = MemoryAlloc.for_machine(machine) ctx = LibCtx(machine) return mem, traps, alloc, ctx
def _setup_libcall_proxy(self, name, fd, base_addr, run_sp): type_name = self._get_proxy_type_name(name) # cached proxy? proxy_type = self.proxy_cache.get(type_name, None) if not proxy_type: log_libmgr.info("proxy: create libcall type '%s'", type_name) # no, create it proxy_type = self.proxy_gen.gen_proxy_for_libcall(type_name, fd) self.proxy_cache[type_name] = proxy_type # create instance ctx = LibCtx(self.lib_mgr.machine) log_libmgr.info("proxy: create libcall proxy %s@%08x", type_name, base_addr) return proxy_type(ctx, base_addr, run_sp=run_sp)
def _create_ctx(): machine = MockMachine() return LibCtx(machine)
def _create_ctx(): cpu = MockCPU() mem = MockMemory() return LibCtx(cpu, mem)
def _create_ctx(): machine = MockMachine() # prepare PrintString() machine.mem.w_cstr(0x10, "hello, world!") machine.cpu.w_reg(REG_A0, 0x10) return LibCtx(machine)