HP IA-64, Ski Simulator manual Program Simulation, Application-Mode and System-Mode Simulation

Page 65

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.1Application-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.2Ski 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.1Application-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.2Application-Mode IA-32 Programs

For IA-32 programs, Ski’s support is more limited. Ski provides a subset of MS-DOSint 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.3Ski 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.

Copyright © 2000 Hewlett-Packard Co.

Program Simulation

6-1

Image 65
Contents Copyright 2000 Hewlett-Packard Co Ski IA-64 Simulator Reference ManualTrademarks Printing HistoryPreface How to Use This ManualFont Conventions Syntax ConventionsItalic+ Table of Contents Ski IA-64 Simulator Reference Manual Vii Ski IA-64 Simulator Reference Manual Viii Table of Contents List of Figures Ski IA-64 Simulator Reference Manual 1.0L List of Tables Ski IA-64 Simulator Reference Manual 1.0L Xii List of Tables Getting Started a Ski Tutorial How to Run an IA-64 Application ProgramSki Simulator Starting xskiStarting xski From the Command Line Loading Your Program Exiting SkiLoading the hello Program Xski Data Window Inspecting DataChanging the Data Window Display Data Window Showing argv and envp Strings in Hexadecimal Looking at Code Viewing Data in Ascii12. Jumping the Program Window to the Beginning of main Viewing Source Code Mixed In with Assembly Code14. The Program Window Showing a Breakpoint at main Controlling Breakpoints15. The Breakpoint List Window Running a Program16. The Terminal Window After the hello Program is Run Single-stepping a Program18. The Main Window After Reaching the Breakpoint at main+10 Changing Registers and MemorySki IA-64 Simulator Reference Manual 1.0L 20. The xski Register Window After Changing the ip Register 21. The xski Data Window Widened to Show Ascii Next Steps Getting HelpCopyright 2000 Hewlett-Packard Co Introduction OverviewWhat You Need to Know to Use This Manual Defects and Defect ReportingSki Variations Using bski for Batch SimulationsX Window System, Motif-based xski Interface Starting Ski Command Line Flags1.1 Summary of Flags XSki FileQuit expression Summary of the Quit CommandQuitting Ski Register Window Screen PresentationSki’s Use of Windows Register Window in xski User Registers PaneFloating Point Registers Pane General Registers PaneIA-32 Registers Pane System Registers PaneRegister Window and ski Resizing Register Window Panes with xski1 IA-64 Instruction Display Program WindowSki IA-64 Simulator Reference Manual 1.0L 2 IA-32 Instruction Display Invalid Code and the Program Window Changing the Range of Locations Shown in the Program Window12. xski’s Program Window Showing Illegal Instructions Data WindowChanging the Range of Locations Shown in the Data Window Xski Main Window Command/Main WindowInvalid Code and the Data Window 16. xski’s Main Command Window Ski Command WindowOther Windows 17. ski’s Command Window at Bottom18. xski’s Symbol List Window Copyright 2000 Hewlett-Packard Co Command Entry Command LanguageCommand Arguments Command Sequences, Repetition, and AbbreviationNumeric Arguments Argument SpecificationNumbers and Counts ExpressionsXski Evaluating Expressions Ski Simulator Arithmetic and Logic OperatorsAddresses Symbolic ArgumentsProgram-Defined Symbols Internal Variables Resolving Ambiguous Symbols and NumbersLabels FilenamesSki IA-64 Simulator Reference Manual 1.0L Register Window Commands Screen Manipulation CommandsSummary of Register Window Commands Xski Register Window CommandsSummary of Program Window Commands Program Window CommandsXski’s Program Window Showing IA-64 Assembly Language Code Pd startingaddress endingaddress filename Xski’s Assembly Language Dump WindowSummary of Data Window Commands Data Window CommandsDj address Df countDd startingaddress endingaddress filename Xski Showing Data in Raw Hexadecimal and AsciiApplication-Mode and System-Mode Simulation Program SimulationSki Support for Application-Mode Programs Ski Support for System-Mode ProgramsSystem-Mode IA-64 Programs Summary of TLB Display CommandsSystem-Mode IA-32 Programs System-Mode TLB SimulationProgram Loading Misaligned Data Access TrapHow to Load a Program Load filename args+ Summary of Program Loading CommandsAdding Information after Loading Creating the argc, argv, and envp ParametersProgram Execution Summary of Program Execution CommandsSki IA-64 Simulator Reference Manual 1.0L Program Simulation Linux Application Environment Linux and MS-DOS ABI EmulationInterruptions Linux System Calls Accepted but Ignored by Ski Linux System Calls Supported by SkiMS-DOS System Calls in Hexadecimal Supported by Ski MS-DOS Application EnvironmentProgram I/O Copyright 2000 Hewlett-Packard Co Summary of Assignment Commands Changing Registers and Memory with Assignment CommandsExamples of Assignment Commands DebuggingOriginal Program Loaded in ski Allocation Bit-encoded RegistersSetting Program Breakpoints Summary of The eval CommandEvaluating Formulas and Formatting Data Program BreakpointsListing Program Breakpoints Deleting Program BreakpointsBs address Summary of Program Breakpoint CommandsUnexpected Breakpoints Summary of Data Breakpoint Commands Setting Data BreakpointsData Breakpoints Deleting Data BreakpointsSummary of Save and Restore Commands Symbol Table CommandsSummary of Symbol Commands Dumping Registers and Memory to a FileIsyms filename Symlist Output from xskiSki IA-64 Simulator Reference Manual 1.0L Debugging Labels and Control Flow in Command Files Command FilesGoto Command and Labels Initialization FileIf Command Comments in Command FilesAn Example Command File filename Summary of Command File Commands# comment LabelSki IA-64 Simulator Reference Manual 1.0L Command Files =s address stringwithoutspaces Command ReferenceDbd breakpointnumber Dbs address length rwrwEval expressionwithoutspaces+ Help commandnameRest filename Quit returnvalueforshellStep until expressionwithoutspaces Ski IA-64 Simulator Reference Manual 1.0L IA-64 Registers Register NamesRegister Names Copyright 2000 Hewlett-Packard Co Register Names B-3 Ski IA-64 Simulator Reference Manual 1.0L Copyright 2000 Hewlett-Packard Co Register Names B-5 Ski IA-64 Simulator Reference Manual 1.0L Register Names Internal Variables Internal Variable NamesCopyright 2000 Hewlett-Packard Co All breakpoints deleted Simulator Status and Error MessagesSimulator Status and Error Messages Expression Help Unknown command %s Missing ELF header Not an IA-64 file Stopping at %s due to unimplemented instruction Usage %s options file args