コード例 #1
0
def new_context_switcher_cmd(name, tracker):
    real_name = new_object_name(name, "switcher")
    if real_name == None:
        print "An object called '%s' already exists." % name
        SIM_command_has_problem()
        return
    else:
        name = real_name
    try:
        tracker = SIM_get_object(tracker)
    except:
        print "There is no object called '%s'." % tracker
        SIM_command_has_problem()
        return
    try:
        tracker.iface.tracker
    except:
        print "%s is not a tracker." % tracker.name
        SIM_command_has_problem()
        return
    SIM_create_object("context-switcher", name,
                      [["tracker", tracker]])
    if SIM_is_interactive():
        print "New context switcher %s created." % name
    return (name,)
コード例 #2
0
def new_linux_process_tracker_cmd(name, kernel):

    # Choose a name.
    real_name = new_object_name(name, "tracker")
    if real_name == None:
        print "An object called '%s' already exists." % name
        SIM_command_has_problem()
        return
    else:
        name = real_name

    # Using canned parameters?
    if kernel:
        if kernel in ptrack_settings_ifc().settings_id_list():
            print ("Using parameters suitable for %s."
                   % ptrack_settings_ifc().describe_settings(kernel))
        else:
            print "There is no named set of parameters called '%s'." % kernel
            SIM_command_has_problem()
            return

    # Finally, create the tracker.
    tracker = SIM_create_object(class_name, name, [])
    if kernel:
        ptrack_settings_ifc().use_settings(tracker, kernel)
    if SIM_is_interactive():
        print "New process tracker %s created." % name
    return (name,)
コード例 #3
0
def new_linux_process_tracker_cmd(name, kernel):

    # Choose a name.
    real_name = new_object_name(name, "tracker")
    if real_name == None:
        print "An object called '%s' already exists." % name
        SIM_command_has_problem()
        return
    else:
        name = real_name

    # Using canned parameters?
    if kernel:
        if kernel in ptrack_settings_ifc().settings_id_list():
            print("Using parameters suitable for %s." %
                  ptrack_settings_ifc().describe_settings(kernel))
        else:
            print "There is no named set of parameters called '%s'." % kernel
            SIM_command_has_problem()
            return

    # Finally, create the tracker.
    tracker = SIM_create_object(class_name, name, [])
    if kernel:
        ptrack_settings_ifc().use_settings(tracker, kernel)
    if SIM_is_interactive():
        print "New process tracker %s created." % name
    return (name, )
コード例 #4
0
ファイル: gcommands.py プロジェクト: andysan/sampler
def new_uart_sampler_conf_cmd(name,
                              file_base_name,
                              sample_period,
                              sample_rnd_type,
                              burst_period,
                              burst_rnd_type,
                              burst_size,
                              line_size_lg2,
                              master):
    real_name = new_object_name(name, "sampler-conf")
    if real_name == None:
        print "An object called '%s' already exists." % name
        SIM_command_has_problem()
        return
    else:
        name = real_name

    if not sample_rnd_type:
        sample_rnd_type = "exp"
    if not burst_rnd_type:
        burst_rnd_type = "exp"

    conf = SIM_create_object("uart-sampler-conf", name, [])
    conf.file_base_name = file_base_name
    conf.sample_period = sample_period
    conf.sample_rnd_type = sample_rnd_type
    conf.burst_period = burst_period
    conf.burst_rnd_type = burst_rnd_type
    conf.burst_size = burst_size
    conf.line_size_lg2 = line_size_lg2
    conf.master = master
    return (conf,)
コード例 #5
0
def new_uart_sampler_conf_cmd(name, file_base_name, sample_period,
                              sample_rnd_type, burst_period, burst_rnd_type,
                              burst_size, line_size_lg2, master):
    real_name = new_object_name(name, "sampler-conf")
    if real_name == None:
        print "An object called '%s' already exists." % name
        SIM_command_has_problem()
        return
    else:
        name = real_name

    if not sample_rnd_type:
        sample_rnd_type = "exp"
    if not burst_rnd_type:
        burst_rnd_type = "exp"

    conf = SIM_create_object("uart-sampler-conf", name, [])
    conf.file_base_name = file_base_name
    conf.sample_period = sample_period
    conf.sample_rnd_type = sample_rnd_type
    conf.burst_period = burst_period
    conf.burst_rnd_type = burst_rnd_type
    conf.burst_size = burst_size
    conf.line_size_lg2 = line_size_lg2
    conf.master = master
    return (conf, )
コード例 #6
0
ファイル: gcommands.py プロジェクト: vnaveen0/nachos
def new_context_switcher_cmd(name, tracker):
    real_name = new_object_name(name, "switcher")
    if real_name == None:
        print "An object called '%s' already exists." % name
        SIM_command_has_problem()
        return
    else:
        name = real_name
    try:
        tracker = SIM_get_object(tracker)
    except:
        print "There is no object called '%s'." % tracker
        SIM_command_has_problem()
        return
    try:
        tracker.iface.tracker
    except:
        print "%s is not a tracker." % tracker.name
        SIM_command_has_problem()
        return
    SIM_create_object("context-switcher", name,
                      [["tracker", tracker]])
    if SIM_is_interactive():
        print "New context switcher %s created." % name
    return (name,)
コード例 #7
0
ファイル: gcommands.py プロジェクト: andysan/sampler
def new_uart_sampler_cmd(name, conf):
    real_name = new_object_name(name, "sampler-conf")
    if real_name == None:
        print "An object called '%s' already exists." % name
        SIM_command_has_problem()
        return
    else:
        name = real_name

    SIM_create_object("uart-sampler", name, [["conf", conf]])
