Ski IA-64 Simulator Reference Manual Rev. 1.0L (26 Apr 00) Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L Notice The information in this document is subject to change without notice. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, 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.
Ski IA-64 Simulator Reference Manual 1.0L Preface 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.
Ski IA-64 Simulator Reference Manual 1.0L italic+ 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]+.
Ski IA-64 Simulator Reference Manual 1.0 Table of Contents 1 Getting Started: A Ski Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 The Ski Simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 How to Run an IA-64 Application Program . . . . . . . . . . . . . . . . . . 1.2.1 Starting xski . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.2 Exiting Ski . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2.3 Loading Your Program . . . . . . . .
Ski IA-64 Simulator Reference Manual 1.0 4.1 4.2 4.3 4.4 5 6 7 8 Command Entry . . . . . . . . . . . . . . . . . . . . . . . . . Command Arguments . . . . . . . . . . . . . . . . . . . . . . Command Sequences, Repetition, and Abbreviation . . . . . . Argument Specification . . . . . . . . . . . . . . . . . . . . . 4.4.1 Numeric Arguments . . . . . . . . . . . . . . . . . 4.4.2 Symbolic Arguments . . . . . . . . . . . . . . . . . 4.4.3 Resolving Ambiguous Symbols and Numbers . . . .
Ski IA-64 Simulator Reference Manual 1.0 8.7.1 Summary of Symbol Commands . 9 Command Files . . . . . . . . . . . . . . . . . . . 9.1 Initialization File . . . . . . . . . . . . . . . 9.2 Labels and Control Flow in Command Files. 9.2.1 The goto Command and Labels . 9.2.2 The if Command . . . . . . . . . 9.3 Comments in Command Files . . . . . . . . 9.4 An Example Command File . . . . . . . . . 9.5 Summary of Command File Commands . . . A Command Reference . . . . . . . . . . . . . . . . B Register Names . .
Ski IA-64 Simulator Reference Manual 1.0 viii Table of Contents Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L List of Figures Figure 1-1. Figure 1-2. Figure 1-3. Figure 1-4. Figure 1-5. Figure 1-6. Figure 1-7. Figure 1-8. Figure 1-9. Figure 1-10. Figure 1-11. Figure 1-12. Figure 1-13. Figure 1-14. Figure 1-15. Figure 1-16. Figure 1-17. Figure 1-18. Figure 1-19. Figure 1-20. Figure 1-21. Figure 1-22. Figure 1-23. Figure 2-1. Figure 2-2. Figure 2-3. Figure 3-1. Figure 3-2. Figure 3-3. Figure 3-4. Figure 3-5. Figure 3-6. Figure 3-7. Figure 3-8. Figure 3-9. Figure 3-10.
Ski IA-64 Simulator Reference Manual 1.0L Figure 8-1. Figure 8-2. Figure 8-3. Figure 8-4. Figure 8-5. Figure 9-1. x The Original Program Loaded in ski . . . . . . . . . . . . . . . . . . . The Program After Assigning a String in ski . . . . . . . . . . . . . . . Three Breakpoints, 0, 2, and 1, Visible in xski’s Program Window . . . xski’s Breakpoint List Window Showing IA-64 and IA-32 Breakpoints. The symlist Output from xski . . . . . . . . . . . . . . . . . . . . . .
Ski IA-64 Simulator Reference Manual 1.0L List of Tables Table 4-1. Table 7-1. Table 7-2. Table 7-3. Ski Simulator Arithmetic and Logic Operators . . . . . . . Linux System Calls Supported by Ski . . . . . . . . . . . Linux System Calls Accepted but Ignored by Ski . . . . . MS-DOS System Calls (in Hexadecimal) Supported by Ski Copyright © 2000 Hewlett-Packard Co. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Ski IA-64 Simulator Reference Manual 1.0L xii List of Tables Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L 1 Getting Started: A Ski Tutorial 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.1 The Ski Simulator Ski simulates the IA-64 architecture and also has limited support for simulating IA-32 programs.
Ski IA-64 Simulator Reference Manual 1.0L Figure 1-1. Starting xski From the Command Line 1-2 Getting Started: A Ski Tutorial Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L Figure 1-2. The Four Primary xski Windows 1.2.2 Exiting Ski You can quit xski and this tutorial with the Quit button, with the File->Quit menu selection, or with the “quit” command. All are in the Main Window. (Don’t quit now; you are just beginning!) 1.2.3 Loading Your Program Use the “Command” area of the “main” Window to load your program.
Ski IA-64 Simulator Reference Manual 1.0L Figure 1-3. Loading the “hello” Program Figure 1-4. The xski Program Window 1-4 Getting Started: A Ski Tutorial Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L Figure 1-5. The xski Data Window Figure 1-6. The xski Register Window 1.2.4 Inspecting Data 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.
Ski IA-64 Simulator Reference Manual 1.0L type “dj r12” or “dj 9ffffffffff780”, as shown in Figure 1-7 and the Data Window changes to display the hexadecimal 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.
Ski IA-64 Simulator Reference Manual 1.0L 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 xski’s Command 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.
Ski IA-64 Simulator Reference Manual 1.0L 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.
Ski IA-64 Simulator Reference Manual 1.0L Figure 1-12. Jumping the Program Window to the Beginning of main() Figure 1-13. The Program Window Showing Code at the Beginning of main() 1.2.7 Viewing Source Code Mixed In with Assembly Code The Program Window shows the C source code intermixed with the IA-64 assembly code. You can turn the source code Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L 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.
Ski IA-64 Simulator Reference Manual 1.0L Figure 1-15. The Breakpoint List Window 1.2.9 Running a Program To run your program, type the “run” command or click the Run button in the Main Window. Ski will start the simulation and connect the program’s standard I/O ports (stdin, stdout, and stderr) to Ski’s standard ports.
Ski IA-64 Simulator Reference Manual 1.0L 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.10 Single-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 Run button to simulate the program up to the breakpoint. (If you receive the error message “Nothing to run”, stop and reread the last sentence in the previous paragraph.
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.
Ski IA-64 Simulator Reference Manual 1.0L Figure 1-19. The xski Register Window After Stopping at a Breakpoint at main+10 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.
Ski IA-64 Simulator Reference Manual 1.0L Figure 1-20. The xski Register Window After Changing the ip Register 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!”.
Ski IA-64 Simulator Reference Manual 1.0L Figure 1-21. The xski Data Window Widened to Show ASCII Next, issue the command “=s _IO_stdin_used+8 Ski!Ski!Ski!” in the Main Window. (You may 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.
Ski IA-64 Simulator Reference Manual 1.0L Figure 1-23. The xski Main Window Showing an eval Command and Its Result 1.2.12 Getting 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.13 Next Steps Congratulations! You now know how to use xski to test an IA-64 program.
Ski IA-64 Simulator Reference Manual 1.0L 1-18 Getting Started: A Ski Tutorial Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L 2 Overview 2.1 Introduction The Ski simulator is a software package designed to functionally simulate the IA-64 processor architecture at the instruction level. Ski offers an informative, screen-oriented machine state display and a friendly, powerful command interface. Programs may be loaded from disk in executable format; they may be run from start to finish, single-stepped, and breakpointed. Translation lookaside buffers may be simulated.
Ski IA-64 Simulator Reference Manual 1.0L 2.4 Ski Variations The simulator is available in three varieties, distinguished by their user interfaces: ski, xski, and bski. The underlying simulation engine is identical across all three varieties. The figures below show how each variety looks when first started. Figure 2-1 shows ski, which uses a terminal-oriented, curses-based, character user interface. Figure 2-2 shows xski, using an X Window System, Motif-based, graphical user interface.
Ski IA-64 Simulator Reference Manual 1.0L Figure 2-2. The X Window System, Motif-based xski Interface Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L Figure 2-3. The Command-Line bski Interface 2.5 Starting Ski To start the Ski simulator, type its name (ski, xski, or bski) and any necessary command line options and file redirections, just as you would start any other Linux program. (Command line options are described in Section 2.5.1, “Command Line Flags”.
Ski IA-64 Simulator Reference Manual 1.0L standard Linux fashion. The Ski command line syntax is shown below. The -i, -rest, -icnt, and -stats flags can appear in any order. ski [-help] [-i filename] [-rest filename] [program_filename [args]+] xski [-help] [-noconsole] [-i filename] [-rest filename] [program_filename [args]+] bski [-help] [-noconsole] [-i filename] [-rest filename] [-icnt filename] [-stats] [program_filename [args]+] 2.5.1.
Ski IA-64 Simulator Reference Manual 1.0L 2.6 Quitting Ski The quit command causes the simulator to exit. If a numeric operand or expression is supplied, the value is returned to the shell as Ski’s exit status. This can be particularly useful with bski and command files (see Chapter 9, “Command Files”), for automated testing and regression testing.
Ski IA-64 Simulator Reference Manual 1.0L 3 3.1 Screen Presentation Ski’s Use of Windows xski and ski generally divide the screen into four windows. (bski doesn’t create any windows because it has no user interface, only a command line interface.) xski uses Motif windows which you can move and resize using the mechanisms provided by your window manager (WindowMaker, Englightenment, fvwm, twm, etc.) xski creates additional windows as necessary.
Ski IA-64 Simulator Reference Manual 1.0L Figure 3-1. The Register Window in xski ski shows only a portion of a register set at a time and you use the commands described in Section 5.1, “Register Window Commands” to select which portion of which set to see. The sets are described below in the order they appear in the Register Window. Their xski realizations are shown as well. 3.2.
Ski IA-64 Simulator Reference Manual 1.0L Figure 3-2. The xski User Registers Pane 3.2.2 The General Registers Pane The general registers pane shows the current values of the 64-bit general (integer) data registers, four to a line, in hexadecimal. Registers whose corresponding NaT bits are set are displayed with a leading asterisk (“*”) to indicate this.
Ski IA-64 Simulator Reference Manual 1.0L Figure 3-4. The xski Floating Point Registers Pane 3.2.4 The System Registers Pane The system registers pane shows the Processor Status Register (psr), Control Registers, Region Registers (rr0-rr7), Protection Key Registers (pkr0-pkr15), Data Breakpoint Registers (dbr0-dbr15), Instruction Breakpoint Registers (ibr0ibr15), and Performance Monitor Configuration Registers (pmc0-pmc15), in hexadecimal. Application programs have limited access to these registers.
Ski IA-64 Simulator Reference Manual 1.0L Figure 3-6. The xski IA-32 Registers Pane 3.3 Resizing Register Window Panes with xski As mentioned above, even a large X Window System screen is too small to display all the registers simultaneously, so you may have to scroll a pane to see the registers you want, or resize the pane by dragging Pane Resizer, the small resize square on the right side of the dividing line between each pair of panes, as shown in Figure 3-7. Figure 3-7.
Ski IA-64 Simulator Reference Manual 1.0L Figure 3-8. The ski Register Window (at Top) 3.5 The Program Window The Program Window provides a view into the program space. Whether you load a program into the simulated processor’s address space via the command line or using Ski’s load, iaload, or romload commands, the program is displayed in a format resembling a compiler’s assembler listing file.
Ski IA-64 Simulator Reference Manual 1.0L instruction in the bundle. The end of each instruction group (a unit of potentially parallel execution) is marked with a pair of semicolons (“;;”) after the last operand of the last instruction in the group. Figure 3-9. xski’s Program Window Showing Part of an IA-64 “hello world” Program Ski uses the first few columns for source code line numbers.
Ski IA-64 Simulator Reference Manual 1.0L Figure 3-10. xski’s Program Window Showing IA-64 Predication and Breakpoints 3.5.2 IA-32 Instruction Display IA-32 instructions are displayed as shown in Figure 3-11, according to the conventions for Intel assembly code. As with IA-64 instruction display, Ski uses the first column of each assembly language instruction line to show breakpoint locations, numbering them “0” through “9.
Ski IA-64 Simulator Reference Manual 1.0L Figure 3-11. xski’s Program Window Showing IA-32 Code, the Instruction Pointer, and a Breakpoint 3.5.3 Changing the Range of Locations Shown in the Program Window xski doesn’t place a scroll bar in the Program Window. Instead, like ski, xski provides the pf and pb commands, described in Section 5.2, “Program Window Commands”. You use these commands to scroll the Program Window forwards and backwards, respectively, through the assembly language program display.
Ski IA-64 Simulator Reference Manual 1.0L Figure 3-12. xski’s Program Window Showing Illegal Instructions Figure 3-13. xski’s Program Window Showing Unallocated Space or No Translation 3.6 The Data Window In the Data Window, xski and ski present data in hexadecimal format, sixteen bytes to a line, as shown in Figure 3-14. The data are displayed as four groups of eight hexadecimal digits each, with an ASCII character translation on the right and the data address on the left.
Ski IA-64 Simulator Reference Manual 1.0L which may change by the time the simulated IA-64 processor actually loads the bytes.) The address is expressed as a symbol from the executable file’s symbol table or as a sixteen digit hexadecimal number. With the dbndl command, Ski can display data formatted as IA-64 instruction bundles in hexadecimal, as shown in Figure 3-15. (The figure was generated by loading a program and then issuing the command “dj main-10” followed by the dbndl command.
Ski IA-64 Simulator Reference Manual 1.0L 3.6.2 Invalid Code and the Data Window If you tell Ski to display non-existent memory, Ski will display x’s instead, as shown in Figure 3-14. Non-existent memory is defined for the Data Window similarly to its definition for the Program Window, described in Section 3.5.4, “Invalid Code and the Program Window”, except that the relevant bit for system-mode programs is psr.dt. 3.7 The Command/Main Window xski and ski are command-driven simulators.
Ski IA-64 Simulator Reference Manual 1.0L Figure 3-16. xski’s Main (Command) Window 3.7.2 The ski Command Window ski’s Command Window is simpler, as shown in Figure 3-17. There are no menus, buttons, or Command History. Instead, you enter commands when you see a * prompt in the 4-line Command Window at the bottom of the screen. ski displays its responses in this window as well.
Ski IA-64 Simulator Reference Manual 1.0L Figure 3-17. ski’s Command Window (at Bottom) 3.8 Other Windows Some commands, such as help, isyms, and symlist, cause xski and ski to create additional windows. When xski creates an additional window, it adds scroll bars if there is more information than will fit. As an example, the output window created by xski for the symlist command is shown in Figure 3-18. xski understands the Page Up and Page Down keys and the arrow keys.
Ski IA-64 Simulator Reference Manual 1.0L Figure 3-18. xski’s Symbol List Window Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L 3-16 Screen Presentation Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L 4 Command Language The Ski command language is simple, efficient, and easy to learn. It consists of commands you can invoke from the keyboard or from a command file (see Chapter 9, “Command Files”). Each command is given with an appropriate set of arguments (some optional) to further qualify the command. Commonly-used commands may be abbreviated as described in Appendix A, “Command Reference” and commands may be repeated easily.
Ski IA-64 Simulator Reference Manual 1.0L the commands “step 100” and “eval my_buffer”. This pair of commands would execute one hundred instructions and then print the value of (your) variable named “my_buffer”. By combining these two commands into one command sequence, i.e., “step 100 ; eval my_buffer”, you can use the Command History or command repetition mechanism to run these commands over and over. (The spaces around the semicolon are optional but improve readability.
Ski IA-64 Simulator Reference Manual 1.0L Table 4-1.
Ski IA-64 Simulator Reference Manual 1.0L 4.4.1.3 Addresses An address is specified by a 64 bit hexadecimal number. For example, the command pj 1000 repositions (“jumps”) the Program Window to address 0x1000. As discussed in Section 6.1, “Application-Mode and System-Mode Simulation”, Ski supports generic addresses in application-mode programs (that is, the concept of “virtual memory” doesn’t apply to application mode programs), and physical and virtual addresses in system-mode programs.
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 stacking and rotation mechanisms of the IA-64 architecture. 4.4.2.
Ski IA-64 Simulator Reference Manual 1.0L first in its symbol tables for program-defined symbols and internal variables (which includes register names). If a match is found, the matching value is used, otherwise the character sequence is taken as a number. You can force the numeric interpretation by putting a “0x” or “0X” prefix in front of the number, such as “0xb3”. It is undefined whether Ski searches the symbol table for program-defined symbols before or after the internal variable symbol table.
Ski IA-64 Simulator Reference Manual 1.0L 5 Screen Manipulation Commands Ski provides several commands to manipulate windows. These commands let you make major changes of context or fine adjustments. xski provides more flexibility: you can change the location and size of xski windows using the mechanisms provided by your window manager, and xski provides scrollbars in some windows, for minor adjustments. 5.1 Register Window Commands As described in Section 3.
Ski IA-64 Simulator Reference Manual 1.0L Displays the IA-32 (eax, ebx, esp, etc.) registers in the Register Window. sr Displays the system registers (cr, rr, pkr, dbr, ibr, pmc, and pmd) in the Register Window. ur Displays the user registers (pr, br, ar, ip, psr.um) in the Register Window. rf [count] Moves the Register Window “forward” (scrolls down) through the currently-displayed register set. The Register Window is scrolled count lines.
Ski IA-64 Simulator Reference Manual 1.0L Figure 5-1. xski’s Program Window Showing IA-64 Assembly Language Code pm Display the program being simulated in its source code form with the assembly language translation mixed in, as shown in Figure 5-2. The source code display is for your convenience only; you cannot interact with the source code, e.g., modify the source code, click on a variable name to see its value in the Data Window, and so on. The source code is not embedded in the executable file.
Ski IA-64 Simulator Reference Manual 1.0L Figure 5-2. xski’s Program Window Showing Intermixed C and IA-64 Assembly Code pd starting_address ending_address [filename] Dump the assembly language translation of the program in the area between the two addresses (inclusive) to the screen (ski) or to a window (xski) if no filename is given, or to the specified file if one is. Source code will not be dumped along with the assembly language, even if the pm command is given.
Ski IA-64 Simulator Reference Manual 1.0L 5.3 Data Window Commands The Data Window displays an area of memory in hexadecimal format and, if the window is wide enough, an ASCII translation. (See Section 3.6, “The Data Window”.) The commands to adjust the Data Window are similar to those for the Program Window and are described below. 5.3.
Ski IA-64 Simulator Reference Manual 1.0L Figure 5-5. xski Showing Data in Raw Hexadecimal and ASCII dd starting_address ending_address [filename] Dump the memory area between the two addresses (inclusive) to the screen (ski) or window (xski) if no filename is given or to the specified file if one is. The dump will be in the format selected by the most recent dbndl or dh command. An example of a hexadecimal dump is shown in Figure 5-6. The mnemonic stands for “data dump”. Figure 5-6.
Ski IA-64 Simulator Reference Manual 1.0L 6 Program Simulation Ski’s main responsibility is to simulate IA-64 instructions and programs built from these instructions. Many commands and features are supplied to provide you with a great deal of flexibility in using Ski. 6.1 Application-Mode and System-Mode Simulation Ski supports two instruction sets and two modes of simulation.
Ski IA-64 Simulator Reference Manual 1.0L 6.3.1 System-Mode IA-64 Programs A system-mode IA-64 program “sees” a more complete simulated environment: writeable registers are initialized to zero, page and TLB faults are simulated and cause a transfer to the interruption vector table (IVT), privileged instructions can be executed, privileged registers can be accessed, and so on.
Ski IA-64 Simulator Reference Manual 1.0L Figure 6-2. sdt Command Output in xski 6.4 Misaligned Data Access Trap If the psr.ac bit is set, the IA-64 architecture requires alignment checks on memory accesses; i.e., when data accesses are made to items larger than a byte, the appropriate number of low-order address bits must be zero. If the bit is clear, the IA64 implementation may choose whether or not to make such checks; Ski chooses to make the checks for references from IA-64 code.
Ski IA-64 Simulator Reference Manual 1.0L example is “xski my_program”. The second way is to use the load, iaload, or romload commands, which take the filename as the first argument, for example, “load my_program”. 6.5.2 Summary of Program Loading Commands load filename [args]+ Prepare for IA-64 application-mode simulation: Load the file specified by filename and prepares to pass the program args encoded using the C-language argc/argv mechanism. The file must be an IA-64 ELF file.
Ski IA-64 Simulator Reference Manual 1.0L 6.6 Program Execution Programs may be run in their entirety without interruption, they may be stopped at appropriate places (see Section 8.3, “Program Breakpoints”) and continued, or they may be single-stepped for debugging purposes. The different program execution choices are described below. You can stop a running simulation in ski at any time with your interrupt character (usually ^C).
Ski IA-64 Simulator Reference Manual 1.0L 6-6 Program Simulation Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L 7 Linux and MS-DOS ABI Emulation As discussed in Section 6.1, “Application-Mode and System-Mode Simulation”, Ski can provide application programs with a Linux-compatible or MS-DOS-compatible environment. The environments aren’t full-blown operating system emulations, however. The most common OS functions are provided, as described below. 7.1 Interruptions The IA-64 architecture defines a large set of interruption types, including faults, traps, and interrupts.
Ski IA-64 Simulator Reference Manual 1.0L Table 7-1.
Ski IA-64 Simulator Reference Manual 1.0L 7.3 MS-DOS Application Environment IA-32 application-mode programs “see” a limited MS-DOS environment. The MS-DOS environment is emulated by creating and initializing an MS-DOS Program Segment Prefix (PSP) and by setting up the stack pointer (iasp) and segmentation registers. The arguments you gave with the iaload command, such as “iaload my_program foo bar baz”, are placed in the PSP as if they were command line parameters.
Ski IA-64 Simulator Reference Manual 1.0L 7-4 Linux and MS-DOS ABI Emulation Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L 8 Debugging The simulator provides many facilities to help you debug your programs. You can modify the current state of the simulated processor, set program breakpoints, trace program execution, and dump a memory image into a file. 8.1 Changing Registers and Memory with Assignment Commands Use the = command to assign a value to a register. The = command takes two arguments: the first is the name of a register and the second is the value to be assigned.
Ski IA-64 Simulator Reference Manual 1.0L The hexadecimal value 0x1234 is assigned to general register 1. The six upper (more significant) bytes are padded with zeroes. = r1 ip+10 The value in ip added to 0x10 is assigned to general register 1. = f2.m 1234 ; = f2.s 1 ; = f2.e 10033 The hexadecimal value 0x300330000000000001234 is assigned to floating register 2. The register now encodes the decimal value of -2.2754, approximately. The “= f2.m 1234” part sets the mantissa (the 64 low-order bits).
Ski IA-64 Simulator Reference Manual 1.0L Figure 8-2. The Program After Assigning a String in ski 8.1.3 Notes on Assignment 8.1.3.1 Address Alignment Ski aligns addresses on natural boundaries: two-byte quantities are aligned on addresses divisible by two, four-byte quantities are aligned on addresses divisible by four, and eight-byte quantities are aligned on addresses divisible by eight. For example, the command =4 __data_start+1 0x12345678 results in the message Non word-aligned address.
Ski IA-64 Simulator Reference Manual 1.0L 8.2 Evaluating Formulas and Formatting Data The eval command evaluates one or more expressions and prints the result(s) in decimal and hexadecimal. An example of the eval command and a more complete discussion are in Section 4.4.1.2, “Expressions”. 8.2.1 Summary of The eval Command eval expression+ Evaluate the expression(s) and print the result(s) on the screen.
Ski IA-64 Simulator Reference Manual 1.0L Figure 8-3. Three Breakpoints, 0, 2, and 1, Visible in xski’s Program Window 8.3.2 Deleting Program Breakpoints Two commands delete program breakpoints. The bd command deletes a specified breakpoint. The bD command deletes all breakpoints currently set. 8.3.3 Listing Program Breakpoints The bl command causes a list of currently set program breakpoints to be displayed on the screen, symbolically if possible, as shown in Figure 8-4.
Ski IA-64 Simulator Reference Manual 1.0L Figure 8-4. xski’s Breakpoint List Window Showing IA-64 and IA-32 Breakpoints 8.3.4 Notes on Program Breakpoints 8.3.4.1 How Ski Implements Breakpoints Program breakpoints are implemented by replacing the instruction at the address of each breakpoint with an IA-64 BREAK instruction or an IA-32 INT3 instruction. The replacement is done at the time the program is started or restarted (e.g.
Ski IA-64 Simulator Reference Manual 1.0L iabs [address] Sets an IA-32 breakpoint at the specified address or, if no address is given, at the location pointed to by ip. bd breakpoint_number Deletes the breakpoint numbered by breakpoint_number. bD Deletes all breakpoints. bl Displays a list of currently set breakpoints. 8.4 Data Breakpoints Data breakpoints can be viewed as temporary access restrictions on an area of data.
Ski IA-64 Simulator Reference Manual 1.0L 8.5 Dumping Registers and Memory to a File You can dump the registers to a file with the “rd” command, described in Section 5.1, “Register Window Commands”. You can dump a block of memory into a file in two forms: in hexadecimal or in symbolic disassembled form, corresponding (roughly) to the formats in the Data Window and the Program Window, respectively. The commands to do this are “dd” and “pd” and are described in Section 5.3.
Ski IA-64 Simulator Reference Manual 1.0L Figure 8-5. The symlist Output from xski isyms [filename] Writes the list of internal variables to filename if given, otherwise to the screen. Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L 8-10 Debugging Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L 9 Command Files The dot (“.”) command temporarily redirects command input to the simulator so that input is taken from the file provided as an argument to the command. Into this file (a “command file”), you put commands as if you had typed them from the keyboard. Several commands are specifically applicable to command files and are described below. Command files may be nested; i.e., one command file may invoke another.
Ski IA-64 Simulator Reference Manual 1.0L example of using goto and a label is: loop: ... other commands ... goto loop 9.2.2 The if Command The if command allows for conditional execution. If the expression following the command evaluates to nonzero, the remainder of the line is executed; otherwise it is ignored. (No spaces are allowed in the expression.
Ski IA-64 Simulator Reference Manual 1.0L # # = = = = Compute and print Fibonacci numbers from 1 to 50. Initialize variables r10 1 # Hold n-2’th value r11 1 # Hold n-1’th value r12 0 # Temporary holding place for n-1’th value r13 0 # Loop counter # Print out first two Fibonacci numbers (initial values of r10 & r11) eval r10 eval r11 # Calculate and print the rest of the numbers. The last line has the # stopping value of the loop index. (This is a simple counting loop.
Ski IA-64 Simulator Reference Manual 1.0L 9-4 Command Files Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L A Command Reference In the command descriptions that follow, this face indicates literal text you should type, this face indicates operand text you should modify, [bracketed text] indicates text you may choose to omit (never type the brackets), and the + symbol indicates items you may repeat. The syntax of the command language is described in Chapter 4, “Command Language”.
Ski IA-64 Simulator Reference Manual 1.0L cated page, including instruction pages. Multiple values may not be supplied. The string may not contain spaces and quoting it is not a workaround. See “Changing Registers and Memory with Assignment Commands” on page 8-1. bs [address] Set breakpoint at the location specified by the current value of ip or at the specified address. (IA-64 code only) See “Setting Program Breakpoints” on page 8-4. bD Delete all breakpoints.
Ski IA-64 Simulator Reference Manual 1.0L df [count] Move the Data Window forward count lines or one windowful if no count is given. See “Data Window Commands” on page 5-5. dh Display Data Window contents in hexadecimal format. See “Data Window Commands” on page 5-5. eval expression_without_spaces+ Evaluate one or more expression_without_spaces and print the result in an appropriate format, typically hexadecimal and/or decimal, or symbolically.
Ski IA-64 Simulator Reference Manual 1.0L isyms [filename] Write internal symbols to the screen or to the file given by filename. See “Symbol Table Commands” on page 8-8. load filename [args]+ Prepare for IA-64 application-mode simulation: Load the IA-64 ELF executable program file given by filename and prepare to pass the program args using the C language argc/argv parameter mechanism. See “How to Load a Program” on page 6-3. pj [address] Jump the Program Window display to the specified address.
Ski IA-64 Simulator Reference Manual 1.0L the last line of the old window is displayed as the first line of the new window. (ski only) See “ski Register Window Commands” on page 5-1. rb [count] Moves the Register Window “backward” (scroll up) through the currently-displayed register set. The Register Window is scrolled count lines. If count is omitted, the Register Window scrolls up one windowful less one line, i.e. the first line of the old window is displayed as the last line of the new window.
Ski IA-64 Simulator Reference Manual 1.0L ur ski: Show the user registers (Predicate Registers, Branch Registers, Application Registers, Instruction Pointer, User Mask) in the Register Window. See “Register Window Commands” on page 5-1. xski: Toggle the display of the user registers pane. See “Register Window Commands” on page 5-1. A-6 Command Reference Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L B Register Names IA-64 registers are fully described in other documents. This appendix provides a list for convenience only. The register names are documented here as recognized by Ski and, in a few cases, don’t exactly match the names in other documents due to program limitations. For example, the floating point registers must be accessed in three pieces: the mantissa part, the sign part, and the (biased) exponent part.
Ski IA-64 Simulator Reference Manual 1.0L eflags.df IA-32 Direction Flag bit eflags.id IA-32 ID Flag bit eflags.if IA-32 Interruption Flag bit eflags.iopl IA-32 I/O Privilege Level bit eflags.le IA-32 Less Equal Flag bit eflags.lt IA-32 Less Than Flag bit eflags.nt IA-32 Nested Task bit eflags.of IA-32 Overflow Flag bit eflags.pf IA-32 Parity Flag bit eflags.rf IA-32 Resume Flag bit eflags.sf IA-32 Sign Flag bit eflags.tf IA-32 Trap Flag bit eflags.
Ski IA-64 Simulator Reference Manual 1.0L fpsr.sf2.pc IA-64 FPSR Status Field 2, Precision control bits fpsr.sf2.rc IA-64 FPSR Status Field 2, Rounding control bits fpsr.sf2.v IA-64 FPSR Status Field 2, IEEE Invalid Operation status bit fpsr.sf2.d IA-64 FPSR Status Field 2, Denormal/Unnormal Operand status bit fpsr.sf2.z IA-64 FPSR Status Field 2, IEEE Zero Divide status bit fpsr.sf2.o IA-64 FPSR Status Field 2, IEEE Overflow status bit fpsr.sf2.
Ski IA-64 Simulator Reference Manual 1.0L ldtd IA-32 Local Descriptor Table Descriptor lid IA-64 Local Interrupt ID lrr0-lrr1 IA-64 Local Redirection Registers p0 - p63 IA-64 Predicate Registers pfs IA-64 Previous Function State pkr0 - pkr15 IA-64 Protection Key Registers pmc0 - pmc15 IA-64 Performance Monitor Configuration Registers pmd0 - pmd15 IA-64 Performance Monitor Data Registers pmv IA-64 Performance Monitoring Vector psr IA-64 Processor Status Register psr.
Ski IA-64 Simulator Reference Manual 1.0L psr.tb IA-64 PSR Taken Branch trap bit psr.um IA-64 PSR User Mask bits psr.up IA-64 PSR User Performance monitor enable bit pta IA-64 Page Table Address r0, r1, … r127 IA-64 General Registers r0.nat, … r127.
Ski IA-64 Simulator Reference Manual 1.0L B-6 Register Names Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L C Internal Variable Names Ski has one combined symbol table for registers and internal variables. (See Section 4.4.2.2, “Registers” and Section 4.4.2.3, “Internal Variables”.) A separate symbol table describes program-defined symbols. C.1 Internal Variables $cycles$ Number of “virtual cycles” simulated. $exited$ The value 0 until the simulated program exits. Then the variable takes the value 1. $heap$ The address of the bottom of the simulated heap.
Ski IA-64 Simulator Reference Manual 1.0L C-2 Internal Variable Names Copyright © 2000 Hewlett-Packard Co.
Ski IA-64 Simulator Reference Manual 1.0L D Simulator Status and Error Messages The following is a description of some of the status and error messages which can be produced by the simulator. “Fault” and “Trap” messages are usually the result of a program trying to do something that, under Linux, would cause a signal to be generated. The “%” constructs are printf() substitutions. Where “%s” appears, a string will be substituted in the error message at runtime.
Ski IA-64 Simulator Reference Manual 1.0L Breakpoint #%d wasn’t set You used the bd command to delete a specific breakpoint but that breakpoint doesn’t exist. Did you specify the right breakpoint? Use the bl command to list the breakpoints. See “Deleting Program Breakpoints” on page 8-5 and perhaps “Listing Program Breakpoints” on page 8-5.
Ski IA-64 Simulator Reference Manual 1.0L missions are wrong or a remote file has suddenly become inaccessible? See “The Program Window” on page 3-6 and the discussion of the pm command in “Program Window Commands” on page 5-2. Error: unrecognized restore file tag: %s You are trying to restore a saved simulator state and either the save file is corrupt or Ski is broken. See “Saving and Restoring the Simulator State” on page 8-8.
Ski IA-64 Simulator Reference Manual 1.0L help: Unknown command: %s You asked Ski to tell you about a particular command but the command you asked for doesn’t exist. Try the help command alone to get a list of all of the commands Ski understands. See “Command Entry” on page 4-1. IA-32 program terminated An IA-32 application-mode program finished executing and invoked an MS-DOS system function to terminate itself. The function it used doesn’t provide a way for the program to return a completion status.
Ski IA-64 Simulator Reference Manual 1.0L Missing ELF header See “File size > Memory size” on page D-3. Missing file version number You are trying to restore a saved simulator state and the first non-blank, non-comment line of the file doesn’t begin with “file_ver”, the file version string. Is the file a Ski simulator state save file? See “Saving and Restoring the Simulator State” on page 8-8. missing value for option %s You specified a command line option that requires an argument.
Ski IA-64 Simulator Reference Manual 1.0L Not an IA-64 file See “File size > Memory size” on page D-3. Nothing to run No program has been loaded. Use the load, iaload, or romload command, depending on what kind of program you want to simulate or load an IA-64 program by naming it on Ski’s command line. See “Program Loading” on page 6-3. Out of memory Ski needed to get more memory to run but couldn’t get it. You need more virtual memory swap space or you’ve found a Ski defect.
Ski IA-64 Simulator Reference Manual 1.0L Reserved register/field fault Your IA-64 application-mode program tried to access a reserved register or portion of a register. This can only happen for application-mode programs; system-mode programs handle this fault through the interruption mechanism. See Chapter 6, “Program Simulation” and “Interruptions” on page 7-1. screen size is %dx%d -- minimum is %dx%d ski uses the curses package to create a multi-window interface on a terminal.
Ski IA-64 Simulator Reference Manual 1.0L Unable to open console window Your system-mode program tried to open a console with the appropriate Simulator System Call but Ski wasn’t able to spawn the corresponding xterm program. First, verify that environment variable DISPLAY is set to the proper hostname:displaynumber string.