HP IA-64 manual Resolving Ambiguous Symbols and Numbers, Internal Variables, Labels, Filenames

Models: IA-64 Ski Simulator

1 110
Download 110 pages 21.23 Kb
Page 57
Image 57

Ski IA-64 Simulator Reference Manual 1.0L

assigns the value contained in the ip register to general register 31. (For a description of the = command, see Section 8.1, “Changing Registers and Memory with Assignment Commands”.) Wherever the simulator expects you to supply a numeric argument, you can use a register instead. You may only refer to currently-visible registers, according to the stack- ing and rotation mechanisms of the IA-64 architecture.

4.4.2.3Internal Variables

The simulator provides internal variables for you to use in command files (see Chapter 9, “Command Files”). These inter- nal variables are read-only; you cannot change their values. You can refer to an internal variable in any context where you could refer to an IA-64 register. Ski has four internal variables:

$cycles$

The total number of “virtual cycles” simulated. A virtual cycle is a cycle on a machine with an very large number of execution units and very fast memory; a real IA-64 processor may take more cycles. In a command file, you might use this variable to gather statistics about the efficiency of a particular compiler optimization algorithm. The value of $cycles$ is always equal to the value of $insts$ for IA-32 programs.

$exited$

The value 0 until the simulated program exits. Then the variable takes the value 1. In a command file, you would use $exited$ to detect a program termination. Program termination is defined for IA-64 application-mode programs as a call to the exit() function or the receipt of an unhandled signal. For IA-64 system-mode programs, normal termi- nation is defined to be a call to the Simulator System Call exit function or execution of BREAK 0 instruction. This variable is not supported for IA-32 programs in application-mode or system-mode. (See Section 6.1, “Application- Mode and System-Mode Simulation” for details on these modes.)

$heap$

This variable has meaning only for IA-64 programs running in application-mode, as described in Section 6.1, “Application-Mode and System-Mode Simulation”. $heap$ marks the address past the “far end” of the simulated heap, that is, the end farthest from the end of the data section. The heap starts at the first sixteen-byte-aligned address after the data section. Ski updates the $heap$ variable as the program being simulated malloc’s memory (for pro- grams written in C; adapt accordingly for other programming languages). You can use the $heap$ variable to debug wild pointer problems: if your program has a pointer that allegedly points to a malloc’ed data structure, but the pointer value exceeds $heap$, the pointer is invalid. For system-mode programs and IA-32 programs, this variable is meaningless, as there is no malloc support.

$insts$

The number of instructions that have been simulated so far (including any faulting instructions, for programs run- ning in system-mode, described in Section 6.1, “Application-Mode and System-Mode Simulation”). In a command file, you might use this variable to stop simulation after a certain number of instructions. The value of $insts$ is always equal to the value of $cycles$ for IA-32 programs.

4.4.2.4Labels

Labels (see Section 9.2, “Labels and Control Flow in Command Files”) are names which consist of an alpha (upper or lower case alphabetic, $, or _), followed by a sequence of alphas or digits (e.g., abc123, $foo_bar, etc.) and ending with a colon (“ :”). They may be up to 132 characters long. Labels are used in command files as targets of the goto command.

4.4.2.5Filenames

Filenames are subject to the restrictions of the underlying Linux operating system. Ski performs tilde (“ ~”) expansion: if you provide a pathname whose first word starts with a tilde, Ski assumes the word is a username and tries to replace it (and the tilde) with the user’s home directory. For example, “ ~david/hello” might be expanded to “ /home/david/ hello”.

4.4.3Resolving Ambiguous Symbols and Numbers

Some character sequences can be interpreted in more than one way. For example, the character sequence “b3” can be interpreted as a branch register, a program-defined symbol, or a hexadecimal number. To resolve the ambiguity, Ski looks

Copyright © 2000 Hewlett-Packard Co.

Command Language 4-5

Page 57
Image 57
HP IA-64, Ski Simulator manual Resolving Ambiguous Symbols and Numbers, Internal Variables, Labels, Filenames