def libnative_libfuncs_rem_library_test():
    machine = Machine()
    mem = machine.get_mem()
    cpu = machine.get_cpu()
    traps = machine.get_traps()
    sp = machine.get_ram_begin() - 4
    alloc = MemoryAlloc.for_machine(machine)
    segloader = SegmentLoader(alloc)
    # new lib
    lib = Library.alloc(alloc, name="my.library", id_string="bla", neg_size=36)
    lib.new_lib()
    # setup seglist
    seglist = SegList.alloc(alloc, [64])
    segloader.register_seglist(seglist.get_baddr())

    # setup expunge func

    def expunge_func(op, pc):
        # return my seglist
        cpu.w_reg(REG_D0, seglist.get_baddr())

    trap_id = traps.setup(expunge_func, auto_rts=True)
    exp_addr = lib.get_addr() - 18
    mem.w16(exp_addr, trap_id | 0xA000)
    # add lib
    lf = LibFuncs(machine, alloc)
    sl = lf.rem_library(lib.get_addr(), segloader, run_sp=sp)
    assert seglist.get_baddr() == sl
    # cleanup
    lib.free()
    assert alloc.is_all_free()
    assert segloader.shutdown() == 0
def libnative_libfuncs_rem_library_test():
  machine = Machine()
  mem = machine.get_mem()
  cpu = machine.get_cpu()
  traps = machine.get_traps()
  sp = machine.get_ram_begin() - 4
  alloc = MemoryAlloc.for_machine(machine)
  segloader = SegmentLoader(alloc)
  # new lib
  lib = Library.alloc(alloc, "my.library", "bla", 36)
  lib.setup()
  # setup seglist
  seglist = SegList.alloc(alloc, [64])
  segloader.register_seglist(seglist.get_baddr())
  # setup expunge func

  def expunge_func(op, pc):
    # return my seglist
    cpu.w_reg(REG_D0, seglist.get_baddr())
  trap_id = traps.setup(expunge_func, auto_rts=True)
  exp_addr = lib.get_addr() - 18
  mem.w16(exp_addr, trap_id | 0xa000)
  # add lib
  lf = LibFuncs(machine, alloc)
  sl = lf.rem_library(lib.get_addr(), segloader, run_sp=sp)
  assert seglist.get_baddr() == sl
  # cleanup
  lib.free()
  assert alloc.is_all_free()
  assert segloader.shutdown() == 0
Beispiel #3
0
 def RemLibrary(self, ctx):
     lib_addr = ctx.cpu.r_reg(REG_A1)
     lf = LibFuncs(ctx.machine, ctx.alloc)
     seglist = lf.rem_library(lib_addr, ctx.seg_loader)
     log_exec.info("RemLibrary: lib=%06x -> seglist=%06x", lib_addr,
                   seglist)
Beispiel #4
0
 def RemLibrary(self, ctx):
   lib_addr = ctx.cpu.r_reg(REG_A1)
   lf = LibFuncs(ctx.machine, ctx.alloc)
   seglist = lf.rem_library(lib_addr, ctx.seg_loader)
   log_exec.info("RemLibrary: lib=%06x -> seglist=%06x", lib_addr, seglist)