VIRTUTECH CONFIDENTIAL    Previous - Up - Next

processor

Implemented By
alpha-ev5, armv5te, clock, ia64-itanium, ia64-itanium2, leon2, mips-4kc, mips-5kc, msp430, ppc405gp, ppc440gp, ppc440gx, ppc603e, ppc7400, ppc7447, ppc7450, ppc7457, ppc750, ppc750fx, ppc750gx, ppc970fx, ultrasparc-ii, ultrasparc-iii, ultrasparc-iii-i, ultrasparc-iii-plus, ultrasparc-iv, ultrasparc-iv-plus, ultrasparc-t1, x86-486sx, x86-hammer, x86-p2, x86-p4
Description
Interface for accessing processor functionality.

typedef struct {
        logical_address_t (*get_program_counter)(conf_object_t *NOTNULL cpu);
        void (*set_program_counter)(conf_object_t *NOTNULL cpu,
                                    logical_address_t pc);
        int (*get_privilege_level)(conf_object_t *NOTNULL cpu);
        tuple_int_string_t *(*disassemble)(conf_object_t *NOTNULL cpu,
                                           generic_address_t address,
                                           int type);
        tuple_int_string_t (*disassemble_buf)(
                conf_object_t *NOTNULL cpu, generic_address_t address,
                byte_string_t opcode);
        struct instr_info *(*instruction_info)(conf_object_t *NOTNULL cpu,
                                               generic_address_t address,
                                               int type);
        void (*reset)(conf_object_t *NOTNULL cpu, int hard_reset);
        processor_t *(*simcore)(processor_t *NOTNULL);
        void (*pre_simcore)(processor_t *NOTNULL);
        void (*post_simcore)(processor_t *NOTNULL);
        processor_t *(*in_order_simcore)(processor_t *NOTNULL);
        processor_t *(*step_queue_simcore)(processor_t *NOTNULL);
        processor_t *(*mai_simcore)(processor_t *NOTNULL);
        int (*dump_sr_stat)(const char *NOTNULL filename);
        void (*print_instruction_queue)(conf_object_t *NOTNULL cpu,
                                        int verbose);
        void (*dbg_print_pistc)(conf_object_t *NOTNULL cpu, int table);
        int (*stc_load)(conf_object_t *cpu, logical_address_t laddr,
                        uint8 *value, int size);
        int (*stc_store)(conf_object_t *cpu, logical_address_t laddr,
                         uint8 *value, int size);
        attr_value_t (*disassemble_range)(processor_t *NOTNULL cpu,
                                          logical_address_t start,
                                          int nlines, int back,
                                          disass_flags_t flags);
} processor_interface_t;

#define PROCESSOR_INTERFACE "processor"

The functions correspond to the API functions SIM_get_program_counter, SIM_set_program_counter, SIM_processor_privilege_level, and SIM_disassemble. See the documentation for those functions for more complete documentation.

The function instruction_info can take either a physical address (type = 0) or a logical address (type = 1). It returns a filled instr_info_t structure. Only the SPARCv9 and the x86 architectures provides a list of register dependencies as an array of reg_info_t.

struct instr_info {
        instr_type_t   type;           /* ORed representation of 
                                          instr_type_t */
        logical_address_t return_pc;   /* (SPARC only) Return program counter
                                          (defined iff It_Call is true) */
        int            delay_slots;    /* (SPARC only) Delay slots for instruction
                                          (defined iff It_Return) */
        int            length;         /* Instruction length in bytes */
        const char    *name;           /* (SPARC and x86) instruction name */

        instr_info_dep_t *dependencies;
};
typedef struct instr_info instr_info_t;
struct instr_info_dep {
        int number_of_regs;
        reg_info_t regs[MAX_REG_INFO_REGS];
};
typedef struct instr_info_dep instr_info_dep_t;
struct reg_info {
        register_type_t type;   /* register type */
        register_id_t id;       /* register id */
        unsigned input:1;       /* used as input */
        unsigned output:1;      /* used as output */
};
typedef struct reg_info reg_info_t;

