HP Ski Simulator manual System-Mode IA-64 Programs, System-Mode IA-32 Programs

Page 66

Ski IA-64 Simulator Reference Manual 1.0L

6.3.1System-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. A tricky issue for system-mode simulation is handling I/O because there are no real I/O devices to simulate! Instead, Ski provides a special interface using BREAK instructions to implement Simulator SystemCalls (SSC’s), which provide access to the console, keyboard, SCSI disk and Ethernet devices. A system-mode IA-64 program can’t access the underlying operating system; it “thinks” it’s running on a real IA- 64 computer.

A system-mode IA-64 program must provide interruption handlers. The program must create a valid Interruption Vector Table (IVT) and set the Interruption Vector Address (IVA) accordingly. You can test your interruption code by creating code that generates conditions corresponding to internal faults, traps, and interrupts, such as divide-by-zero and page-not- present. To test code for external interrupts, use the inter-processor interruption mechanism, as defined by the IA-64 archi- tecture manual. Example assembly code for this is shown in Figure 6-1.Timer interruptions can be simulated using the Simulator System Call mechanism.

ssm 0x6000

// Set psr.i and psr.ic to 1

mov cr.lid=r0

// For processor 0

movl r4=0xfee00000

// Interrupt block base for proc 0

mov r5=0x10

// Interrupt vector 16

st8 [r4]=r5

// Code branches to iva+0x3000 (the external

 

// interrupt handler). irr0{16} is set to 1,

 

// ivr = 0x10

Figure 6-1. Example Code to Simulate an External Interrupt

6.3.2System-Mode IA-32 Programs

Ski does not support IA-32 programs running in system-mode.

6.3.3System-Mode TLB Simulation

The simulator provides facilities for modeling the TLB’s (Translation Lookaside Buffers) for system-mode programs.

6.3.3.1Summary of TLB Display Commands

sit

sdt

When a system-mode IA-64 program is loaded, these commands display information from the Instruction Translation Lookaside Buffer (ITLB) and Data Translation Lookaside Buffer (DTLB), respectively. The simulator displays the entire selected TLB (Translation Registers and the Translation Cache) on the screen, as shown in Figure 6-2.

The “ V” and “ RID” columns represent the V (valid) bit and Region Identifier, respectively, for each TLB entry. The

Virtual Page” and “ Physical Page” columns show the actual address translation handled by each TLB entry. The “ PgSz”, “ ED”, “ AR”, “ PL”, “ D”, “ A”, “ MA”, and “ P” columns represent the Page Size, Exception Deferral, Access Rights, Privilege Level, Dirty Bit, Accessed Bit, Memory Attribute, and Present fields, respectively, for each TLB entry. Finally, the “ KEY” column represents the Protection Key for each TLB entry. A blank line separates the Translation Registers (TR’s) from the Translation Cache (TC). The number of TR’s and the size of the TC is implementation-dependent. Current versions of Ski provide 16 TR’s and 128 entries for the TC but this may change. If the precise value is important, check the release notes.

6-2

Program Simulation

Copyright © 2000 Hewlett-Packard Co.

Image 66
Contents Ski IA-64 Simulator Reference Manual Copyright 2000 Hewlett-Packard CoPrinting History TrademarksFont Conventions How to Use This ManualPreface 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 Ski Simulator How to Run an IA-64 Application ProgramGetting Started a Ski Tutorial 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 What You Need to Know to Use This Manual OverviewIntroduction 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 FlagsSummary of the Quit Command Quitting SkiQuit expression Screen Presentation Ski’s Use of WindowsRegister Window 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 Command/Main Window Invalid Code and the Data WindowXski Main 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 Arguments Command LanguageCommand Entry Command Sequences, Repetition, and AbbreviationNumbers and Counts Argument SpecificationNumeric Arguments ExpressionsSki Simulator Arithmetic and Logic Operators Xski Evaluating ExpressionsSymbolic Arguments Program-Defined SymbolsAddresses Labels Resolving Ambiguous Symbols and NumbersInternal Variables FilenamesSki IA-64 Simulator Reference Manual 1.0L Summary of Register Window Commands Screen Manipulation CommandsRegister 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 filenameDj address Data Window CommandsSummary of Data Window Commands Df countXski Showing Data in Raw Hexadecimal and Ascii Dd startingaddress endingaddress filenameSki Support for Application-Mode Programs Program SimulationApplication-Mode and System-Mode Simulation Ski Support for System-Mode ProgramsSystem-Mode IA-32 Programs Summary of TLB Display CommandsSystem-Mode IA-64 Programs System-Mode TLB SimulationMisaligned Data Access Trap How to Load a ProgramProgram Loading Adding Information after Loading Summary of Program Loading CommandsLoad filename args+ Creating the argc, argv, and envp ParametersSummary of Program Execution Commands Program ExecutionSki IA-64 Simulator Reference Manual 1.0L Program Simulation Linux and MS-DOS ABI Emulation InterruptionsLinux Application Environment Linux System Calls Supported by Ski Linux System Calls Accepted but Ignored by SkiMS-DOS Application Environment Program I/OMS-DOS System Calls in Hexadecimal Supported by Ski Copyright 2000 Hewlett-Packard Co Examples of Assignment Commands Changing Registers and Memory with Assignment CommandsSummary of Assignment Commands DebuggingOriginal Program Loaded in ski Bit-encoded Registers AllocationEvaluating Formulas and Formatting Data Summary of The eval CommandSetting Program Breakpoints Program BreakpointsDeleting Program Breakpoints Listing Program BreakpointsSummary of Program Breakpoint Commands Unexpected BreakpointsBs address Data Breakpoints Setting Data BreakpointsSummary of Data Breakpoint Commands Deleting Data BreakpointsSummary of Symbol Commands Symbol Table CommandsSummary of Save and Restore Commands Dumping Registers and Memory to a FileSymlist Output from xski Isyms filenameSki IA-64 Simulator Reference Manual 1.0L Debugging Goto Command and Labels Command FilesLabels and Control Flow in Command Files Initialization FileComments in Command Files An Example Command FileIf Command # comment Summary of Command File Commandsfilename 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