The information in this document is subject to change without notice.
HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUD-
ING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE.
Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection
with furnishing, performance, or use of this material.
This document contains information which is protected by copyright. All rights are reserved. No part of this document
may be photocopied, reproduced, or translated to another language without the prior written consent of Hewlett-Packard.
Linux is a registered trademark of Linus Torvalds.MS-DOS and Windows are registered trademarks of Microsoft Corporation. UNIX is a trademark or registered trademark of the Santa Cruz Operation. Intel is a registered trademark of the Intel
Corporation.
This document is the Ski IA-64 Simulator Reference Manual. The goal of this document is to provide a description of the
features, commands, and simulation environment provided by the Ski IA-64 simulator. The version of the simulator
described here is Version 0.873l.
How to Use This Manual
The first chapter of this manual is a quick-start tutorial. Using only the first chapter, you can learn enough about Ski to do
useful work. If you are using Ski to simulate an IA-64 application program and are familiar with debuggers such as HP’s
xdb, the first chapter and Appendix A, “Command Reference” may be all you need to read.
The remaining chapters provide information about Ski in depth. Use these chapters to learn about commands not covered
in the tutorial and to learn more about how Ski operates.
Use Appendix A, “Command Reference” and the on-line help command to find a list of all Ski commands and a brief
description of each command.
Use Appendix D, “Simulator Status and Error Messages” to understand the causes and possible solutions for each of Ski’s
error messages.
Font Conventions
In this manual, fonts are used as described below.Depending on how you are viewing this document (paper, a web page, a
PDF file, etc.), some distinctions may not be visible.
italic
is used for optional text including operand fields such as count, and for the names of bitfields such as psr.be.
light italic
is used for graphical button names such as
fixed-width bold
is used for literal text including commands such as dbndl, and for examples such as bski -icnt foo <bar >baz.
SMALL UPPERCASE
is used for processor instructions such as BREAK.
fixed-width regular
is used for directories and filenames such as hello, and for web URL’s such as http://www.hp.com.
Run
.
Syntax Conventions
In this manual, symbols are used as described below.
[italic]
Square brackets surrounding optional argument(s) indicate that the argument(s) can be omitted, as in the Appendix
A, “Command Reference” description of the dj command: dj [address].
A plus sign applied to an argument indicates that the argument must be supplied one or more times, as in the Appendix A, “Command Reference” description of the eval command: eval expression_without_spaces+.
[italic]+
A plus sign applied to optional argument(s) in square brackets indicates that the argument(s) can be supplied zero or
more times, as in the Appendix A, “Command Reference” description of the load command: load filename [args]+.
Figure 8-1.The Original Program Loaded in
Figure 8-2.The Program After Assigning a String in
Figure 8-3.Three Breakpoints, 0, 2, and 1, Visible in
Figure 8-4.
Figure 8-5.The symlist Output from
In this chapter, you learn how to use Ski by executing a brief tutorial. At the end of the tutorial, you will learn where to
look in this manual for detailed descriptions of Ski’s operation and commands. Introductory information on Ski is presented in Chapter 2, “Overview”.
1.1The Ski Simulator
Ski simulates the IA-64 architecture and also has limited support for simulating IA-32 programs. Ski runs on IA-32 Linux
host systems. You can use Ski for many purposes, as described in Section 2.1, “Introduction”. One of the most common
uses of Ski is to test an IA-64 program in a Linux environment, and in this chapter, you will learn how to use
Window System version of Ski, by “walking through” a sample session, in about ten minutes. Ok, twenty minutes.
xski
, the X
You should already be familiar with the IA-64 architecture and the C programming language, have
Linux system, and have the XSki file in your home directory or in your X Window System app-defaults directory, typically /usr/lib/X11/app-defaults. You will also need to have an executable Linux IA-64 program such as the classic
“hello world” program.
xski
installed on your
1.2How to Run an IA-64 Application Program
Ski provides a Linux application environment in which an IA-64 program you provide can be simulated. The release notes
provide the most up-to-date information on Ski’s support for the Linux Application Binary Interface (ABI). The following
sections provide a short tutorial which leads you through an IA-64 program session with
the most common Ski commands.
1.2.1Starting
As shown in Figure 1-1, start
Figure 1-1. When running inside the IA-64 Linux Native User Environment (NUE), make sure that the environment variable DISPLAY is set to a string of the form
won’t work) before invoking
the software license it is distributed under. After accepting the license, the four primary
on your screen, as shown in Figure 1-2. No IA-64 program is loaded yet, so the Program Window and Data Window are
empty. Scroll the various panes of the Register Window and note that with few exceptions, the registers are set to zero.
xski
xski
xski
by typing its name to the Linux shell, just like any other Linux program, as shown in
hostname:display
. If you have never run the simulator before, it will first prompt you to read and accept
(e.g., ‘‘myhost:0’’, values such as ‘‘unix:0’’ or ‘‘:0’’
You can quit
mand. All are in the Main Window. (Don’t quit now; you are just beginning!)
xski
and this tutorial with the
Quit
button, with the File->Quit menu selection, or with the “quit” com-
1.2.3Loading Your Program
Use the “Command” area of the “main” Window to load your program. For example, let’s say your program is the famous
“Hello, world” program, the executable file is named “hello”, and the source code file is named “hello.c”. Type “load
hello
” in the Command area to load it into Ski, as you see in Figure 1-3. After a moment, the other three windows will
change appropriately: the Program Window will show the program code in assembly language form as shown in
Figure 1-4, the Data Window will show global and static data as shown in Figure 1-5, and the Register Window will show,
in r12 the value of the stack pointer, as shown in Figure 1-6. (You may need to use the scrollbar in the general registers
pane of the Register Window to see these registers.)
To look at the argv and envp strings, you need to use the Data Window. Linux passes argc, argv, and envp on the memory stack (r12). To look at this memory area, use the “dj” command (“data jump”) in “Command” area of the Main Window. Supply, as an operand, the address of the memory stack. For example, if r12 is set to 9ffffffffff780, you can
type “dj r12”or“dj 9ffffffffff780”, as shown in Figure 1-7 and the Data Window changes to display the hexadec-
imal data stored at the location, as shown in Figure 1-8. Find the value of r12 in your program and use “dj”now.(You
might wonder why “dj” exists, instead of a simple scroll bar. Imagine scrolling through the entire IA-64 address space– it
would take a long, long time!)
Figure 1-7. Changing the Data Window Display
Figure 1-8. The Data Window Showing the argv and envp Vectors
Looking at the Data Window, you can see that the first 16 bytes of the stack are all zeros. This is a scratch storage area.
The next 8-byte word contains argc, the argument count. It has a value of 1 as the only argument passed to the program is
the program name itself. The argc count is then followed by the argv and envp vectors. All C programs receive the same
kind of data structure for argv: a variable-length vector of char * pointers whose end is marked with a NULL pointer. In
Figure 1-8, the first of the char * pointers is 9ffffffffffff938. (The first char * pointer may be in a different place
on your system. Adjust the following instructions accordingly.) Jump the Data Window there using the command “dj
9ffffffffffff938
” (12 f’s) and you will see Figure 1-9, showing the hexadecimal codes for the null-terminated ASCII
character strings of argv and envp. (In a moment, you’ll learn how to see data in ASCII translation.)
Figure 1-9. The Data Window Showing argv and envp Strings in Hexadecimal
Typing hexadecimal numbers is error-prone, and Ski provides several shortcuts to avoid it. The first is
History,an unlabeled window pane just above the “Command” area in the Main Window. As you execute commands, they
move up to the Command History. Later, you can bring them back into the Command area. A single click brings a command back for you to edit. A double click brings the command back and re-executes it immediately. Try the Command
History by doing this: Type “dj 0” to jump the Data Window to location 0. The Main Window should look like
Figure 1-10. Then click on the “dj 9ffffffffffff938” command in the Command History. Hit the enter/return key to
execute it.
xski
’s Command
Figure 1-10. The Main Window Showing Commands in the Command History
Another shortcut is the * pointer-dereference operator for indirect addressing. Type “dj 0” to jump the Data Window to
location 0. Then type “dj *(r12+18)”. Ski will take the contents of r12 (9ffffffffff780, remember?), add 18 (hex)
and use that as the address of the operand. The * operator fetches the contents of *(r12+18) and uses that value,
9ffffffffff938, as the address to jump to. Compare the Data Window display resulting from “dj r12+18” with the
display resulting from “dj *(r12+18)”.
You will use the * operator a lot in debugging C programs because it performs the same function as C’s * operator: it
dereferences pointers. Unlike C’s *, however, Ski’s * operator is not type-specific: you can use it in any context where any
kind of address is needed and you can use it to dereference registers like r12, memory locations, or anything that has a
value. (This doesn’t always make sense, of course. For example, dereferencing a floating-point register is rarely useful
because floating-point registers don’t hold pointers.)
1.2.5Viewing Data in ASCII
Hexadecimal is no fun. To expose the ASCII translation, use your window manager’s standard mechanism to make the
Data Window wider. (How you do this depends on the window manager you’re using, but generally this can be accomplished by grabbing the edge of the Data Window with your mouse cursor and dragging it to the right.) You should see
approximately Figure 1-11. Now click on the Main Window, to make it the active window again. Try the “df”(“data for-
wards”) and “db”(“data backwards”) commands without operands to move forwards and backwards in the Data Window,
one screenful each time.
Figure 1-11. The Data Window Showing argv and envp Strings in ASCII
1.2.6Looking at Code
Initially, the Program Window shows the beginning of the program. For C programs, this isn’t the first line of user code,
it’s the start-up routine from crt1.o that provides an interface between the operating system environment and the ANSI
C environment. This routine is named “_start” and the ELF header in hello names it as the start of the program. That’s
what Ski shows in the Program Window by default: the start of the program according to ELF.
You use the “pj” command (“program jump”) to jump the program window elsewhere. For example, jump it to the first
instruction in the user’s main(), as shown in Figure 1-12. The Program Window now looks like Figure 1-13. You can move
the Program Window forwards and backwards through program code with the “pf”(“program forwards”) and “pb”
(“program backwards”) commands, respectively. Try these commands, and then try using “pj” without an operand: note
how it jumps you back and forth between the previous and current locations. The “dj” command does the same thing in
the Data Window. Handy, eh?
display off or on using the pa (“program assembly”) and pm (“program mixed”) commands, respectively. Mixed code display only works if you have the source code to the program available to Ski; the source code isn’t embedded in the ELF
file. Also, you must compile your code with the appropriate compiler flags, for example, with the -g flag used by many C
compilers to generate debug line record information. If your program is composed of multiple object files, for example
“cc -o test foo.o bar.o baz.o”, Ski can only show source code from the files compiled with the -g flag. Make sure
the Program Window is in mixed mode for now.
1.2.8Controlling Breakpoints
You can think of Ski as a debugger that happens to work on a simulated processor rather than a real processor. Like any
good debugger, Ski provides breakpoints. To set a breakpoint in an IA-64 program, use the “bs” command (“breakpoint
set”). In the example that follows, you will want to have the Program Window display the area of code near main(). Use
the command “pj main”, as you learned above.
To set a breakpoint at the beginning of main(), type “bs main” in the Main Window. The Program Window shows a “0”
in the first column of the window at the breakpoint location (the ‘‘alloc’’ instruction), because you just used breakpoint #0,
as Figure 1-14 shows. (The first three columns are also used for line numbers.) Set a breakpoint at main+10 and another at
main+20. Ski lets you set up to ten breakpoints.
Figure 1-14. The Program Window Showing a Breakpoint at main()
Use the “bl” command (“breakpoint list”) to see a list of the breakpoints, as shown in Figure 1-15. If you prefer using a
mouse, use the “Breakpoints” item on the View menu instead of the “bl” command. When you are finished viewing the
breakpoint list, click its
To delete breakpoints individually, use the “bd” command (“breakpoint delete”). Use the “bD” command (“breakpoint
Delete all”) to delete all breakpoints at once. Delete all your breakpoints before continuing this tutorial.
To run your program, type the “run” command or click the
and connect the program’s standard I/O ports (stdin, stdout, and stderr) to Ski’s standard ports. For example, assuming
there are no breakpoints still set in hello, you will see “hello world” printed out when you run it, as Figure 1-16 shows,
and run statistics will appear in the Main Window, as Figure 1-17 shows. The statistics tell you how many instructions
were simulated and how much time it took, the instructions-per-second rate, the number of IA-64 processor cycles that
were consumed on the simulated CPU, and the average number of instructions per cycle, which provides an indication of
the best-case effective parallelism of the program. (Ski simulates all the instructions in an instruction group in one cycle;
a hardware implementation may not be as capable.)
Ski will stop the simulation for three reasons: if a breakpoint is reached, if the IA-64 program attempts to access privileged resources or non-existent memory, or if the program ends normally by calling exit() or similar functions. If simulation stops due to a breakpoint, you can continue simulation with the “cont” command (“continue”) or you can step
through the simulation with the “step” command or
start over. You must exit and re-enter
xski
and then reload your program.
Step
Run
button in the Main Window. Ski will start the simulation
button. You cannot re-run a program, nor can you re-load it and
Figure 1-16. The Terminal Window After the “hello” Program is Run
Figure 1-17. The
xski
Main Window after the “hello” Program is Run
1.2.10Single-stepping a Program
To try single-stepping (and no, this is not a kind of ethnic dance), set a breakpoint at main+10. Then use the “run” command or
stop and reread the last sentence in the previous paragraph.) Ski stops at the breakpoint and notifies you with a message in
button to simulate the program up to the breakpoint. (If you receive the error message “Nothing to run”,
Ski IA-64 Simulator Reference Manual 1.0L
the Main Window. Ski tells you why it stopped and gives you statistics about program execution up to this point, as you
can see in Figure 1-18. The Program Window marks the next instruction to be fetched with a greater-than symbol in the
second column. If the instruction is predicated off, Ski uses an asterisk instead of a greater-than symbol, and shows the
predication register in parentheses.
Figure 1-18. The Main Window After Reaching the Breakpoint at main+10
Move and resize your windows so the Main Window and Program Window don’t overlap. Now use the “step” command
or
Step
button to execute one instruction. Note that the greater-than symbol moves down one line: Ski keeps track of IA64 bundles and groups but it simulates individual instructions. You can follow the “step” command with a (decimal)
number to specify how many steps Ski should take, for example, “step 10” to execute ten instructions. As a shortcut,
shift-clicking on the
Appendix A, “Command Reference”. The step command can be abbreviated as “s”.
Step
button causes Ski to take ten steps. Most Ski commands can be abbreviated, as described in
1.2.11Changing Registers and Memory
To debug a program, you usually need to inspect and alter registers and memory. The first three panes in the Register Window shows the registers of most concern to application programmers: user registers in the first pane, general registers in
the second pane, and floating point registers in the third pane, as you can see in Figure 1-19.
By changing the value of the ip register,you can change where in the program Ski will resume simulation. Enter the command “= ip main+20” in the Main Window and observe the first line of the first pane in the Register Window: notice
that the ip register changes to reflect your command, as Figure 1-20 shows. (You may need to left-click in the Main Window to make it active.) You can make similar changes to all of the architecturally-visible, non-hardwired IA-64 registers,
which helps you debug your program. You can test your program’s behavior in exceptional cases, such as handling
unusual errors.
xski
Register Window After Stopping at a Breakpoint at main+10
Changing registers isn’t enough to debug most programs, however. Often, you need to change values in memory as well.
Ski provides several commands for this, differing in whether they modify one-byte chunks, two-byte chunks, four-byte
chunks, eight-byte chunks, or variable-length C-language text strings. For example, instead of “hello world”, you can
have the program output “Ski!Ski!Ski!”. You can do this by using the “=s” command (“=string”) to modify the data
stored at the address “_IO_stdin_used+8”. (The string may be stored at a different address in your program. If so, use
the Data Window to locate the string and then use the corresponding address instead.) Here’s what to do:
First, make sure the Data Window is wide enough to show ASCII translations along with hexadecimal, as in Figure 1-21.
To avoid confusion, make sure the Data Window doesn’t overlap the Main Window.
Next, issue the command “=s _IO_stdin_used+8 Ski!Ski!Ski!” in the Main Window. (Youmay need to left-click in
the Main Window to make it active.) Observe how the Data Window changes: the hexadecimal values at, and after,
_IO_stdin_used+8 have changed, as have their corresponding ASCII translations, and a null byte (the value zero) has
been added to the end of your string to make it a valid C-language string. Compare Figure 1-21 and Figure 1-22.
Figure 1-22. The
xski
xski
Data Window Widened to Show ASCII
Data Window After Changing the “Hello, world” String
The commands to change one, two, four, and eight byte quantities are =1, =2, =4, and =8, respectively. They are described
in detail in Appendix 8.1, “Changing Registers and Memory with Assignment Commands” and in Appendix A, “Command Reference”.
Often, you will need to evaluate formulas. For example, to find the address of the first envp string, you would need to
compute the sum of the contents of r12 and 18 (hex) and then add the length of the argv vector (argc+1) multiplied by
eight (the size of a char * on IA-64). To do this, you use the “eval” command in the Main Window, as shown in
Figure 1-23. (The use of the “*” operator was discussed in Section 1.2.4, “Inspecting Data”.) As you see, the result is
shown in decimal and hexadecimal.
Main Window Showing an eval Command and Its Result
1.2.12Getting Help
To see what commands are available, type “help” in the Main Window or use the Help->Commands menu selection. To
see the syntax of a specific command, type “help” followed by the command name, as in “help eval”.
1.2.13Next Steps
Congratulations! You now know how to use
to use
ski
and
bski
and the many additional commands and facilities not covered in this brief tutorial.
• Chapter 2, “Overview” presents the capabilities of Ski, how to start it and stop it, and a brief discussion of installation
issues. The chapter also shows how to use
• Chapter 3, “Screen Presentation”, discusses the various screen displays of
• Chapter 4, “Command Language”, defines the syntax of the language you use to control Ski’s operation.
• Chapter 5, “Screen Manipulation Commands”, presents the Ski commands for controlling Ski’s screen displays.
• Chapter 6, “Program Simulation”, introduces the concepts of Ski program simulation, shows you how to load programs, and presents the Ski commands for simulating a program. Much of the information needed to use Ski for firmware development and operating system simulation is in this chapter.
• Chapter 7, “Linux and MS-DOS ABI Emulation”, discusses the Ski mechanisms and support for simulating application programs. If you are using Ski for to develop system software, such as bootstrap firmware or operating systems,
you can skip this chapter.
xski
to test an IA-64 program. In the rest of this manual, you’ll find out how
bski
for batch simulations.
xski
and
ski
in depth.
• Chapter 8, “Debugging”, presents Ski commands and facilities that are useful in debugging and tuning programs.
• Chapter 9, “Command Files”, introduces command files, a mechanism that lets you extend Ski to meet your particular
needs.
• The appendices contain summaries of the Ski command set, a list of the registers and internal variables Ski recognizes, and a description of the Ski error and status messages, their causes, and, for error messages, possible solutions.