SEE ALSO
SIM_get_program_counter, SIM_processor_privilege_level
Command List
add-memory-profileradd a memory profiler to the processor
aprof-viewsmanipulate list of selected address profiling views
attach-branch-recorderattach a branch recorder to a processor
break-crbreak on control register updates
cycle-breakset cycle breakpoint
cycle-break-absoluteset absolute cycle breakpoint
detach-branch-recorderdetach a branch recorder from a processor
disableswitch processor off
disassembledisassemble instructions
downgo down N stack frames
enableswitch processor on
framechange current stack frame
infoprint information about the processor
instruction-fetch-modeset or get current mode for instruction fetching
io-readperform an I/O read inquiry coming from the processor
io-writeperform an I/O write inquiry coming from the processor
listlist source and/or disassemble
list-memory-profilerslist memory profilers connected to the processor
load-binaryload binary (executable) file into memory
logical-to-physicaltranslate logical address to physical
posaddress of line or function
pregsprint cpu registers
pregs-hyperprint hypervisor registers
print-statisticsprint various statistics
print-timeprint number of steps and cycles executed
psymprint value of symbolic expression
readperform a read inquiry coming from the processor
read-regread a register
register-numberget the number of a processor register
remove-memory-profilerremove a memory profiler from the processor
set-contextset the current context of a CPU
set-pcset the program counter
stack-tracedisplay stack trace
start-instruction-profilingget started with instruction profiling
step-breakset time breakpoint
step-break-absoluteset absolute time breakpoint
sumdeprecated — sum a memory range
symvalevaluate symbolic expression
trace-crtrace control register updates
unbreak-crbreak on control register updates
untrace-crtrace control register updates
upgo up N stack frames
wait-for-cyclewait until reaching cycle
wait-for-stepwait until reaching step
writeperform a write inquiry coming from the processor
write-regwrite to register
xexamine raw memory contents

Command Descriptions

<processor>.add-memory-profiler
Synopsis
<processor>.add-memory-profiler "type" [profiler]
Description
Add a data profiler to the specified processor that will record either reads or writes to memory (indexed on physical address) depending on whether the type argument is 'read' or 'write'. An existing data profiler may be specified with the profiler argument; otherwise, a new data profiler will be created.
<processor>.aprof-views
Synopsis
<processor>.aprof-views [add] [remove] [view] [-clear]
Description
Manipulate the processor attribute aprof-views, which determines which address profiler views are displayed alongside disassembled code.

The add and view arguments select an address profiler view to add to the list. Alternatively, the remove and view arguments specify an address profiler view to remove from the list. view defaults to 0 if not specified.

If called with the -clear flag, remove all address profiler views from the list.

If called without arguments, print a detailed list of the currently selected address profiler views for the processor.

<processor>.attach-branch-recorder
Synopsis
<processor>.attach-branch-recorder branch_recorder
Description
Attach the branch recorder branch_recorder to the processor, so that it will record its branches. Note that once you have attached a branch recorder to a processor, it adapts to that processor type and you cannot attach it to other processors of different types.
See Also
<processor>.detach-branch-recorder
<processor>.break-cr
Synopsis
<processor>.break-cr ("register"|-all|-list)
<processor>.unbreak-cr ("register"|-all|-list)
break-cr ("register"|-all|-list)
unbreak-cr ("register"|-all|-list)
Description
Enables and disables breaking simulation on control register updates. When this is enabled, every time the specified control register is updated during simulation a message is printed. The message will name the register being updated, and the new value. The new value will be printed even if it is identical to the previous value.

The reg-name parameter specifies which control register should be traced. The available control registers depends on the simulated target.

Instead of a register name, the -all flag may be given. This will enable or disable tracing of all control register.

See Also
trace-cr, <breakpoint>.break
<processor>.cycle-break
Alias
<processor>.cb
Synopsis
<processor>.cycle-break cycles
cycle-break [cpu-name] cycles
Description
Sets a breakpoint so that the CPU will stop after running cycles number of cycles from the time the command was issued. If the CPU is not specified the selected frontend processor will be used (see pselect).

To list all breakpoints set use the command list-breakpoints.

See Also
cycle-break-absolute, step-break, step-break-absolute, list-breakpoints
<processor>.cycle-break-absolute
Alias
<processor>.cba
Synopsis
<processor>.cycle-break-absolute cycles
cycle-break-absolute [cpu-name] cycles
Description
Set a breakpoint so that the selected CPU will stop after its cycle counter has reached the cycles value. If the CPU is not specified the selected frontend processor will be used (see pselect).