コード例 #8
0
def new_uart_sampler_cmd(name, conf):
    real_name = new_object_name(name, "sampler-conf")
    if real_name == None:
        print "An object called '%s' already exists." % name
        SIM_command_has_problem()
        return
    else:
        name = real_name

    SIM_create_object("uart-sampler", name, [["conf", conf]])
コード例 #9
0
def new_cpu_mode_tracker_cmd(name):
    real_name = new_object_name(name, "tracker")
    if real_name == None:
        print "An object called '%s' already exists." % name
        SIM_command_has_problem()
        return
    else:
        name = real_name
    SIM_create_object(class_name, name, [])
    if SIM_is_interactive():
        print "New cpu mode tracker %s created." % name
    return (name, )
コード例 #10
0
def new_cpu_mode_tracker_cmd(name):
    real_name = new_object_name(name, "tracker")
    if real_name == None:
        print "An object called '%s' already exists." % name
        SIM_command_has_problem()
        return
    else:
        name = real_name
    SIM_create_object(class_name, name, [])
    if SIM_is_interactive():
        print "New cpu mode tracker %s created." % name
    return (name, )
コード例 #11
0
ファイル: gcommands.py プロジェクト: YKG/Simics-3.0.31
def new_ppc64_linux_process_tracker_cmd(name, task_struct_offset, pid_offset,
                                        kernel):

    # Input validation.
    if (task_struct_offset == None) != (pid_offset == None):
        print("You must specify none or both of task_struct_offset" +
              " and pid_offset.")
        return
    if task_struct_offset == None and kernel == None:
        print("You must specify either kernel, or task_struct_offset" +
              " and pid_offset.")
        return
    if task_struct_offset != None and kernel != None:
        print("You cannot specify both kernel and" +
              " task_struct_offset/pid_offset.")
        return

    # Choose a name.
    real_name = new_object_name(name, "tracker")
    if real_name == None:
        print "An object called '%s' already exists." % name
        return
    else:
        name = real_name

    # Using canned parameters?
    if kernel:
        if kernel in ppc64_ptrack_settings_ifc().settings_id_list():
            print("Using parameters suitable for %s." %
                  ppc64_ptrack_settings_ifc().describe_settings(kernel))
        else:
            print "There is no named set of parameters called '%s'." % kernel
            return

    # Finally, create the tracker.
    tracker = SIM_create_object(class_name, name, [])
    if kernel:
        ppc64_ptrack_settings_ifc().use_settings(tracker, kernel)
    else:
        tracker.task_struct_offset_in_paca = task_struct_offset
        tracker.pid_offset_in_task_struct = pid_offset
    print "New process tracker %s created." % name
    print "    task_struct_offset %d" % tracker.task_struct_offset_in_paca
    print "    pid_offset         %d" % tracker.pid_offset_in_task_struct
コード例 #12
0
def new_x86_linux_process_tracker_cmd(name, pid_offset,
                                      kernel_stack_size, kernel):

    # Input validation.
    if (kernel_stack_size == None) != (pid_offset == None):
        print ("You must specify none or both of kernel_stack_size"
               + " and pid_offset.")
        return
    if kernel_stack_size == None and kernel == None:
        print ("You must specify either kernel, or kernel_stack_size"
               + " and pid_offset.")
        return
    if kernel_stack_size != None and kernel != None:
        print ("You cannot specify both kernel and"
               + " kernel_stack_size/pid_offset.")
        return

    # Choose a name.
    real_name = new_object_name(name, "tracker")
    if real_name == None:
        print "An object called '%s' already exists." % name
        return
    else:
        name = real_name

    # Using canned parameters?
    if kernel:
        if kernel in x86_ptrack_settings_ifc().settings_id_list():
            print ("Using parameters suitable for %s."
                   % x86_ptrack_settings_ifc().describe_settings(kernel))
        else:
            print "There is no named set of parameters called '%s'." % kernel
            return

    # Finally, create the tracker.
    tracker = SIM_create_object(class_name, name, [])
    if kernel:
        x86_ptrack_settings_ifc().use_settings(tracker, kernel)
    else:
        tracker.thread_offset = thread_offset
        tracker.pid_offset = pid_offset
    print "New process tracker %s created." % name
    print "    kernel_stack_size %d" % tracker.kernel_stack_size
    print "    pid_offset        %d" % tracker.pid_offset
コード例 #13
0
ファイル: simics_start.py プロジェクト: mfthomps/RESim
                return arch
        elif len(archs) == 1:
            [arch] = archs
            return arch
    raise cli.CliError(
        'Cannot guess processor architecture; please specify it')


def new_gdb_remote(name, port, cpu, architecture, context):
    if not any([cpu, context]):
        print "Neither CPU nor context specified; using current processor."
        try:
            cpu = cli.current_processor()
        except Exception, msg:
            raise cli.CliError(msg)
    name = cli_impl.new_object_name(name, 'gdb')
    attrs = [['processor', cpu], ['context_object', context], ['listen', port],
             ['architecture',
              get_arch(architecture, cpu, context)], ['log_level', 2]]
    try:
        simics.SIM_create_object("gdb-remote", name, attrs)
    except LookupError, msg:
        print "Failed creating a gdb-remote object: %s" % msg
        print "Make sure the gdb-remote module is available."
    except Exception, msg:
        print "Could not create a gdb-remote object: %s" % msg


def arch_expander(s):
    return cli.get_completions(s, get_all_archs())