HP Ski Simulator, IA-64 manual Summary of Program Loading Commands, Load filename args+

Page 68

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.2Summary 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.

iaload filename address [mapfile [args]+]

Prepare for IA-32 application-mode simulation: Load the IA-32 executable file specified by filename , which must be an MS-DOS .comor .exe file and prepare to pass the program args encoded using MS-DOS command line argument conventions. The address specifies where Ski should load the program. This should be a physical address; virtual addressing is only supported for system-mode programs. The value you provide is used, along with information from the .exe file or MS-DOS defaults for a .com file, to setup the IA-32 execution environment, such as segment descriptors, the stack pointer, etc. The mapfile is an ASCII text file providing the mappings between symbols and addresses; it must be compatible in format with the mapfile produced by the Microsoft “ML” linker. The psr.is bit is set.

romload filename address [mapfile ]

Prepare for IA-64, IA-32, or mixed system-mode simulation: Load the MS-DOS .com-format file specified by filename . (The MS-DOS .comformat is essentially raw binary.) Address and mapfile are as described for the iaload command above. The address can be physical or virtual, depending on the setting of the psr.it bit, as described in Section 4.4.1.3, “Addresses”.

6.5.3Notes about Program Loading

6.5.3.1Adding Information after Loading

Sometimes, the load file doesn’t contain enough information. In this case, you can use a command file (see Chapter 9, “Command Files”) to add more information. You execute the command file at the appropriate time, generally after loading the program. For example, perhaps you want to test how an application program handles error conditions that are hard to create in a “real” hardware environment. You could load the program and use a command file to create the error condition. Then you would run the program and test its behavior.

As another example, perhaps you want to simulate the transfer of control from a bootstrap program, an interrupt, or an application program to the operating system. You could load the operating system as a system-mode program and use a command file to set up memory and registers to their appropriate state at the instant of the control transfer.

6.5.3.2Creating the argc, argv, and envp Parameters

The first time an application-mode simulated program starts, it receives command line parameters and environment vari- ables using the C language argc/argv/envp mechanism. (IA-32 application-mode programs do not receive environment variables.) By default, the program receives the same command line parameters you gave to Ski when you started it. For example, if you invoked Ski as “ xski my_program foo bar”, Ski would start up using the X Window System interface, load the executable IA-64 program my_program, and use “ foo”, “ bar”, and environment variables to initialize the argc, argv and envp parameters passed on the memory stack. The environment variables are a copy of the variables Ski received from the shell when it started.

Instead of specifying the executable program on Ski’s invocation line as in the example above, you can use the load or iaload commands to load the executable program. You can add extra arguments to load and iaload. Later, when you invoke the run command, Ski will pass the extra arguments to the simulated program as command line parameters. For example, you could issue the command “ load my_program foo bar”. When you run the program, Ski would pass

foo” and “ bar” to the program as command line parameters using the argc/argv/envp mechanism. Note that IA-32 appli- cation-mode programs must be loaded with the iaload command; they cannot be loaded from the Ski invocation line.

6-4

Program Simulation

Copyright © 2000 Hewlett-Packard Co.

