HP (Hewlett-Packard) IA-64 Computer Accessories User Manual


 
Copyright © 2000 Hewlett-Packard Co. Program Simulation 6-1
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. The two instruction sets supported by Ski are the IA-64
instruction set and a subset of the traditional IA-32 instruction set, often called the “Intel x86” instruction set.
Ski’s two simulation modes let you simulate an application program (“application-mode”) or an operating system or firm-
ware (“system-mode”). For IA-64 programs, Ski determines the mode based on the presence or absence of the _atexit
symbol. (If you strip symbols from your IA-64 program, Ski will not find _atexit and will assume your program is a sys-
tem-mode program.) For IA-32 programs, you select the mode, using the iaload command for application-mode simula-
tion and the romload command for system-mode simulation. Program loading is discussed in Section 6.5, “Program
Loading”.
6.2 Ski Support for Application-Mode Programs
To support application-mode programs, Ski emulates a Linux operating system (for IA-64 programs) or an MS-DOS oper-
ating system (for IA-32 programs).
6.2.1 Application-Mode IA-64 Programs
For IA-64 programs, Ski provides (simulated) memory for the text and data portions of the program’s address space. Ski
also manages a growable heap for the C language’s malloc() function, a growable Register Save Engine area, and a grow-
able stack. As your program runs, Ski tracks the memory references emitted by the program. Ski tries to distinguish
between reasonable references and ridiculous references indicative of wild pointers. To track stack-based data structures,
Ski adds stack pages when it notices a reference to a location just past the end of the stack. To track heap-based data struc-
tures, Ski provides an implementation of the malloc() family of functions. (Chapter 7, “Linux and MS-DOS ABI Emula-
tion”, discusses Ski’s pseudo-operating system in detail.) Ski tracks pages used by the Register Save Engine as well.
Application program calls to Linux system functions are emulated by the simulator or passed to the host Linux operating
system; unsupported calls cause simulation to stop. Registers are initialized according to Linux calling conventions.
Application mode programs can’t access (simulated) I/O devices or privileged registers. Application mode programs can’t
execute privileged instructions or receive interrupts; any interruptions cause Ski to stop simulation and generate an error
message. Application-mode programs never see virtual memory page faults or TLB faults and therefore the sit and sdt
simulator commands (see Section 6.3.3, “System-Mode TLB Simulation”) are disabled when simulating application-
mode programs.
6.2.2 Application-Mode IA-32 Programs
For IA-32 programs, Ski’s support is more limited. Ski provides a subset of MS-DOS “int 21 functions. Ski does not
simulate Microsoft Windows. Loadable libraries (DLL’s), config.sys, and autoexec.bat are not supported. Environ-
ment variables are not available to MS-DOS programs. Registers and memory are initialized according to MS-DOS con-
ventions.
6.3 Ski Support for System-Mode Programs
A system-mode program is, as far as Ski is concerned, running on a “bare” IA-64 processor. No operating system emula-
tion is provided and the system-mode program has complete access to the simulated IA-64 processor.