To list all breakpoints set use the command list-breakpoints.

See Also
cycle-break, step-break, step-break-absolute, list-breakpoints
<processor>.detach-branch-recorder
Synopsis
<processor>.detach-branch-recorder branch_recorder
Description
Detach the branch recorder branch_recorder from the processor.
See Also
<processor>.attach-branch-recorder
<processor>.disable
Synopsis
<processor>.disable
<processor>.enable
pdisable [(cpu-name|-all)]
penable [(cpu-name|-all)]
Description
Enables a processor. If no processor is specified, the current processor will be enabled. If the flag -all is passed, all processors will be enabled.

pdisable takes processor as parameter. If no processor is given, it will list all enabled processors. The method variant can also be used to disable a processor. A disabled processor is simply stalled for an infinite amount of time. Make sure that you always have at least one enabled processor.

<processor>.disassemble
Alias
<processor>.da
Synopsis
<processor>.disassemble [address] [count]
disassemble [cpu-name] [address] [count]
Description
Disassembles count instructions starting at address for processor cpu-name. If the processor is not given the current frontend processor will be used. The method variant can also be used to select a processor; e.g., cpu0.disassemble.

On some architectures, address must be word aligned. A physical address is given by prefixing the address with p: (e.g., p:0xf000). With no prefix, a virtual address will be assumed. If the address is omitted the current program counter will be used. count defaults to 1 instruction.

Global disassembly settings, such as whether to print the raw opcodes, can be set by the disassemble-settings command.

This command will also include various profiling statistics for the address of each instruction, one column for each profiler view listed in the processor attribute aprof-views. For descriptions of the columns, use the <processor>.aprof-views command.

See Also
x, disassemble-settings, <processor>.aprof-views
<processor>.down
Synopsis
<processor>.down [N]
Description
Moves N frames down the stack (towards the innermost frame). N defaults to one.
See Also
frame, up, stack-trace
<processor>.enable
Synopsis
<processor>.enable
<processor>.disable
pdisable [(cpu-name|-all)]
penable [(cpu-name|-all)]
Description
Enables a processor. If no processor is specified, the current processor will be enabled. If the flag -all is passed, all processors will be enabled.

pdisable takes processor as parameter. If no processor is given, it will list all enabled processors. The method variant can also be used to disable a processor. A disabled processor is simply stalled for an infinite amount of time. Make sure that you always have at least one enabled processor.

<processor>.frame
Alias
<processor>.f
Synopsis
<processor>.frame [frame-number]
Description
Changes current stack frame to frame-number, or displays the current frame.
See Also
stack-trace, psym, up, down
<processor>.info
Synopsis
<processor>.info
Description
Print detailed information about the configuration of the processor.
<processor>.instruction-fetch-mode
Alias
<processor>.ifm
Synopsis
<processor>.instruction-fetch-mode ["mode"]
instruction-fetch-mode ["mode"]
Description
This command selects how instruction fetches are sent for the memory hierarchy during simulation. If set to no-instruction-fetch, the memory hierarchy won't receive any instruction fetch. If set to instruction-cache-access-trace, the memory hierarchy will receive one (and only one) instruction fetch every time a new cache line is accessed. The size of this cache line is defined by the attribute instruction-fetch-line-size in the processor object. If set to instruction-fetch-trace, all instruction fetches will be visible. Note that on x86 target, instruction-cache-trace-access is not available. On some other, instruction-fetch-trace is actually instruction-cache-trace-access with a line size equal to the instruction size (sparc-v9). Using this command without argument will print out the current mode.
<processor>.io-read
Synopsis
<processor>.io-read address size
Description
Perform an I/O read inquiry coming from the processor. Size must be 1,2,4 or 8.
<processor>.io-write
Synopsis
<processor>.io-write address value size
Description
Perform an I/O write inquiry coming from the processor. Size must be 1,2,4 or 8.
<processor>.list
Synopsis
<processor>.list [(-s|-d)] (address|"location") [maxlines]
Description
List the source code corresponding to a given address, function or line. The location can be specified as

line or file:line --- list from given line

function or file:function --- list that function

address --- list from that address

At most maxlines lines of source or asm are printed. -s produces source intermixed with disassembly, and -d only disassembles.