Image 68
Contents Ski IA-64 Simulator Reference Manual Copyright 2000 Hewlett-Packard CoPrinting History TrademarksHow to Use This Manual PrefaceFont 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 How to Run an IA-64 Application Program Getting Started a Ski TutorialSki Simulator Starting xskiStarting xski From the Command Line Exiting Ski Loading Your ProgramLoading the hello Program Inspecting Data Xski Data WindowChanging the Data Window Display Data Window Showing argv and envp Strings in Hexadecimal Viewing Data in Ascii Looking at CodeViewing Source Code Mixed In with Assembly Code 12. Jumping the Program Window to the Beginning of mainControlling Breakpoints 14. The Program Window Showing a Breakpoint at mainRunning a Program 15. The Breakpoint List WindowSingle-stepping a Program 16. The Terminal Window After the hello Program is RunChanging Registers and Memory 18. The Main Window After Reaching the Breakpoint at main+10Ski 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 Getting Help Next StepsCopyright 2000 Hewlett-Packard Co Overview IntroductionWhat You Need to Know to Use This Manual Defects and Defect ReportingUsing bski for Batch Simulations Ski VariationsX Window System, Motif-based xski Interface Command Line Flags Starting SkiXSki File 1.1 Summary of FlagsQuit expression Summary of the Quit CommandQuitting Ski Register Window Screen PresentationSki’s Use of Windows User Registers Pane Register Window in xskiGeneral Registers Pane Floating Point Registers PaneSystem Registers Pane IA-32 Registers PaneResizing Register Window Panes with xski Register Window and skiProgram Window 1 IA-64 Instruction DisplaySki IA-64 Simulator Reference Manual 1.0L 2 IA-32 Instruction Display Changing the Range of Locations Shown in the Program Window Invalid Code and the Program WindowData Window 12. xski’s Program Window Showing Illegal InstructionsChanging the Range of Locations Shown in the Data Window Xski Main Window Command/Main WindowInvalid Code and the Data Window Ski Command Window 16. xski’s Main Command Window17. ski’s Command Window at Bottom Other Windows18. xski’s Symbol List Window Copyright 2000 Hewlett-Packard Co Command Language Command EntryCommand Arguments Command Sequences, Repetition, and AbbreviationArgument Specification Numeric ArgumentsNumbers and Counts ExpressionsSki Simulator Arithmetic and Logic Operators Xski Evaluating ExpressionsAddresses Symbolic ArgumentsProgram-Defined Symbols Resolving Ambiguous Symbols and Numbers Internal VariablesLabels FilenamesSki IA-64 Simulator Reference Manual 1.0L Screen Manipulation Commands Register Window CommandsSummary of Register Window Commands Xski Register Window CommandsProgram Window Commands Summary of Program Window CommandsXski’s Program Window Showing IA-64 Assembly Language Code Xski’s Assembly Language Dump Window Pd startingaddress endingaddress filenameData Window Commands Summary of Data Window CommandsDj address Df countXski Showing Data in Raw Hexadecimal and Ascii Dd startingaddress endingaddress filenameProgram Simulation Application-Mode and System-Mode SimulationSki Support for Application-Mode Programs Ski Support for System-Mode ProgramsSummary of TLB Display Commands System-Mode IA-64 ProgramsSystem-Mode IA-32 Programs System-Mode TLB SimulationProgram Loading Misaligned Data Access TrapHow to Load a Program Summary of Program Loading Commands Load filename args+Adding Information after Loading Creating the argc, argv, and envp ParametersSummary of Program Execution Commands Program ExecutionSki IA-64 Simulator Reference Manual 1.0L Program Simulation Linux Application Environment Linux and MS-DOS ABI EmulationInterruptions Linux System Calls Supported by Ski Linux System Calls Accepted but Ignored by SkiMS-DOS System Calls in Hexadecimal Supported by Ski MS-DOS Application EnvironmentProgram I/O Copyright 2000 Hewlett-Packard Co Changing Registers and Memory with Assignment Commands Summary of Assignment CommandsExamples of Assignment Commands DebuggingOriginal Program Loaded in ski Bit-encoded Registers AllocationSummary of The eval Command Setting Program BreakpointsEvaluating Formulas and Formatting Data Program BreakpointsDeleting Program Breakpoints Listing Program BreakpointsBs address Summary of Program Breakpoint CommandsUnexpected Breakpoints Setting Data Breakpoints Summary of Data Breakpoint CommandsData Breakpoints Deleting Data BreakpointsSymbol Table Commands Summary of Save and Restore CommandsSummary of Symbol Commands Dumping Registers and Memory to a FileSymlist Output from xski Isyms filenameSki IA-64 Simulator Reference Manual 1.0L Debugging Command Files Labels and Control Flow in Command FilesGoto Command and Labels Initialization FileIf Command Comments in Command FilesAn Example Command File Summary of Command File Commands filename# comment LabelSki IA-64 Simulator Reference Manual 1.0L Command Files Command Reference =s address stringwithoutspacesDbs address length rwrw Dbd breakpointnumberHelp commandname Eval expressionwithoutspaces+Quit returnvalueforshell Rest filenameStep until expressionwithoutspaces Ski IA-64 Simulator Reference Manual 1.0L Register Names IA-64 RegistersRegister 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 Variable Names Internal VariablesCopyright 2000 Hewlett-Packard Co Simulator Status and Error Messages All breakpoints deletedSimulator 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