def reg_process(dummy, cpu, param):
    fname = ""
    try :
        fname = copyout_str(cpu, cpu.edx)
    except :
        cs410_utils.log('410-warning', '410mods-userdebug.py: Unable to read string at %x; not registering process' % cpu.edx)
        return

    if fname == "" or '/' in fname:
        return

    cr3 = cpu.ecx
    sname = "prog-"+fname
    user_process_registry[cr3] = sname

    # see if symbol table for fname exists.
    # if not make it and load the symbols.
    try:
        SIM_get_object(sname)

        ### FIXME We would like to empty the symbol table if
        ### it exists, but we'll do the best we can by reloading
        ### symbols below.
    except SimExc_General:
        cs410_utils.alone(make_new_symtable, sname, fname, cr3)

    cs410_utils.alone(switch_current_symtable, cpu)
def reg_process(dummy, cpu, param):
    global user_process_registry
    fname = ""
    try :
        fname = copyout_str(cpu, cpu.edx)
    except :
        cs410_utils.log('410-warning', '410mods-userdebug.py: Unable to read string at %x; not registering process' % cpu.edx)
        return

    if fname == "" or '/' in fname:
        return

    cr3 = cpu.ecx
    sname = fname+"_prog"
    user_process_registry[cr3] = sname

    # see if symbol table for fname exists.
    # if not make it and load the symbols.
    try:
        SIM_get_object(sname)

        ### FIXME We would like to empty the symbol table if
        ### it exists, but we'll do the best we can by reloading
        ### symbols below.
    except SimExc_General:
        cs410_utils.alone(make_new_symtable, sname, fname, cr3)

    cs410_utils.alone(switch_current_symtable, cpu)
def unreg_process(dummy, cpu, param):
    # unregister user process
    global user_process_registry

    cr3 = cpu.ecx
    if user_process_registry.has_key(cr3):
        s = user_process_registry[cr3]
        del user_process_registry[cr3]
        cs410_utils.alone(switch_current_symtable, cpu)
def unreg_process(dummy, cpu, param):
    # unregister user process
    global user_process_registry

    cr3 = cpu.ecx
    if user_process_registry.has_key(cr3):
        s = user_process_registry[cr3]
        del user_process_registry[cr3]
        cs410_utils.alone(switch_current_symtable, cpu)
示例#5
0
def hbrk(h, b, brknum, m):
	cpu = SIM_current_processor()
	print "Invalid memory access detected:"
	print "eip = 0x%08x, va = 0x%08x, pa = 0x%08x" % \
		(cpu.iface.processor_info.get_program_counter(), \
		SIM_get_mem_op_virtual_address(m), \
		SIM_get_mem_op_physical_address(m))
	print "Delivering Exception 18..."
	cs410_utils.alone(switcher, cpu)
	return
    if (os.path.isfile(str)):
        # Load all subsequent symbol tables with this source as well
        kern_path = str
        usersym = "deflsym"

        sp = ""
        for p in [working_dir + "/", user_src_path, test_src_path]:
            if os.path.exists(p):
                sp += p + ";"

        def to_do_alone(cpu, times, error):
            cli.run_command("%s.source-path \"%s\"" % (usersym, sp[:-1]))
            cli.run_command("%s.load-symbols %s" % (usersym, str))
            cli.run_command("system.cell_context.symtable %s" % usersym)

        if len(sp) > 0:
            boot_callbacks.insert(0, to_do_alone)
    else:
        print "No such kernel image: '%s'; symbolic debugging won't work." % str
        error = 1

    def run_callbacks():
        for x in boot_callbacks:
            x(cpu, cs410_dispatch.kernel_up, error)

    cs410_utils.alone(run_callbacks)


cs410_dispatch.add_simcall(booted)
def reg_child(dummy, cpu, param):
    child_cr3 = cpu.ecx
    parent_cr3 = cpu.edx
    user_process_registry[child_cr3] = user_process_registry[parent_cr3]
    cs410_utils.alone(switch_current_symtable, cpu)
def switch_symtable(cr3):
    if user_process_registry.has_key(cr3):
        cs410_utils.alone(cli.quiet_run_command,"system.cell_context.symtable %s" %
            user_process_registry[cr3])
    else:
        cs410_utils.alone(cli.quiet_run_command,"system.cell_context.symtable deflsym")
def reg_child(dummy, cpu, param):
    child_cr3 = cpu.ecx
    parent_cr3 = cpu.edx
    user_process_registry[child_cr3] = user_process_registry[parent_cr3]
    cs410_utils.alone(switch_current_symtable, cpu)
示例#10
0
def swat(dummy, cpu, param):
    cs410_utils.alone(swat_help, dummy, cpu, param)
def swat(dummy, cpu, param):
    cs410_utils.alone(swat_help, dummy, cpu, param)