See Also
disassemble, whereis, pos, symval
<processor>.list-memory-profilers
Synopsis
<processor>.list-memory-profilers
Description
List all memory profilers connected to the processor, and what kind of data they are collecting.
<processor>.load-binary
Synopsis
<processor>.load-binary filename [offset] [-v] [-pa]
<memory-space>.load-binary filename [offset] [-v] [-pa]
load-binary filename [offset] [-v] [-pa] [-l]
Description
Load a binary (executable) file into the given physical or virtual memory space. The supported formats are ELF, Motorola S-Record, PE32 and PE32+. If an offset is supplied, it will be added to the load address taked from the file.

By default the virtual load address from the file is used, but the physical address can be used instead by specifying the -pa flag.

The -v flag turns on verbose mode, printing information about the loaded file.

When used as a global command, it will use the currently selected processor to find the memory space to load the binary into. If the -l flag is given, it will load it into the virtual memory space, otherwise it will use the physical memory space.

When using the namespace command on a processor object, it will load the binary into the virtual memory space of that processor.

When using the namespace command on a memory-space object, it will load the binary directly into that memory space.

The return value is the address of the execution entry point. This value is typically used in a call to set-pc.

load-binary uses Simics's Search Path and path markers (%simics%, %script%) to find the file to load. Refer to Simics User Guide (CLI chapter) for more information on how Simics's Search Path is used to locate files.

See Also
add-directory
<processor>.logical-to-physical
Alias
<processor>.l2p
Synopsis
<processor>.logical-to-physical address
logical-to-physical [cpu-name] address
Description
Translate the given logical address to a physical one. The operation is performed as read from processor cpu-name. On x86 a logical address can be given on the form <segment register>:<offset> or l:<linear address>. If no prefix is given ds:<offset> will be assumed. If the CPU is omitted the current CPU will be used. No side-effects will occur, i.e. if the translation is not in the TLB. The method variant of this command can also be used.
<processor>.pos
Synopsis
<processor>.pos (line|"function")
Description
Finds the address of a source line or a function in a given file (e.g., myfile.c:4711 or myfile.c:myfunction). If only a line number is specified, the command looks at the current value of the program counter to determine the current file. (If this command is called from the symtable namespace, no current file is defined.) It may be necessary to put the argument inside double quotes for it to be parsed correctly.
See Also
stack-trace, psym, symval
<processor>.pregs
Synopsis
<processor>.pregs [-all]
pregs [cpu-name] [-all]
Description
Prints the current integer register file of the processor cpu_name. If no CPU is specified, the current CPU will be selected. The -all flag causes additional registers, such as control registers and floating point registers to be printed.
<processor>.pregs-hyper
Synopsis
<processor>.pregs-hyper [-all]
pregs-hyper ["cpu-name"] [-all]
Description
Prints the UltraSPARC T1 specific hypervisor registers for cpu cpu-name. -all will provide a complete listing. If no CPU is specified, the currently selected frontend processor will be used.
See Also
pregs, pregs-all
<processor>.print-statistics
Synopsis
<processor>.print-statistics
print-statistics [(cpu-name|-all)]
Description
Prints various statistics from the simulation. The print-statistics command prints statistics for the currently selected CPU if no argument is given and for all CPUs if the -all flag given. Any statistics that have been compiled into the simulator are printed, as well as user-defined per-mode counters.
<processor>.print-time
Alias
<processor>.ptime
Synopsis
<processor>.print-time [-s] [-c]
Description
Prints the number of steps and cycles that a processor has executed. The cycle count is also displayed as simulated time in seconds.

If called from a processor namespace (e.g., cpu0.print-time), the time for that processor is printed. Otherwise, the time for the current processor is printed, or, if the -all flag is given, the time for all processors.

if the -c flag used, the cycle count for the processor is returned and nothing is printed. The -s flag is similar and returns the step count.

A step is a completed instruction or an exception. An instruction that fails to complete because of an exception will count as a single step, including the exception.

