HP IA-64, Ski Simulator manual MS-DOS Application Environment, Program I/O

Page 73

Ski IA-64 Simulator Reference Manual 1.0L

7.3MS-DOS Application Environment

IA-32 application-mode programs “see” a limited MS-DOS environment. The MS-DOS environment is emulated by cre- ating and initializing an MS-DOS Program Segment Prefix (PSP) and by setting up the stack pointer ( iasp) and segmen- tation 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 supports the MS-DOSINT 20” call to terminate the simulated program and the “ INT 21” system calls shown in Table 7-3.When an IA-32 program makes an INT 21 call that’s not supported, the simulator stops the simulation and dis- plays an error message.

Table 7-3. MS-DOS System Calls (in Hexadecimal) Supported by Ski

00: terminate program

02: display character

08: read keyboard without echo

09: display string

2a: get date

2c: get time

30: get version number

3c: create file with handle

3d: open file with handle

3e: close file with handle

3f: read file or device

40: write file or device

44: device status control

44, sub-function 0: get device data

4c: end program

51: get PSP address

62: get PSP address (same as 51)

 

 

 

 

7.4Program I/O

Your program may need to read from standard in (stdin: file descriptor 0) and write to standard out (stdout: file descriptor

1)and standard err (stderr: file descriptor 2). As with all Linux programs, these file descriptors are connected, by default, to your keyboard and screen. You can redirect them in the usual way: when you invoke Ski, use the < and > operators rec- ognized by most Linux shells. For example, “ bski -noconsole my_program foo bar baz < test_input >simulated_output” runs bski, loading the IA-64 program file my_program and passing it the arguments foo , bar and baz via the argc/argv mechanism. Because no command file was provided via the -i flag (described in Section 2.5.1, “Command Line Flags”), bski internally generates a run command followed by a quit command. The (simulated) pro- gram reads on standard in from the file test_input and writes on standard out to the file simulated_output. Having not been redirected, writes to standard err go to the default place, normally the terminal screen.

Copyright © 2000 Hewlett-Packard Co.

Linux and MS-DOS ABI Emulation

7-3

Image 73
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 FileQuitting Ski Summary of the Quit CommandQuit expression Ski’s Use of Windows Screen PresentationRegister Window 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 Invalid Code and the Data Window Command/Main WindowXski Main 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 OperatorsProgram-Defined Symbols Symbolic ArgumentsAddresses 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 SimulationHow to Load a Program Misaligned Data Access TrapProgram Loading 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 Interruptions Linux and MS-DOS ABI EmulationLinux Application Environment Linux System Calls Accepted but Ignored by Ski Linux System Calls Supported by SkiProgram I/O MS-DOS Application EnvironmentMS-DOS System Calls in Hexadecimal Supported by Ski 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 BreakpointsUnexpected Breakpoints Summary of Program Breakpoint CommandsBs address 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 FileAn Example Command File Comments in Command FilesIf Command 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