<processor>.psym
Synopsis
<processor>.psym "expression"
Description
Evaluates expression in the current stack frame, and prints the result in a human-readable form. The only C operators allowed are casts, indirection, member selection, and sizeof (thus no arithmetic). You may need to surround the expression by double quotes if it contains certain meta-characters.
See Also
stack-trace, frame, symval
<processor>.read
Synopsis
<processor>.read address size
Description
Perform a read inquiry coming from the processor. Size must be 1,2,4 or 8. On processors that request it, the address must be aligned to the size.
<processor>.read-reg
Synopsis
<processor>.read-reg "reg-name"
read-reg [cpu-name] "reg-name"
Description
This command reads a CPU register. For example, to read the eax register in an x86 processor called cpu0, write read-reg cpu0 eax. You can also use the method variant: cpu0.read-reg eax, or the more convenient variant %eax that reads a register from the selected frontend CPU.

If no cpu-name is supplied, the current frontend processor is used.

See Also
%, write-reg, pregs, pselect
<processor>.register-number
Synopsis
<processor>.register-number "reg-name"
Description
Returns the register number for a named processor register. The register number is used as hap indexing for example.
See Also
%, read-reg
<processor>.remove-memory-profiler
Synopsis
<processor>.remove-memory-profiler "type"
Description
Remove any memory profiler of the specified type ('read' or 'write') currently attached to the processor.
<processor>.set-context
Synopsis
<processor>.set-context "context"
set-context "context"
Description
Sets the current context of the processor cpu (or the selected cpu) to context. If the context does not exist, it is created.
See Also
new-context, <context>.symtable
<processor>.set-pc
Synopsis
<processor>.set-pc address
set-pc address
Description
Set program counter (instruction pointer) of the CPU (defaults to the current frontend processor) to address.
<processor>.stack-trace
Alias
<processor>.bt, <processor>.where
Synopsis
<processor>.stack-trace [maxdepth]
Description
Displays a stack trace in the current context of the specified processor, or the current processor if none was specified. At most maxdepth frames are shown, 64 by default.
See Also
frame
<processor>.start-instruction-profiling
Synopsis
<processor>.start-instruction-profiling
Description
This command gets you started with instruction profiling quickly by creating a branch recorder for you and attaching it to the processor. If you want more control, use other profiling commands instead.

It creates a branch recorder and attaches it to the processor, just as if you had typed

new-branch-recorder branch_recorder physical

cpu.attach-branch-recorder branch_recorder

The branch recorder will (as the name implies) record branches taken by the processor (by physical addresses); various useful numbers can be computed from them. You can for example display execution count statistics by typing

branch_recorder.address-profile-data

(but you will not see anything interesting until you have let the processor run a few instructions).

See Also
new-branch-recorder, <processor>.attach-branch-recorder, <address_profiler>.address-profile-data
<processor>.step-break
Alias
<processor>.sb, <processor>.sim-break
Synopsis
<processor>.step-break instructions
step-break [cpu-name] instructions
Description
Sets a breakpoint so that the CPU will stop after executing instructions number of steps from the time the command was issued. If the CPU is not specified the selected frontend processor will be used (see pselect).

To list all breakpoints set use the command list-breakpoints.

See Also
step-break-absolute, cycle-break, cycle-break-absolute, list-breakpoints
<processor>.step-break-absolute
Alias
<processor>.sba, <processor>.sim-break-absolute
Synopsis
<processor>.step-break-absolute instructions
step-break-absolute [cpu-name] instructions
Description
Set a breakpoint so that the selected CPU will stop after its step counter has reached the instructions value. If the CPU is not specified the selected frontend processor will be used (see pselect).

To list all breakpoints set use the command list-breakpoints.

See Also
step-break-absolute, cycle-break, cycle-break-absolute, list-breakpoints
<processor>.sum — deprecated
Synopsis
<processor>.sum address size [-w8] [-w16] [-w32]
sum [cpu-name] address size [-w8] [-w16] [-w32]
Description
This command is deprecated, use python instead.

Sum a memory range. The width of the running sum is specified with the -w8 (default), -w16, or -w32 flag, standing for 8, 16, and 32 bits respectively.

<processor>.symval
Alias
<processor>.sym
Synopsis
<processor>.symval "expression"
Description
Evaluates expression in the current stack frame. The only C operators allowed are casts, indirection, member selection, and sizeof (thus no arithmetic). You may need to surround the expression by double quotes if it contains certain meta-characters. In contrast to psym, the result is returned as an unadorned value that can be used in CLI expressions.
See Also
stack-trace, frame, psym
<processor>.trace-cr
Synopsis
<processor>.trace-cr ("register"|-all|-list)
<processor>.untrace-cr ("register"|-all|-list)
trace-cr ("register"|-all|-list)
untrace-cr ("register"|-all|-list)
Description
Enables and disables tracing of control register updates. When this is enabled, every time the specified control register is updated during simulation a message is printed. The message will name the register being updated, and the new value. The new value will be printed even if it is identical to the previous value.

The reg-name parameter specifies which control register should be traced. The available control registers depends on the simulated target.

Instead of a register name, the -all flag may be given. This will enable or disable tracing of all control register.

See Also
break-cr
<processor>.unbreak-cr
Synopsis
<processor>.unbreak-cr ("register"|-all|-list)
<processor>.break-cr ("register"|-all|-list)
break-cr ("register"|-all|-list)
unbreak-cr ("register"|-all|-list)
Description
Enables and disables breaking simulation on control register updates. When this is enabled, every time the specified control register is updated during simulation a message is printed. The message will name the register being updated, and the new value. The new value will be printed even if it is identical to the previous value.

The reg-name parameter specifies which control register should be traced. The available control registers depends on the simulated target.

Instead of a register name, the -all flag may be given. This will enable or disable tracing of all control register.

See Also
trace-cr, <breakpoint>.break
<processor>.untrace-cr
Synopsis
<processor>.untrace-cr ("register"|-all|-list)
<processor>.trace-cr ("register"|-all|-list)
trace-cr ("register"|-all|-list)
untrace-cr ("register"|-all|-list)
Description
Enables and disables tracing of control register updates. When this is enabled, every time the specified control register is updated during simulation a message is printed. The message will name the register being updated, and the new value. The new value will be printed even if it is identical to the previous value.

The reg-name parameter specifies which control register should be traced. The available control registers depends on the simulated target.

Instead of a register name, the -all flag may be given. This will enable or disable tracing of all control register.

See Also
break-cr
<processor>.up
Synopsis
<processor>.up [N]
Description
Moves N frames up the stack (towards the outermost frame). N defaults to one.
See Also
frame, down, stack-trace
<processor>.wait-for-cycle
Synopsis
<processor>.wait-for-cycle cycle
Description
Postpones execution of a script branch until the processor reaches the specified cycle in the simulation.
See Also
script-branch, wait-for-variable, wait-for-hap, <text-console>.wait-for-string, <processor>.wait-for-step
<processor>.wait-for-step
Synopsis
<processor>.wait-for-step step
Description
Postpones execution of a script branch until the processor reaches the specified step in the simulation.
See Also
script-branch, wait-for-variable, wait-for-hap, <text-console>.wait-for-string, <processor>.wait-for-cycle
<processor>.write
Synopsis
<processor>.write address value size
Description
Perform a write inquiry coming from the processor. Size must be 1,2,4 or 8. On processors that request it, the address must be aligned to the size.
<processor>.write-reg
Synopsis
<processor>.write-reg "reg-name" value
write-reg [cpu-name] "reg-name" value
Description
Use this command to set the value of a CPU register. For example, to set the eax register on the x86 processor cpu0 to 3, write write-reg cpu0 eax 3. You can also use the method variant: cpu0.write-reg eax 3.

This function may or may not have the correct side-effects, depending on target and register. If no cpu-name is given, the current frontend processor is used.

See Also
%, read-reg, pregs, pselect
<processor>.x
Synopsis
<processor>.x address [size]
<memory-space>.x address [size]
x [cpu-name] address [size]
Description
Display the contents of a memory space starting at address. Either the memory space is explicitly specified as in <memory-space>.x or the CPU connected to the memory space can be specified; e.g., <processor>.x. By itself, x operates on the memory connected to the current frontend processor.

If the memory is accessed via a CPU, the type of address is specified by a prefix. For physical addresses use p:address; for virtual addresses, v:address on non-x86 targets. On x86, use segment-register:offset or l:address for x86 linear addresses.

If no prefix is given it will be interpreted as a virtual address. On x86 the default is ds:address (data segment addressing).

The size argument specifies the number of bytes to examine. When examining virtual memory, only addresses which can be found in the TLB or hardware page tables (if any) are shown. Unmapped addresses are shown as "--", undefined physical addresses as "**".

See Also
disassemble, get, set

VIRTUTECH CONFIDENTIAL    Previous - Up - Next