Home

HP IA-64 User's Manual

image

Contents

1. 0000000000000010 0000000000000020 0000000000000030 file 27 0000000000000040 0000000000000050 0000000000000060 0000000000000070 0000000000000080 0000000000000090 Registers Window ip 0000000000000000 psr um mfhlmfllacluplbe lc 0000000000000000 ec 00 bol 0 rsc 0000000 00 ppl 0 Prs 10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 b 0000000000000000 0000000000000000 b2 0000000000000000 0000000000000000 b4 0000000000000000 0000000000000000 bE 0000000000000000 0000000000000000 rrbp rrbf rrbg sor sol sof cfm 0 0 pfm 0 0 0 Mob 0 mx 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0
2. 64 processor architecture at the instruc tion level Ski offers an informative screen oriented machine state display and a friendly powerful command interface Programs may be loaded from disk in executable format they may be run from start to finish single stepped and break pointed Translation lookaside buffers may be simulated Certain Linux and MS DOS operating system functions system calls are provided for simulation of application programs These capabilities are complemented by screen oriented sym bolic debugging to provide a view into the simulated 64 processor 2 1 1 Ski s Strengths Ski is particularly well suited for 64 application development Ski can simulate IA 64 programs in a Linux environment and IA 32 programs in an MS DOS environment Ski provides a user interface that looks very much like a typical debugger but the processor you are debugging on is virtual simulated by Ski Ski has successfully executed the SPEC 92 and SPEC 95 benchmark suites IA 64 compiler tuning Ski provides performance statistics that can help you tune IA 64 compiler code generators Ski can help you improve your compiler s use of IA 64 architectural enhancements for parallelism IA 64 operating system and firmware development Ski can simulate a raw IA 64 processor with no operating system provided Because of this you can use Ski to simulate an 64 operating system running IA 64 and IA 32 programs For examp
3. 8 0 as shown in Figure 1 7 and the Data Window changes to display the hexadec imal data stored at the location as shown in Figure 1 8 Find the value of r12 in your program and use dj now You might wonder why dj exists instead of a simple scroll bar Imagine scrolling through the entire IA 64 address space it would take a long long time Figure 1 8 The Data Window Showing the argv and envp Vectors Looking at the Data Window you can see that the first 16 bytes of the stack are all zeros This is a scratch storage area The next 8 byte word contains argc the argument count It has a value of 1 as the only argument passed to the program is the program name itself The arge count is then followed by the argv and envp vectors All C programs receive the same kind of data structure for argv a variable length vector of char pointers whose end is marked with a NULL pointer In Figure 1 8 the first of the char pointers is 9 938 The first char pointer may be in a different place on your system Adjust the following instructions accordingly Jump the Data Window there using the command dj 9ffffffffffff938 12 f s and you will see Figure 1 9 showing the hexadecimal codes for the null terminated ASCII 1 6 Getting Started A Ski Tutorial Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L character strings of argv and envp In a moment you ll learn how to
4. data start 48656 6E2c2077 61726264 02000000 Hello world amp O000000000001010 40282329 20582630 37203031 04c5036 B H X 02 01 LP6 GODOODDOOUOOTUES 34204544 20122032 205c6062 632e615f 4 EM 2 2 libe a_ pOODODUOGOUOOTUTO 49444040 20646169 7237 30730163 IDGR main rlT gac e amp o00o0UGOUUOTU4G Zf6c 962 635 736 63253204 40282329 libc sac 2 B8 8 BDO Z02fF7578 2 636f72 652E6c69 62732f 6c ux core libz l amp 000000CO0U0O01060 6952632 61726368 6976655I 656di232 ibc archive em22 5f35142 6696263 2e615 40 44024028 Alibec ID B 23292041 75672032 17203119 3936828030 Aug 27 1996 0 32321132 32353600 OOOOH Tele ss Figure 3 14 xsk s Data Window Showing Unallocated Space Followed by Data Ma ELE 17 00108001100 04000000000 04000000000 00 02c00308880 13000190380 10800 00800 4000000000000750 02 00008000000 00188000840 119 8 0300 4000000000000760 11 080 0 008 0 00008000000 Obi1fffb3000 4000000000000770 00 10802000300 00154044000 00800142000 4000000000000780 11 00008000000 00008000000 00108001100 do global cto 01 02c00408880 130001a0800 1c030000000 40000000000007a0 0 080c2000800 00008000000 00188000840 40000000000007b0 Oa Oa0c23103cB 080c2300046 00 0011 186 40000000000007 0 1d 0 0 08 0 00008000000 02000004006 4000000000000740 1c 1d8323fe000 00008000000 091FFFFc006 40000000000007e0 00 00008000000 00154044000 00 00142000 Figure 3 15 xskfs Data Window Sh
5. ee al 1 1 122 Exiting SK uuo de be Bo Seeded BAL Beta nf ead s d mt Re d Belts gs the 1 3 1 2 3 Loading Your Program s 4 44 di ue dde ee oom ae m 1 3 1 2 4 Inspecting DataS ans PAS ake B Blue ES Saeko uU A oz eh A Sole 1 5 12 5 Viewing Data ASCIT o os oco D de be ee vo lk ea es 1 8 12 6 Looking at Code sui me iG Se ee ye po wa om e Bel dob alg 1 8 1 2 7 Viewing Source Code Mixed In with Assembly Code 1 9 1 8 Controlling Breakpoints cics c are RR eR RUE 1 10 1 2 9 Running a Program 1 11 1 2 10 Single stepping Program 1 12 1 2 11 Changing Registers and Memory 1 13 1242 Getting Helps si m sate ets Ge Stet ee ee APA BES Bo 1 17 12 13 Next Steps SS A bee PR ed Pu RYB V esas 1 17 2 OyervIeW ou xo eh Baw eeu ESAS END eu beeen waa sei aes 2 1 2T Introduction ae divy V PSIG ae OY waned MARE LR te ee ee 2 1 211 Skr S Strengths omm 2 1 2 1 2 Skrs Scope e e mr Tue NES 2 1 2 2 What You Need to Know to Use This Manual 2 1 2 3 Defects and Defect Reporting 2 1 2A Ski Variations sete RE uus eS
6. simulated exited The value 0 until the simulated program exits Then the variable takes the value 1 heap The address of the bottom of the simulated heap insts The number of instructions simulated so far Copyright 2000 Hewlett Packard Co Internal Variable Names 1 Ski 1A 64 Simulator Reference Manual 1 0L C 2 Internal Variable Names Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L D Simulator Status and Error Messages The following is a description of some of the status and error messages which can be produced by the simulator Fault and Trap messages are usually the result of a program trying to do something that under Linux would cause a signal to be generated The constructs are printf substitutions Where s appears a string will be substituted in the error message at runtime Where llx appears a 64 bit hexadecimal integer will be substituted in the error message at runtime See the printf man page for more information on substitutions All breakpoints deleted You executed the bD command Ski is confirming that it has deleted all the breakpoints This is a status message not an error message See Deleting Program Breakpoints on page 8 5 All breakpoints in use You tried to set a breakpoint but all ten are in use Use the b1 command to list them and then the bd or bD commands to free up some for you to use See Setting Program Breakpo
7. Application Mode and System Mode Simulation heap marks the address past the far end of the simulated heap that is the end farthest from the end of the data section The heap starts at the first sixteen byte aligned address after the data section Ski updates the heap variable as the program being simulated malloc s memory for pro grams written in C adapt accordingly for other programming languages You can use the heap variable to debug wild pointer problems if your program has a pointer that allegedly points to a malloc ed data structure but the pointer value exceeds heap the pointer is invalid For system mode programs and IA 32 programs this variable is meaningless as there is no malloc support insts The number of instructions that have been simulated so far including any faulting instructions for programs run ning in system mode described in Section 6 1 Application Mode and System Mode Simulation In a command file you might use this variable to stop simulation after a certain number of instructions The value of insts is always equal to the value of cycles for IA 32 programs 4 4 2 4 Labels Labels see Section 9 2 Labels and Control Flow in Command Files are names which consist of an alpha upper or lower case alphabetic or _ followed by a sequence of alphas or digits e g abc123 foo bar etc and ending with 66 97 a colon They may be up to 132 characters long Labels
8. Figure 1 20 Figure 1 21 Figure 1 22 Figure 1 23 Figure 2 1 Figure 2 2 Figure 2 3 Figure 3 1 Figure 3 2 Figure 3 3 Figure 3 4 Figure 3 5 Figure 3 6 Figure 3 7 Figure 3 8 Figure 3 9 Figure 3 10 Figure 3 11 Figure 3 12 Figure 3 13 Figure 3 14 Figure 3 15 Figure 3 16 Figure 3 17 Figure 3 18 Figure 4 1 Figure 4 2 Figure 5 1 Figure 5 2 Figure 5 3 Figure 5 4 Figure 5 5 Figure 5 6 Figure 6 1 Figure 6 2 List of Figures Starting XSki From the Command Line 1 2 The Four Primary xSki Windows 1 3 Loadmgthe hello Program eR ee BL 1 4 The xskiProgram Window 1 4 The XSki Data Window 4284 8 Ba Yd we Rae RE ae 1 5 The xskiRegister Window 1 5 Changing the Data Window Display 1 6 The Data Window Showing the argv and envp Vectors 1 6 The Data Window Showing argv and envp Strings in Hexadecimal 1 7 The Main Window Showing Commands in the Command History 1 7 The Data Window Showing argv and envp Strings in ASCII 1 8 Jumping the Program Window to the Beginning of main 1 9 The Program Window Showing Code at the Beginning of main 1 9
9. For xski and bski only This flag tells Ski not to create a separate console window for the simulated program s standard I O Instead Ski will use the existing console window s for standard I O purposes in the simulated program rest filename Restore the simulator run saved in filename See Section 8 6 Saving and Restoring the Simulator State This flag cannot be combined with an program filename If combined with a i flag the i flag is accepted and the rest flag is silently ignored stats For bski only specifies execution run time and instruction rate information should be send to standard out stdout at the end of the run This information is normally displayed in the Main Command Window of xski and ski The stats flag allows users of bski to get the same information 2 5 2 The xSki File xskis screen presentation is substantially controlled by the contents of the xski file which uses the X Window System s resource mechanism to provide information to xski You can edit this file to change Xxsk s use of graphic buttons described in Section 3 7 1 The xski Main Window The xSki file is part of the standard Ski distribution and you should put this file in your X Window System s app defaults directory or in your home directory If there is no valid xski file the simulator will not be usable You can find more information on installing XSki in the release notes that come with each Ski distribution Copyright 2000 Hewlett
10. bar gt baz SMALL UPPERCASE is used for processor instructions such as BREAK fixed width regular is used for directories and filenames such as hello and for web URL s such as http www hp com Syntax Conventions In this manual symbols are used as described below italic Square brackets surrounding optional argument s indicate that the argument s can be omitted as in the Appendix A Command Reference description of the dj command dj address Copyright 2000 Hewlett Packard Co Preface iii Ski 1A 64 Simulator Reference Manual 1 0L italic A plus sign applied to an argument indicates that the argument must be supplied one or more times as in the Appen dix A Command Reference description of the eval command eval expression without spaces italic A plus sign applied to optional argument s in square brackets indicates that the argument s can be supplied zero or more times as in the Appendix A Command Reference description of the load command load filename args iv Syntax Conventions Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0 Table of Contents 1 Getting Started A Ski Tutorial lt lt ee ee es 1 1 1 1 The SkiSimulator o soe we eg Bs zim EO Mae vy ye Plate eat 1 1 1 2 How to Run an IA 64 Application Program 1 1 121 Starting XSKl 2 35386 8 he bh lee
11. etext and tells ia test where test com was loaded The IA 64 program completes its initialization and transfers control to the IA 32 program setting the psris bit appropriately When the IA 32 program completes bski prints out end of run performance statistics and writes an instruction frequency count to the file instruction_counts 9 2 Labels and Control Flow in Command Files Command files are useful as macro sequences of simple commands and more interestingly to create small programs that do useful things for you create formatted displays of data structures create complete breakpoints and gather run time statistics for example Two commands provide the ability to change the flow of control in a command file goto and if 9 2 1 The goto Command and Labels A label identifies a particular line in a command file Labels are defined in Section 4 4 2 4 Labels No other text can appear on a label line The goto command takes a label as an argument and searches the command file for a line with that label Execution resumes at the first command after the label There is no good reason to have a label appear more than once in a particular command file if this condition occurs only the first occurrence of the label will be noticed and all subsequent occurrences will be ignored The goto command can only be executed in a command file A goto may go forward or backward An Copyright 2000 Hewlett Packard Co Command Files 9 1 Ski 1
12. 0 nop b 0 0 006 printf hello world n gt main alloc r d ar pfs 0 3 1 0 addl r14 0x1118 r1 mov r32 r12 main 0010 nop m 0 0 mov r33 b adds r12 16 r12 main 0020 1d8 r35 r14 nop i 0 0 br call sptk many b0 _I0_printf 007 return 0 main 0030 mov r8z0 mov r12 r32 mov i ar pfs r34 main 0040 0 0 mov b0 r33 br ret sptk many bOs Figure 1 13 The Program Window Showing Code at the Beginning of main 1 2 7 Viewing Source Code Mixed In with Assembly Code The Program Window shows the C source code intermixed with the IA 64 assembly code You can turn the source code Copyright 2000 Hewlett Packard Co Getting Started A Ski Tutorial 1 9 Ski 1A 64 Simulator Reference Manual 1 0L display off or on using the pa program assembly and pm program mixed commands respectively Mixed code dis play only works if you have the source code to the program available to Ski the source code isn t embedded in the ELF file Also you must compile your code with the appropriate compiler flags for example with the g flag used by many compilers to generate debug line record information If your program is composed of multiple object files for example o test foo o bar o baz o Ski can only show source code from the files compiled with the g flag Make sure the Program Window is in mixed mode for now 1 2 8 Controlling Breakpoints You can think of Ski as a debugger that happens t
13. 9 8 as the address to jump to Compare the Data Window display resulting from dj r12 18 with the display resulting from r12 18 You will use the operator a lot in debugging C programs because it performs the same function as C s operator it dereferences pointers Unlike C s however Ski s operator is not type specific you can use it in any context where any kind of address is needed and you can use it to dereference registers like r12 memory locations or anything that has a value This doesn t always make sense of course For example dereferencing a floating point register is rarely useful because floating point registers don t hold pointers 1 2 5 Viewing Data in ASCII Hexadecimal is no fun To expose the ASCII translation use your window manager s standard mechanism to make the Data Window wider How you do this depends on the window manager you re using but generally this can be accom plished by grabbing the edge of the Data Window with your mouse cursor and dragging it to the right You should see approximately Figure 1 11 Now click on the Main Window to make it the active window again Try the data or wards and db data backwards commands without operands to move forwards and backwards in the Data Window one screenful each time Data Window Figure 1 11 The Data Window Showing argv and envp Strings in ASCII 1 2 6 Looking at Code Initially the P
14. cr rr pkr dbr ibr pmc and pmd in the Register Window ur Displays the user registers pr br ar ip psrum in the Register Window rf count Moves the Register Window forward scrolls down through the currently displayed register set The Register Window is scrolled count lines If count is omitted the Register Window scrolls down one windowful less one line i e the last line of the old window is displayed as the first line of the new window rb count Moves the Register Window backward scrolls up through the currently displayed register set The Register Window is scrolled count lines If count is omitted the Register Window scrolls up one windowful less one line i e the first line of the old window is displayed as the last line of the new window 5 2 Program Window Commands The Program Window displays disassembled instructions one instruction per line See The Program Window on page 3 6 5 2 1 Summary of Program Window Commands pj address If address is specified repositions jumps the Program Window so that the IA 64 bundle or IA 32 instruction containing the specified address is second in the window If no address is given jumps to the previous location The mnemonic stands for program jump pf count Moves the Program Window forward count 64 bundles or IA 32 instructions If count is not specified moves the Program Window forward one windowful less one bundle or inst
15. lt lt gt gt group operators with operands opposite truth value logical one s complement unary plus unary minus dereference treat as an address and read eight bytes multiply divide add subtract logical left shift logical right shift less than less than or equal to greater than greater than or equal to equal to not equal to bitwise and bitwise exclusive or bitwise or logical and logical or As an example in XSKi eval 64 0464 0064 0b100000 main 0D1234 0X10EF0 4 lt lt 6 0B10001001 prints the values of the six expressions in the Main Window as shown in Figure 4 1 The first expression is taken as a hexadecimal number the second as a decimal number the third as an octal number and the fourth as a binary number The fifth expression is the value at the location specified by the symbol main the first 64 bits of the code bundle at that loca tion and the sixth expression is the result of some arithmetic File Vies Configure main Step Prog Data Pegs Couche TLE Quit load hallo evel QG Jod Ob1 00000 demain LDV 22 DOT DEF ON 4 e n8 061 OO Decimal an Decimal 14 Decimal 52 20 Decimals 32 8150680052002 Decimal 2274926065426414 2088 Decimal 1ES46 7440798974 70688 Figure 4 1 xski Evaluating Expressions 4 3 Copyright 2000 Hewlett Packard Co Command Language Ski 1A 64 Simu
16. rd filename Dump the Register Window to the screen in a new window XSKi or using a pager Ski or if filename is provided to the file given by filename The mnemonic stands for register dump 5 1 1 1 xski Register Window Commands fr Toggles display of the floating point registers fr pane in the Register Window See Figure 3 4 The xski Floating Point Registers Pane on page 3 4 gr Toggles display of the general registers gr pane in the Register Window See Figure 3 3 The xski General Registers Pane on page 3 3 iar Toggles display of the IA 32 registers eax ebx esp etc pane in the Register Window See Figure 3 6 The xski IA 32 Registers Pane on page 3 5 sr Toggles display of the system registers cr rr pkr dbr ibr pmc and pmd pane in the Register Window See Figure 3 5 The xski System Registers Pane on page 3 4 ur Toggles display of the user registers pr br ar ip psrum pane in the Register Window See Figure 3 2 The xski User Registers Pane on page 3 3 5 1 1 2 ski Register Window Commands fr Displays the floating point registers r in the Register Window gr Displays the general registers gr in the Register Window iar Copyright 2000 Hewlett Packard Co Screen Manipulation Commands 5 1 Ski 1A 64 Simulator Reference Manual 1 0L Displays the 32 eax ebx esp etc registers in the Register Window sr Displays the system registers
17. 00 or 0o zero oh for octal and or 0b for binary Since both the decimal and binary prefixes look like hexadecimal hexadecimal values such 04600000 and 06100000 must be speci fied either with an explicit hexadecimal prefix as in 0x0d600000 and 0x0b100000 or without the leading 0 as in d600000 and b100000 4 4 1 2 Expressions Wherever a number or count is needed you can use a numeric expression instead with parenthesis as needed for group ing No spaces are allowed in an expression In an expression whose result will be used as a number numbers not pre ceded by a radix override are assumed to be hexadecimal If the result will be used as a count numbers not preceded by a radix override are assumed to be decimal For example the step command expects a count operand so the command step r0 10 steps decimal ten instructions On the other hand the pj command expects an address operand which is a number so the command pj r0 10 displays hexadecimal address 0x10 in the Program Window r0 is hardwired to always return a zero when read The available operators are shown in order from higher to lower precedence in Table 4 1 Operator precedence rules fol low the C language rules 4 2 Command Language Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Table 4 1 Ski Simulator Arithmetic and Logic Operators Operator Description 1 lt lt gt gt
18. 3 5 2 TA 32 Instruction Display lt s cse RR EE na 3 8 3 5 3 Changing the Range of Locations Shown in the Program Window 3 9 3 5 4 Invalid Code and the Program Window 3 9 3 6 The Data Window hs BREA Be RE Sl eh eub Ban S e d 3 10 3 6 1 Changing the Range of Locations Shown in the Data Window 3 11 3 6 2 Invalid Code and the Data Window 3 12 3 7 The Command Main Window 3 12 3 7 1 The xski Main Window 3 12 37 2 The ski Command Window 3 13 3 8 Other Windows cu ot ete de ip rh Lee ni a see ee Bs 3 14 4 Command Language dun Ant A a de tes ae mu ee be Ge u 4 1 Copyright 2000 Hewlett Packard Co Table of Contents Ski 1A 64 Simulator Reference Manual 1 0 4 1 Command Bantry Ga ater Ee ed a ee eee PIU 4 1 4 2 Command Argumehts esos Gee ee 78 08 RR dis ak us Ek ele eg So Gok das 4 1 4 3 Command Sequences Repetition and Abbreviation 4 1 4 4 Argument Specilication esea RU pas Bah Rue PK mere 4 2 4 4 1 Numeric Arguments 4 2 442 Symbolic Argument areas s EY 4 4 4 4 3 Resolving Ambiguous S
19. 5E36342f 6c U5953 A amp DaMITR GA libe a ID B EHO OB 23292041 75672032 37203139 39362030 Aug 27 1996 G OK 32343132 33353600 00000090 00009008 2 12 56 5009000000001 01090090000 09000000 00900000 00000000 islas Figure 5 5 xski Showing Data Raw Hexadecimal and ASCII dd starting address ending address filename Dump the memory area between the two addresses inclusive to the screen Ski or window XSKi if no filename is given or to the specified file if one is The dump will be in the format selected by the most recent dbndl or dh command An example of a hexadecimal dump is shown in Figure 5 6 The mnemonic stands for data dump daitacdump popup data start 49656che 6I2c2077 Gf T26c 654 Hello world a eooeonnconi010 40282329 P0592210 32253031 204c5036 BCR X 02 01 LPG AD O 3420454 20322637 20606062 632e015f 4 EM 2 2 libc a G6UOODUOODUOGOU 030 49444040 216461589 Gest F231 2073617063 IDBB main rlOgac 01 zi6c Ub2 6357361 53213204 40282329 libc sac 2 8 H4 5000000000901 050 z 02fI7578 2I636f72 65zf6cb9 627i12E6c ux core libs 1 508 00000004201 050 6962632 61726368 6976655EF 65645232 ibc archive emt DgODOODUUGOU1070 5f36342f 6 696261 2e615 49 45008028 p libc a ID B 23202041 756872032 37203139 19162010 Aug 27 1996 0 SOIREE BIO 323a313132 34353600 HOC GOON 2 12 56 G cgoogobucon16a0 QODUOOOUO DORON Goce GOCODOODUG
20. Commands bs address Sets an IA 64 breakpoint at the specified address or if no address is given at the location pointed to by ip 8 6 Debugging Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L iabs address Sets an IA 32 breakpoint at the specified address or if no address is given at the location pointed to by ip bd breakpoint_number Deletes the breakpoint numbered by breakpoint_number bD Deletes all breakpoints bl Displays a list of currently set breakpoints 8 4 Data Breakpoints Data breakpoints can be viewed as temporary access restrictions on an area of data Access of a datum within the specified area causes a running program to halt at the instruction which attempted the access Control is then returned to the user at command level The simulator allows up to ten areas to be specified within which data breakpoints may be set They may vary in size from one byte to an entire region Further the area may be specified to cause a break either only on reads writes or on both reads and writes Several commands apply to the manipulation of these data breakpoints 8 4 1 Setting Data Breakpoints The dbs command sets data breakpoints The command requires two arguments and accepts an optional third argument The first argument is the starting address of the area which is associated with the break The second argument specifies the length of the area in bytes The third argument if present
21. Manual 1 0L Program Window DTHAMI Ci 7 be illegal p illegal p illegal p naim mav i mr nop m movl r2 xDoggoaccz 090331 main mo ar fpsrerz alloc r Bar pfs O 0 3 0 adds risi6 r36 maindf 30 nop m O20 movi r5 scall entry table del idt UD sts r5l r B main SE O20 0 0 br call sptk few bis startyy 2 mav riii or ri r break 1 fa feng Close Gotal Help Figure 3 12 xsk s Program Window Showing Illegal Instructions Program Window xxkxzxxkxx 1 0 xxxzxkxx DCDUCOODDODUDOO20 xxxkxxkxx xxxxxxxx OGDDOOOGODODOUDOO4G0 xxxxxxxx OCD UCOOCOODUDOU 50 xxxxxxxx xkxxxkkXXx OCGD CHODUCKOUCOOD I ZEKXZEKE OCOGD CHODOCOOUCOODSO ZEHEZEKE GODUCHKODOCOOUOODSO zxxsxxxkxx UCFDOCHOODCDUOCOOUAD xxx xxxxXx UCDDCODDODODOObOU xxxxxxxx cO xxxxxxxx xxxxxxxx xzxxxxxxx zxxzxxxx GODUCHODOCGOUOOTUO EAEAN CHOCO xxxszxsgxx ZU xxuxxxkExx UCHDOCHKODDCODODOS JG xxkxxkkix OGC 40 xxxxxxxx Close Goto Help Figure 3 13 xsk s Program Window Showing Unallocated Space or No Translation 3 6 The Data Window In the Data Window xski and ski present data in hexadecimal format sixteen bytes to a line as shown in Figure 3 14 The data are displayed as four groups of eight hexadecimal digits ea
22. Packard Co Overview 2 5 Ski 1A 64 Simulator Reference Manual 1 0L 2 6 Quitting Ski The quit command causes the simulator to exit If a numeric operand or expression is supplied the value is returned to the shell as Ski s exit status This can be particularly useful with bski and command files see Chapter 9 Command Files for automated testing and regression testing The exit status from Ski becomes the new value of your shells variable for most shells and can also be retrieved automatically by the make program if you use makefiles to control batch runs 2 6 1 Summary of the Quit Command quit expression Terminates the simulator and returns control to the system setting the exit status to expression default is 0 2 6 Overview Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L 3 Screen Presentation 3 1 Ski s Use of Windows XSki and Ski generally divide the screen into four windows bSki doesn t create any windows because it has no user interface only a command line interface xSki uses Motif windows which you can move and resize using the mecha nisms provided by your window manager WindowMaker Englightenment fvwm twm etc XSki creates additional win dows as necessary Ski uses the curses package to create four windows on the terminal screen Because Ski uses curses it runs on nearly any terminal or terminal emulator including xterm When ski needs to show data that i
23. Reference Manual 1 0L Breakpoints Figure 8 4 xski s Breakpoint List Window Showing IA 64 and IA 32 Breakpoints 8 3 4 Notes on Program Breakpoints 8 3 4 1 How Ski Implements Breakpoints Program breakpoints are implemented by replacing the instruction at the address of each breakpoint with an 64 BREAK instruction or an IA 32 INT3 instruction The replacement is done at the time the program is started or restarted e g with cont and the original instructions are replaced when the program halts Thus if your program reads the loca tion where a breakpoint is set it will retrieve the BREAK or INT3 instruction instead Ski detects if your program attempts to write new data into the breakpoint location and automatically reinstalls the breakpoint after such an update You need to tell Ski where to set your IA 64 breakpoints but the 64 architecture doesn t provide for addressability of individual instructions Instead instructions are bundled To work around this Ski pretends that the slot 0 instruction of a bundle is in the first four bytes of the bundle s location the slot instruction is in the second four bytes of the bundle and the slot 2 instruction is in the third four bytes of the bundle You can only set breakpoints at these pretend locations For example setting a breakpoint at main main 1 main 2 and main 3 all result in the breakpoint being set on the first instruction in the bundle
24. Simulator Reference Manual 1 0L The hexadecimal value 0x1234 is assigned to general register 1 The six upper more significant bytes are padded with zeroes rl 1 10 The value in ip added to 0x10 is assigned to general register 1 f2 m 1234 f2 s 1 f2 e 10033 The hexadecimal value 0x300330000000000001234 is assigned to floating register 2 The register now encodes the decimal value of 2 2754 approximately The 2 m 1234 part sets the mantissa the 64 low order bits The 2 s 1 part encodes the mantissa sign the most significant of the 82 bits The 2 e 10033 encodes the 17 exponent bits which fit between the sign bit and mantissa bits using a bias of 65 535 Oxffff 4 _data_start 30 0410 13feffff b3 The decimal value 10 is assigned to the four bytes starting 48 bytes past the location of the symbol data start Because the value 10 occupies only one byte three high order zero bytes will be padded in so the actual value assigned will be 0x0000000a The value 13feffff is assigned to the four bytes starting 52 bytes past the location of data start The lower four bytes of branch register 3 will be copied into the four bytes starting 56 bytes past the location of __data_start To assign the value Oxb3 use the 0x prefix s main ThisProgramIsBroken The string ThisProgramIsBroken with a null byte appended is placed in memory overwriting the instructions at the start of the program as
25. The general registers pane is shown in Figure 3 3 The General Registers Pane ri OGDOCKHODOODHIOOUgO GODDOOUDOOUOO9ab6S r EV O OH CHO CH GOOCODOODULU beci ICH HON CHOV CHKO HCCC Ce Cao r UCGDOCOOOCOOUCOUOO GOUCODOCOODOODOCOD OUDODOCKODUOT DCROU DOCOUCODDCOOUOOOOUL ri DEEEEFEEEEEEFbAD ODDODOCGODDOODOO DOCDDOCODOCOUOCOUOUU ri OCDOCOOOOOOOODOO0 CGOOOODOCOOOOODUOOD ODOODOCODUOOODDCOOUD ODOODOODDOODOOo 0 r CRP ONOM CHO CCI enpeo donO62beca DDOODEORODOCOOOO BODOCOOUOODOOZORE AA CHO C CPC r cp aconocooncon o ONI SH CHE r32 D T LLETETELEMHO GODOGODUOOQUO 338 cOODODODOGOOUQO rat AGDUCKODOOODOR T40 Figure 3 3 The xski General Registers Pane 3 2 3 The floating point registers pane shows the current values of the 82 bit floating point data registers two to a line displayed in hex and scientific decimal notation Floating point registers 32 127 are displayed in their rotated form as indicated by the rrbf field of the cfm register displayed in the user registers pane The floating point registers pane is shown in Figure 3 4 with various values in the registers The Floating Point Registers Pane Due to the nature of float
26. Translation Lookaside Buffers for system mode programs 6 3 3 1 Summary 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 PL D MA and 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 Ski 1A 64 Simulator Reference Manual 1 0L Data TLB v RID Virtual Page P
27. VAC 9gcoondoo Dobmgono oeggeonae COCA agniegno b maint 22BE0 60 hz O Dgo pOoDOOOU D OOOUgOoDOOGCODOODUOO b bar SGD OCA OAC rrbp rrhf rrbg sor sol sol le ODUCGODOODOODUOOD OD hal T5 cim g u b g e 1 4 pec ppl 3 pln 0 g 13 clean 0 cleanWAT dirty 15 dirtyHAT O invalid 76 rle bsp SEEEEEEETESGOOOTE bspst 60000 roat unat 00RD 0 000000 fpsr HO0080acH2700345 itc OODCOCOUCODUOCHOUEO ccv ODOCOODOCOODOCHOUCDOH k GBoo0B00O600600600 k ODOOOUUOODOOOD OD OODOODOCOODGOODOOO k OBUODOUDOOUUOOUDUODUU OUDODUOODUDUODUOOD k ODUODUUOGODOOOUOOD COUCHE ellags GOUDODIOOUOOUUOGD cila ODOODOOGODOOGDIOOH ceed UGDOCODOCOULIHODUOCO sed ODCOODDCOODOCHODCORO Figure 3 2 The xski User Registers Pane 3 2 2 The general registers pane shows the current values of the 64 bit general integer data registers four to a line in hexadec imal Registers whose corresponding NaT bits are set are displayed with a leading asterisk to indicate this The dis play reflects 64 register stacking and rotation only the 32 static registers and the stacked registers allocated to a function are displayed The allocated rotating registers are displayed in their rotated form as indicated by the rrbg field of the cfm register displayed in the user registers pane
28. Window Bat pu txt 5f ret start maw ax Ox1640 start40003 mov ds st 000 5 mov en HK starts and sp Uxfffc start 00 n call get cpu type start4dod call Bet pu type start 01 call print start mow ax 4 start int Hz print dx 54 prints 0003 ah 9 print 0005 int xzl print 0007 cmp byte ptr 10 1 prdnt 000c jnz printon11 print HDn jap pr init 11 byte ptr 8 prinktoib jnz print HET print40 8 dx 92 print GTh ah 9 print i di Ox 21 Figure 3 11 xsk s Program Window Showing IA 32 Code the Instruction Pointer and a Breakpoint 3 5 3 Changing the Range of Locations Shown in the Program Window xski doesn t place a scroll bar in the Program Window Instead like ski xski provides the pf and pb commands described in Section 5 2 Program Window Commands You use these commands to scroll the Program Window for wards and backwards respectively through the assembly language program display Ski also provides the pj command which lets you jump the Program Window to any location in the address space In addition XSKi understands the Page Up and Page Down keys and the arrow keys When the Program Window has the X Window System focus the Page Up Page Down up arrow and down arrow keys emit the pb p pb 1 and p 1 commands respectively You can control the size of XSKi s Program Window using your window manager s standard mechanisms I
29. at main Similarly main 5 main 6 and main 7 all correspond to main 4 and main 9 main a and main b all correspond to main 8 If you try to set a breakpoint at the remaining bytes in the bundle main c main d mainte and main in this example Ski will generate the error message Illegal slot field in breakpoint address Ski can place IA 32 breakpoints at any byte address If the break point address doesn t correspond to the beginning of an IA 32 instruction Ski s behavior is undefined 8 3 4 2 Unexpected Breakpoints The 64 breakpoint mechanism uses BREAK M 0 BREAK 0 BREAK B 0 and BREAK F 0 and BREAK X 0 instructions These are special cases and executing these instructions will not cause BREAK instruction trap interrupts for system mode programs The same is true for INT3 instructions in IA 32 code However if Ski finds BREAK or INT3 instruction at a location which doesn t correspond to a breakpoint Ski s behavior depends on whether the program is simulating in application mode or system mode Application mode programs should never generate or expect to receive interrupts If Ski reaches a BREAK or INT3 instruction in an application mode program at a location which doesn t correspond to a breakpoint simulation halts and Ski displays an error message System mode 64 programs will receive the BREAK interrupt 8 3 5 Summary of Program Breakpoint
30. bits IA 64 Register Save Engine RSE Not a Thing NaT Collection Register IA 64 Return Pointer a synonym for bO IA 64 Region Registers IA 64 CFM Register Rename Base for floating point registers IA 64 CFM Register Rename Base for general registers IA 64 CFM Register Rename Base for predicate registers IA 64 Register Stack Configuration Register IA 32 Arithmetic Registers si is two bytes wide esi is four bytes wide with si as the two least significant bytes IA 64 CFM Size of Stack frame IA 64 CFM Size of Locals Portion of Stack frame IA 64 CFM Size of Rotating Portion of Stack frame IA 64 Stack Pointer a synonym for r12 For the IA 32 equivalent of the x86 sp register see the description of iasp above 64 Stack Pointer Not a Thing bit a synonym for r12 nat IA 32 Stack Segment Register IA 32 Stack Segment Register Descriptor IA 64 Task Priority Register IA 64 User Not a Thing NaT Collection Register Copyright 2000 Hewlett Packard Co Register Names 5 Ski 1A 64 Simulator Reference Manual 1 0L B 6 Register Names Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Internal Variable Names Ski has one combined symbol table for registers and internal variables See Section 4 4 2 2 Registers and Section 4 4 2 3 Internal Variables A separate symbol table describes program defined symbols C 1 Internal Variables cycles Number of virtual cycles
31. cannot re run a program nor can you re load it and start over You must exit and re enter XSki and then reload your program Copyright 2000 Hewlett Packard Co Getting Started A Ski Tutorial 1 11 Ski 1A 64 Simulator Reference Manual 1 0L Linux ia64 Console hello world I Figure 1 16 The Terminal Window After the hello Program is Run main File View Configure bs main bs main 10 bs main 20 Command All breakpoints deleted program exited with status 0 19639 insts 0 39 sec 49899 1 5 7287 cycles 2 70 ipc Figure 1 17 The xski Main Window after the hello Program is Run 1 2 10 Single stepping a Program To try single stepping and no this is not a kind of ethnic dance set a breakpoint at main 10 Then use the run com mand or Run button to simulate the program up to the breakpoint If you receive the error message Nothing to run stop and reread the last sentence in the previous paragraph Ski stops at the breakpoint and notifies you with a message in 1 12 Getting Started A Ski Tutorial Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L the Main Window Ski tells you why it stopped and gives you statistics about program execution up to this point as you can see in Figure 1 18 The Program Window marks the next instruction to be fetched with a greater than symbol in the second column If the instruction is predicated off Ski uses an asterisk ins
32. is the string rw default which indicates that the break is to occur both reads or writes r which indicates that only reads cause breaks which indicates that only writes cause breaks 8 4 2 Deleting Data Breakpoints Two commands delete data breakpoints The dbD command deletes all data breakpoints currently set It takes no argu ments and requires no verification from the user The dbd command deletes the data breakpoint with the number specified by the argument 8 4 3 Listing Data Breakpoints The dbi command causes a list of currently set data breakpoints to be displayed on the screen symbolically if possible 8 4 4 Summary of Data Breakpoint Commands dbs address length type Sets a data breakpoint at the specified address The length of the area in bytes is set to length Type is the string rw default specifying breaks on reads or writes r specifying breaks on reads only or specifying breaks on writes only dbd number Deletes the data breakpoint numbered by number dbD Deletes all data breakpoints dbl Displays on the screen a list of currently set data breakpoints Copyright 2000 Hewlett Packard Co Debugging 8 7 Ski 1A 64 Simulator Reference Manual 1 0L 8 5 Dumping Registers and Memory to a File You can dump the registers to a file with the rd command described in Section 5 1 Register Window Commands You can dump a block of memory into a file in two forms in hexadecimal
33. little endian format s address string_without_spaces The string_without_spaces is assigned to memory locations starting at the location specified by address A null byte is added to the end of the string automatically The old value at the location is lost The location may be on any allo Copyright 2000 Hewlett Packard Co Command Reference 1 Ski 1A 64 Simulator Reference Manual 1 0L cated page including instruction pages Multiple values may not be supplied The string may not contain spaces and quoting it is not a workaround See Changing Registers and Memory with Assignment Commands on page 8 1 bs address Set breakpoint at the location specified by the current value of ip or at the specified address IA 64 code only See Setting Program Breakpoints on page 8 4 bD Delete all breakpoints See Deleting Program Breakpoints on page 8 5 bd breakpoint_number Delete breakpoint breakpoint_number Use the b1 command to get a list of all breakpoints and their corresponding numbers See Deleting Program Breakpoints on page 8 5 bl Display a list of current breakpoints See Listing Program Breakpoints on page 8 5 cont Continue simulating the program from the current ip value Most commonly used after the simulator stops at a breakpoint See Program Execution on page 6 5 dj address Jump the Data Window display to the specified address If no address is given the window display changes to
34. 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 64 processor Copyright 2000 Hewlett Packard Co Program Simulation 6 1 Ski 1A 64 Simulator Reference Manual 1 0L 6 3 1 System 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 speci
35. provide can be simulated The release notes provide the most up to date information on Ski s support for the Linux Application Binary Interface ABI The following sections provide a short tutorial which leads you through an IA 64 program session with xski You will learn how to use the most common Ski commands 1 2 1 Starting xski As shown in Figure 1 1 start XSki by typing its name to the Linux shell just like any other Linux program as shown in Figure 1 1 When running inside the IA 64 Linux Native User Environment NUE make sure that the environment vari able DISPLAY is set to a string of the form hostname display e g myhost 0 values such as unix 0 or 0 won t work before invoking xski If you have never run the simulator before it will first prompt you to read and accept the software license it is distributed under After accepting the license the four primary XSKi windows will be displayed on your screen as shown in Figure 1 2 No IA 64 program is loaded yet so the Program Window and Data Window are empty Scroll the various panes of the Register Window and note that with few exceptions the registers are set to zero Copyright 2000 Hewlett Packard Co Getting Started A Ski Tutorial 1 1 Ski 1A 64 Simulator Reference Manual 1 0L Figure 1 1 Starting xski From the Command Line 1 2 Getting Started A Ski Tutorial Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Data Wind
36. registers internal variables labels and filenames Arguments may and sometimes must be expressed symbolically 4 4 2 1 Program Defined Symbols A program defined symbol is an identifier which can be used as a mnemonic for a memory location Program defined symbol names are defined in the executable file for the program being simulated Some symbols are common well known names e g printf main and others are defined by the programmer e g foo bar The symlist command shows you the symbols sorted by address as Figure 4 2 shows Wen ere Figure 4 2 xsk s Symbol List Window 4 4 2 2 Registers A register name is a predefined mnemonic for a processor register The general registers for example are referred to as 0 r1 r127 The register names Ski recognizes are listed in Section B 1 64 Registers For example the com mand r31 ip 4 4 Command Language Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L assigns the value contained in the ip register to general register 31 For a description of the command see Section 8 1 Changing Registers and Memory with Assignment Commands Wherever the simulator expects you to supply a numeric argument you can use a register instead You may only refer to currently visible registers according to the stack ing and rotation mechanisms of the 64 architecture 4 4 2 3 Internal Variables The simulator provides internal
37. shown in the before and after views of Figure 8 1 and Figure 8 2 The symbol main tradi tionally marks the first instruction of a user program written in the C language The instructions previously at that loca tion are lost If you attempt to run the program it will almost certainly fail Note that the string is not quoted and has no whitespace Figure 8 1 The Original Program Loaded in ski 8 2 Debugging Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Figure 8 2 The Program After Assigning a String in ski 8 1 3 Notes on Assignment 8 1 3 1 Address Alignment Ski aligns addresses on natural boundaries two byte quantities are aligned on addresses divisible by two four byte quan tities are aligned on addresses divisible by four and eight byte quantities are aligned on addresses divisible by eight For example the command 4 __data_start 1 0x12345678 results in the message Non word aligned address Aligned to 0x6000000000001000 and the value is assigned starting one byte before the requested address data start is a program defined symbol for 0x6000000000001000 8 1 3 2 Bit encoded Registers Many registers are bit encoded You can assign to individual bits or to entire registers For example you can set the psr it bit with this psr it 1 and you can set the entire Processor Status Register psr with this psr 1234567890abcdef A complete list of the regis
38. ski will repeat the last command you entered Copyright 2000 Hewlett Packard Co Screen Presentation 3 13 Ski 1A 64 Simulator Reference Manual 1 0L Figure 3 17 skis Command Window at Bottom 3 8 Other Windows Some commands such as help isyms and symlist cause XSKi and Ski to create additional windows When XSKi cre ates an additional window it adds scroll bars if there is more information than will fit As an example the output window created by XSki for the symlist command is shown in Figure 3 18 XSki understands the Page Up and Page Down keys and the arrow keys The Page Up and Page Down keys scroll through the window a windowful at a time with one line of overlap The up arrow and down arrow keys scroll through the window a line at a time When Ski needs to display additional information it does so by overwriting the four standard windows ski sends the information through a pager using less by default When the pager finishes Ski refreshes the screen with the standard ski windows If you prefer to use a different pager for example more or page set the PAGER environment variable accordingly before starting the simulator 3 14 Screen Presentation Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Figure 3 18 xski s Symbol List Window Copyright 2000 Hewlett Packard Co Screen Presentation 3 15 Ski 1A 64 Simulator Reference Manual 1 0L 3 16 Screen Presentation Copyrigh
39. the executable code of a program that cause simulation to halt when they are encountered in the normal flow of a running program When simulation stops because of a breakpoint the instruction pointer ip is pointing to the instruction at which the breakpoint is set before the instruction is executed and control is returned to you The simulator provides several commands to let you manipulate program breakpoints These commands are explained in detail below 8 3 1 Setting Program Breakpoints To set a breakpoint in IA 64 code use the bs command For IA 32 code use the iabs command If given with no argu ments these commands set a breakpoint at the instruction pointed to by the ip register If an address is given following the command the breakpoint is set at that address The address must be valid when Ski resumes simulation Ski will refuse to simulate code if any breakpoints are set at non existent addresses You can set breakpoints in system mode programs using physical or virtual addresses See Section 6 1 Application Mode and System Mode Simulation for information about system mode programming and Section 4 4 1 3 Addresses for information on physical vs virtual addressing Up to ten breakpoints may be set at any one time They are indicated by the digits 0 through 9 in the first column of the program window as the example in Figure 8 3 shows 8 4 Debugging Copyright 2000 Hewlett Packard Co Ski 1A 64 Simu
40. this means you should avoid using register names as names of variables and functions in your programs 4 6 Command Language Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L 5 Screen Manipulation Commands Ski provides several commands to manipulate windows These commands let you make major changes of context or fine adjustments XSki provides more flexibility you can change the location and size of XSki windows using the mechanisms provided by your window manager and XSki provides scrollbars in some windows for minor adjustments 5 1 Register Window Commands As described in Section 3 2 The Register Window xski shows all five sets of registers in the Register Window with scroll bars and pane resizers so you can select what registers to see within each set and how much screen space should be devoted to each set The fr gr iar sr and ur commands allow you to toggle display of individual sets on and off Figure 3 1 The Register Window in xski on page 3 2 shows the xski Register Window Skihas much less screen space available and therefore shows only one set and only a part of it at a time The fr gr iar sr and ur commands allow you to choose which register set to see The rf and rb commands let you choose what part of the chosen register set to see Figure 3 8 The ski Register Window at on page 3 6 shows the Ski Register Win dow 5 1 1 Summary of Register Window Commands
41. to Load a Program en ges e x03 6 3 6 5 2 Summary of Program Loading Commands 6 4 6 5 3 Notes about Program Loading 6 4 6 6 Prosram Execution eae d ee a bee ee ee are aoe ee 6 5 6 6 1 Summary of Program Execution Commands 6 5 7 Linux and MS DOS ABI Emulation 7 1 Pll ANTeTEUPUONS sod See RAS Rene Mok Mee ea teh eo Regum Wed peak t 7 1 7 2 Linux Application Environment 7 1 7 3 MS DOS Application Environment 7 3 1 4 ProgranrI Q 27 zi zd n Ath dE S be Petts ef ei fe ANAL m ete ow RR a dd do Ia C 7 3 S EE or WP OW E UE Stak bald te om S RECS 8 1 8 1 Changing Registers and Memory with Assignment Commands 8 1 8 1 1 Summary of Assignment Commands 8 1 8 1 2 Examples of Assignment Commands 8 1 821 37 Not s on Assignment v Lois Y ly bs 8 3 8 2 Evaluating Formulas and Formatting Data 8 4 8 2 1 Summary of The eval Command 8 4 8 3 Program BreakpoIbDts ban teat Me eee JE zl ee Se eb ee 8 4 8 3 1 Setting Program Breakp
42. xau GER D sant 2 2 24 1 Using bskifor Batch Simulations 2 2 2 Starting Skits sz iei ig nine ut a LAH mcn ehe d BI a Mus d dh Brats 2 4 2 5 1 Command Laine Fl gs use ue BO EA eRe EE Oe oe ee dee x 2 4 2925 MNO X SEL teste ete a xS Late E My ade cU IEEE unde eta Pe 2 5 2 6 Quittins Ski a dietum A ae EE Ge d ree e ene qub el 2 6 2 6 1 Summary of Qut Command 2 6 3 Screen Pr sentations i e eee t n te Ca CREME TT Bede Ee ode ale 3 1 3 l Ski s Use of Windows s lt v t ch at AU vestra xn t 3 1 3 2 The Register Window 2 REGE oe EE AE ue OR ie oe Po ve RE dob EE 3 1 321 The User Registers Pane ea oo RR 3 2 3 22 2 The General Registers P ne cs ea co pa ns 3 3 3 2 3 The Floating Point Registers Pane 3 3 3 2 4 The System Registers Pane 3 4 32 5 IhelA 32 Registers Pane b ss ig we ee pe aus d au ii ne A 3 4 3 3 Resizing Register Window Panes with 3 5 3 4 The Register Window and Ski 3 5 3 5 The Program Window se e ech dre aoe Moe sky D tt ee A 3 6 3 5 1 64 Instruction Display 3 6
43. 0 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Figure 1 15 The Breakpoint List Window 1 2 9 Running a Program To run your program type the run command or click the Run button in the Main Window Ski will start the simulation and connect the program s standard I O ports stdin stdout and stderr to Ski s standard ports For example assuming there are no breakpoints still set in hello you will see hello world printed out when you run it as Figure 1 16 shows and run statistics will appear in the Main Window as Figure 1 17 shows The statistics tell you how many instructions were simulated and how much time it took the instructions per second rate the number of 64 processor cycles that were consumed on the simulated CPU and the average number of instructions per cycle which provides an indication of the best case effective parallelism of the program Ski simulates all the instructions in an instruction group in one cycle a hardware implementation may not be as capable Ski will stop the simulation for three reasons if a breakpoint is reached if the IA 64 program attempts to access privi leged resources or non existent memory or if the program ends normally by calling exit or similar functions If simula tion stops due to a breakpoint you can continue simulation with the cont command continue or you can step through the simulation with the step command or Step button You
44. 00 4 0000000000000000 0000000000000000 0000000000000000 0000000000000000 8 0000000000000000 0000000000000000 0000000000000000 0000000000000000 r12 0000000000000000 0000000000000000 0000000000000000 0000000000000000 r16 0000000000000000 0000000000000000 0000000000000000 0000000000000000 IL E 64 Debugger Simulator Version 0 8731 EAS 2 5 Copyright 1996 2000 The Hewlett Packard Company All Rights Reserved M ge ee ee eee 0000000000000000 MHMHHHHHHHHMHMHM 0000000000000010 HEHMHMMMHMHMMMM MEMHHHHHHHHMHMHM Coarnand Version 0 8731 EAS 2 5 _ Figure 3 8 The ski Register Window at Top 3 5 The Program Window The Program Window provides a view into the program space Whether you load a program into the simulated processor s address space via the command line or using Ski s load iaload or romload commands the program is displayed in a format resembling a compiler s assembler listing file For A 64 programs compiled from a high level language such as C and linked with the appropriate options the source code is displayed with line numbers mixed in with the generated assembly language as shown in Figure 3 9 As an example to compile the hello world program with the IA 64 compiler used in testing Ski the command line is cc hello g hello c Note that the o capital O optimization flag was not specified Optimization by definition rearranges the ob
45. 0000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 000000000000000000000 0 0000e 00 000000000000000000000 0 0000e 00 000000000000000000000 t 0 0000s 00 00000000000000000000 main File View Configure Help 0000000000000000 ips EEE OFFFF8000000000000000 1 0000e 00 000000000000000000000 0 0000e 00 eax 00000000 ebx 00000000 esi 00000000 edi 00000000 cs 0000 ds 0000 es 0000 f eflags 00000000 lelbellt Close Figure 1 2 The Four Primary xski Windows 1 2 2 Exiting Ski You can quit XSki and this tutorial with the Quit button with the File gt Quit menu selection or with the quit com mand All are in the Main Window Don t quit now you are just beginning 1 2 3 Use the Command area of the main Window to load your program For example let s say your program is the famous Hello world program the executable file is named hello and the source code file is named hello c Type load hello in the Command area to load it into Ski as you see in Figure 1 3 Aft
46. 000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 000000000000000000000 0 0000e 00 gt 000000000000000000000 0 000000000000000000000 0000000000000000000Q main 0000000000000000 ips 0000000000000000 pta OFFFF8000000000000000 1 0000e 00 000000000000000000000 0 eax 00000000 ebx 00000000 esi 00000000 edi 00000004 cs 0000 ds 0000 es 0000 f eflags 00000000 lelbell Figure 2 2 The X Window System Motif based xski Interface Copyright 2000 Hewlett Packard Co Overview 2 3 Ski 1A 64 Simulator Reference Manual 1 0L Figure 2 3 The Command Line bski Interface 2 5 Starting Ski To start the Ski simulator type its name ski xski or bski and any necessary command line options and file redirec tions just as you would start any other Linux program Command line options are described in Section 2 5 1 Command Line Flags The simplest invocation of the simulator is ski This starts the curses based Ski version of the simulator with no program loaded a bare IA 64 emulation is ready for you to use A more sophisticated invocation would be xski my_program This starts the X Motif based xski version of the simulator and loads the IA 64 executable file m
47. 000000078820 000000000 646 72 Bc 55e2f7555542f rld 4000000000078830 000000000000006 545 434 4 4 4144 1 4000000000078840 455248545F4d4952 00005 444 4 4853 RIM 4000000000078850 545 434 4 4 4144 005F4441505F504F MAL 4000000000078860 445 434 4 4 4144 455248545F50414d MAL 4000000000078870 00005 444 4 4853 4dbF434F4cdodl4d SHO 4000000000078880 5f58414d5f50414d 0000000000000000 4000000000078890 435f434f4c4c414d 0000005f4b434548 MAL 40000000000788a0 203a636f6c6c616d 656420676e697375 mal 40000000000788b0 20676e6967677562 00000 bug 40000000000788 0 642520616e657241 0000000000000 Are Figure 1 5 The xski Data Window Registers Window ip start psr um mfhimfllacluplbe prs 10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 b 0000000000000000 0000000000000000 b2 0000000000000000 0000000000000000 b4 0000000000000000 0000000000000000 bE 0000000000000000 0000000000000000 rrbp rrbf rrbg sor sol sof cfm 0 0 OQ SE pm 0 0 0 mom lc 0000000000000000 ec 00 bol 0 rsc 0000030 00 ppl 0 0 4 fE 0000000000000000 0000000000000000 0000000000000000 SFFFFFFFFFFFF7B0 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 000000000000000000000 0 0000e 00 gt 000000000000000000000 0 0000e 00 gt 000000000000000000000 0 0000e 00
48. A 64 Simulator Reference Manual 1 0L example of using goto and a label is loop other commands goto loop 9 2 2 The if Command The if command allows for conditional execution If the expression following the command evaluates to nonzero the remainder of the line is executed otherwise it is ignored No spaces are allowed in the expression For example this command file steps through a IA 64 application mode simulation 600 instructions at a time until the program finishes printing the contents of general register 32 after each step loop step 600 eval r32 if exited goto loop quit If a colon surrounded by spaces is present on the line the remainder of the line is taken to be an else clause That is if the if expression evaluates to nonzero the remainder of the line up to but not including the colon is executed if zero that part of the line is ignored and execution continues immediately following the colon For example the following command file line sets the contents of general register 4 to zero or one depending on whether the sum of the contents of general inte ger and 2 are equal to the contents of the location pointed to by general register 13 if rl r2 r1i3 r40 r41 9 3 Comments in Command Files To document command files you can add comments any characters following an octothorpe also called a pound sign or sharp sign and shown typically as are ignored by the command in
49. Command Files discusses command files in depth Most commands may be abbreviated some to a single letter A command may be abbreviated to the shortest prefix which is not also a prefix of a command which precedes it in the command menu See Appendix A Command Reference 4 4 Argument Specification The arguments which are given with commands are in general obvious and natural The description which follows should clarify those cases which are not The terms defined here are used in the command summaries throughout the remainder of this manual 4 4 1 Numeric Arguments Many commands accept numeric arguments The argument may be an address a value an execution count or some other variable which is best expressed numerically 4 4 1 1 Numbers and Counts Some commands take arguments that are naturally expressed in hexadecimal addresses for example Other commands take arguments that are naturally expressed in decimal such as the number of instructions to simulate with the step com mand To make using Ski easier some Ski commands default to interpreting their arguments as hexadecimal numbers and some default to interpreting their arguments as decimal counts You can always override the default interpretation by specifying a radix override as described below Hexadecimal digits may be upper or lower case The default radix may be overridden by preceding the number or count with 0D or Od for decimal 0X or for hexadecimal
50. E D UODODOOODUOOOOGOE Dopo EEN CH C CHCI CNC DOCOODOOOOOODOOCOOD DOCOODOCOOODODOCQOD t Ee Hee K eH ODE e HD ODE ed DOIELTBSODODODUOOODUO OO OGDDUOODOOODUOODUOOODOgOD 0 CEG HOG HODGE OGDDUCODUOODDUOODUOOUOOD L 0 0 0000e 00 OHK ONO 0 KOCH CI CHO CHCI CHCI CHCI Ci CHOCO K CI CHEN CHCI 1 DGDUGOUOGODOUODE iper OCTO der CHOCO ECE UCHDDUCHODUCODCRODUO pia CODIKODOOLUDIKSDOUOO gupta ODUCODOODDUCHODOCO 00000000 ebx 00000000 00000000 edx 00000000 eip DOO 00000000 esi edi gbp OG000000 ssp DOUCHE ODDO de DOG es DODU ODUD gs ODDO ss BOG ldt ODUD tas Boo eflags o lelbelitiidlacilemictintidlotldtlitittlstizilatipElIct Close Help Figure 3 1 The Register Window in xski ski shows only a portion of a register set at a time and you use the commands described in Section 5 1 Register Window Commands to select which portion of which set to see The sets are described below in the order they appear in the Reg ister Window Their XSki realizations are shown as well 3 2 1 The user registers pane see Figure 3 2 displays the Predicate Registers prs in binary the Application Registers in hexadecimal and the Branch Registers b0 b7 and the Instruction Pointer ip symbolically if possible otherwise in hexadecimal S
51. Messages D 5 Ski 1A 64 Simulator Reference Manual 1 0L Not an 64 file See File size gt Memory size on page D 3 Nothing to run No program has been loaded Use the load iaload or romload command depending on what kind of program you want to simulate or load an 64 program by naming it on Ski s command line See Program Loading page 6 3 Out of memory Ski needed to get more memory to run but couldn t get it You need more virtual memory swap space or you ve found a Ski defect See your local Linux specialist Page not allocated When Ski loads IA 64 application mode program Ski allocates pages for the fixed size parts of the program and allocates a small stack As the program runs Ski allows the stack to grow If the program tries to access a page which isn t in one of those areas Ski detects the error and prints the message The most likely cause is a wild pointer See Application Mode IA 64 Programs on page 6 1 Pager s not found You executed a Ski command that sends output through a pager and there was a problem Did you set the PAGER environment variable to point to a program that s not reachable through your PATH shell variable Did you set the PAGER variable to point to a non executable program If your pager is on a remote file system is there a problem with accessing that system Did your pager program return a failure status for some reason If none of these reasons is a
52. OD 10b50 BOOSH CGODOOOUO CHOCO COCO sm eee ee Class Hein Figure 5 6 xsk s Hexadecimal Dump Window 5 6 Screen Manipulation Commands Copyright 2000 Hewlett Packard Co Ski 1A 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 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 sys
53. OOOgonaen CEC CHOR EGE CRDI CACC OIM SOOO OD Oe eo CHOCIOROLUIOCHD OCHO DOR Dee CCR NASH CEE CHERE ODOCKOOUCHDUCHOCIUCHO ODOCKODUOCODDOCOODLUOOD CDOOCOOCDOCODUOCOCOOOD Figure 3 5 The xski System Registers Pane The IA 32 Registers Pane CoE H COD UOCHOO ORO OOo OODOCOOOODUOODOOOO UOOUOCOOOOOODOCOOOOO SOOO D CROCO COS CHE ECAC HORE DL CRDI IOS GODDCODOODUOCODUOO CEO GAUCHE D000 OOO CeO Oe GOOD OO D ORO CHE CORDOCODGOD De OODOCODOCODUOCODOUOCOO OODOCOOCOODOODOCOO OCOOOCOOOOODO OCODOOO xL The IA 32 registers pane shows IA 32 registers in hexadecimal For bit encoded registers the bits are named individually using their A 32 mnemonics If a name is displayed in uppercase the corresponding bit is currently set and if the name is displayed in lowercase the bit is currently clear as shown in Figure 3 6 3 4 Screen Presentation Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Figure 3 6 The xski IA 32 Registers Pane 3 3 Resizing Register Window Panes with xski As mentioned above even a large X Window System screen is too small to display all the registers simultaneously so you may have to scroll a pane to see the registers you want or resize the pane by dragging Pane Resizer the small resize square on the right side of the div
54. PSR Register Bank bit IA 64 PSR Current Privilege Level IA 64 PSR Disable Access and Dirty bit faults bit IA 64 PSR Debug Breakpoint fault bit IA 64 PSR Data Debug fault disable bit IA 64 PSR Disabled Floating point High bit IA 64 PSR Disabled Floating point Low bit IA 64 PSR Disable Instruction set transition bit IA 64 PSR Data address Translation bit IA 64 PSR Exception Deferral bit IA 64 PSR Interrupt unmask bit IA 64 PSR Interrupt Collection bit IA 64 PSR Instruction Debug fault disable bit IA 64 PSR Instruction Set bit IA 64 PSR Instruction address Translation bit IA 64 PSR Lower Privilege transfer trap bit IA 64 PSR Floating point High modified bit IA 64 PSR Floating point Low modified bit IA 64 PSR Machine Check abort mask bit IA 64 PSR Protection Key enable bit IA 64 PSR Privileged Performance monitor enable bit IA 64 PSR Restart Instruction slot number IA 64 PSR Register stack Translation bit IA 64 PSR Secure Interval timer bit IA 64 PSR Secure Performance monitors bit IA 64 PSR Single Step enable bit Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L psr tb psr um psr up pta r0 rl r127 IA 64 PSR Taken Branch trap bit IA 64 PSR User Mask bits IA 64 PSR User Performance monitor enable bit 64 Page Table Address IA 64 General Registers rO nat r127 nat TSC Si esi sof sol sor sp sp nat SS ssd tpr unat IA 64 General Register Not a Thing
55. Restores an image of the machine state 1A 64 and IA 32 from the specified file 8 7 Symbol Table Commands Ski supports two kinds of symbols program defined symbols which are identifiers provided by a compiler linker or human programmer see Section 4 4 2 1 Program Defined Symbols and internal symbols which include register names and internal variables see Section 4 4 2 2 Registers and Section 4 4 2 3 Internal Variables Ski places pro gram defined symbols in one symbol table you can see the contents with the symlist command For IA 64 programs the ELF executable file always contains symbols regardless of whether you used your compiler s debug symbols flag typically g unless you stripped the symbols Internal symbols are stored in a second symbol table along with the regis ter names Ski recognizes listed in Appendix B Register Names The isyms command displays the contents of this table 8 7 1 Summary of Symbol Commands symlist filename Shows the list of program defined symbols sorted by ascending address as seen in Figure 8 5 If filename is given the list is written to the named file otherwise the list is written to the screen 8 8 Debugging Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Symilist Window Figure 8 5 The symlist Output from xski isyms filename Writes the list of internal variables to filename if given otherwise to the screen C
56. Ski 1A 64 Simulator Reference Manual Rev 1 0L 26 Apr 00 Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Notice The information in this document is subject to change without notice HEWLETT PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL INCLUD ING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Hewlett Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with furnishing performance or use of this material This document contains information which is protected by copyright All rights are reserved No part of this document may be photocopied reproduced or translated to another language without the prior written consent of Hewlett Packard Copyright 2000 by HEWLETT PACKARD COMPANY Printing History First Edition Revision 1 0L April 2000 Trademarks Linux is a registered trademark of Linus Torvalds MS DOS and Windows are registered trademarks of Microsoft Corpora tion UNIX is a trademark or registered trademark of the Santa Cruz Operation Intel is a registered trademark of the Intel Corporation ii Notice Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Preface This document is the Ski IA 64 Simulator Reference Manual The goal of this document is to provide a description of the feature
57. State IA 64 Interruption Hash Address IA 64 Interruption Immediate Register IA 64 Interruption Instruction Bundle Pointer IA 64 Interruption Instruction Previous Address IA 64 Instruction Pointer IA 64 Interruption Processor Status Register IA 64 Interrupt Request Registers IA 64 Interruption Status Register IA 64 Interval Time Counter IA 64 Interruption TLB Insertion Register IA 64 Interval Timer Match Register IA 64 Interval Timer Vector IA 64 Interrupt Vector Address IA 64 Interrupt Vector Register IA 64 Kernel Registers IA 64 Loop Count Register IA 32 Local Descriptor Table Copyright 2000 Hewlett Packard Co Register Names B 3 Idtd lid IrrO Irr1 pO p63 pfs pkrO pkr15 0 pmc15 pmdO pmd15 pmv psr psr ac psr be psr bn psr cpl psr da psr db psr dd psr dfh psr dfl psr di psr dt psr ed psr i psr ic psr id psr is psr it psr Ip psr mfh psr mfl psr mc psr pk psr pp psr ri psr rt psr si psr sp psr ss B 4 Register Names Ski 1A 64 Simulator Reference Manual 1 0L IA 32 Local Descriptor Table Descriptor IA 64 Local Interrupt ID IA 64 Local Redirection Registers IA 64 Predicate Registers IA 64 Previous Function State IA 64 Protection Key Registers IA 64 Performance Monitor Configuration Registers IA 64 Performance Monitor Data Registers IA 64 Performance Monitoring Vector IA 64 Processor Status Register IA 64 PSR Alignment Check bit IA 64 PSR Big Endian bit IA 64
58. The Program Window Showing a Breakpoint at main 1 10 The Breakpoint List Window 1 11 The Terminal Window After the hello Program is Run 1 12 The xski Main Window after the hello Program is Run 1 12 The Main Window After Reaching the Breakpoint at main 10 1 13 The xski Register Window After Stopping at Breakpoint atmain 10 1 14 The xski Register Window After Changing the ip Register 1 15 The xski Data Window Widened to Show ASCIT 1 16 The xski Data Window After Changing the Hello world String 1 16 The xski Main Window Showing an eval Command and Its Result 1 17 The Curses based Ski Interface 2 2 The X Window System Motif based xski Interface 23 The Command Line bski Interface 2 4 The Register Window in XSki 3 2 The xski User Registers Pane 3 3 The xski General Registers Pane 3 3 The xski Floating Point Registers Pane 3 4 The xski System Registers Pane 3 4 The XSKITA 32 Registers P ne eom yog em e ehm cn ds Bee el nu
59. al instruction bundles as shown in Figure 5 4 and in Figure 3 15 xski s Data Window Showing Data Interpreted as Instruction Bundles on page 3 11 It is your responsibility to ensure that the Data Window is actually positioned on instructions if not Ski will dutifully display nonsense The first column displays the address The second column displays the template field The remaining three columns display the 41 bit instructions from slots 0 1 and 2 with the least significant bit to the right The mnemonic stands for data window bundle Data Window Figure 5 4 xski Showing Data as Instruction Bundles dh Displays the data as raw hexadecimal with an ASCII translation as shown in Figure 5 5 The mnemonic stands for data window hexadecimal Copyright 2000 Hewlett Packard Co Screen Manipulation Commands 5 5 Ski 1A 64 Simulator Reference Manual 1 0L Data Window TU xxxEXxEX KHHEKHKE XEXXXEEXE XXXENXXER ata start 48556chc BI2e2077 BETZ6c A Hello world e6gcongenUcGon 010 4U282329 20582630 32263031 z04c5036 L X 0z 01 LPG BDCODOCGOOUDOOO 020 34204544 20322632 20606962 632e8615f 4 EM 2 2 libc a 0000001630 49444040 22646163 62277231 30736183 ID B mainf rl sac 6000000 2f6c U52 635 7361 G32f320a 40282329 lihc sac 2 8 i amp naoonoocnoonl050 02 7578 21616272 6526269 amp 5271 f6c Jux core Tlibs 1 BECK BC 69652632f 61725368 6976655f 65643232 ibc archivwe BECK LCC T FO
60. al 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 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 2 System Mode IA 32 Programs Ski does not support IA 32 programs running in system mode 6 3 3 System Mode TLB Simulation The simulator provides facilities for modeling the TLB s
61. ar command but the command you asked for doesn t exist Try the help command alone to get a list of all of the commands Ski understands See Command Entry on page 4 1 32 program terminated An IA 32 application mode program finished executing and invoked an MS DOS system function to terminate itself The function it used doesn t provide a way for the program to return a completion status See Application Mode IA 32 Programs on page 6 1 IA 32 program terminated with status d Your 32 application mode program finished execution in the normal fashion and invoked an MS DOS system function to terminate itself and indicate a completion status See Application Mode IA 32 Programs on page 6 1 Ignored attempt to write a Read Only symbol Some registers and symbols recognized by Ski are read only You tried to modify one of them See Symbolic Argu ments on page 4 4 and Changing Registers and Memory with Assignment Commands on page 8 1 Illegal expression s You used an expression that can t be parsed Check parentheses variable names and the matching of operands and operators See Expressions on page 4 2 s Illegal number of arguments lt d gt You passed too few or too many operands with a Ski command The command appears in the s field on the left and the number of operands you passed appears in the d field on the right Use the help command for information about the command of interest or see Appe
62. are used in command files as targets of the goto command 4 4 2 5 Filenames 6e 99 Filenames are subject to the restrictions of the underlying Linux operating system Ski performs tilde expansion if you provide a pathname whose first word starts with a tilde Ski assumes the word is a username and tries to replace it and the tilde with the user s home directory For example david hello might be expanded to home david hello 4 4 3 Resolving Ambiguous Symbols and Numbers Some character sequences can be interpreted in more than one way For example the character sequence b3 can be interpreted as a branch register a program defined symbol or a hexadecimal number To resolve the ambiguity Ski looks Copyright 2000 Hewlett Packard Co Command Language 4 5 Ski 1A 64 Simulator Reference Manual 1 0L first in its symbol tables for program defined symbols and internal variables which includes register names If a match is found the matching value is used otherwise the character sequence is taken as a number You can force the numeric inter pretation by putting a 0 or Ox prefix in front of the number such as 0xb3 It is undefined whether Ski searches the symbol table for program defined symbols before or after the internal variable symbol table Because of this it is wise to avoid naming global variables and functions with names duplicating any of Ski s internal variables In practice
63. cation mode program tried to reference the contents of a register that didn t contain a valid value This can only happen for application mode programs system mode programs handle this fault through the interrup tion mechanism See Chapter 6 Program Simulation and Interruptions on page 7 1 D 6 Simulator Status and Error Messages Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Reserved register field fault Your IA 64 application mode program tried to access a reserved register or portion of a register This can only hap pen for application mode programs system mode programs handle this fault through the interruption mechanism See Chapter 6 Program Simulation and Interruptions on page 7 1 screen size is dx d minimum is dx d Ski uses the curses package to create a multi window interface on a terminal Curses requires a terminal of the spec ified minimum size but your terminal is smaller than that See Ski Variations on page 2 2 Starting address ending address You used the dd or pd command to dump data or program code to a file but the starting address you passed is greater than the ending address Perhaps you have them reversed Are you are using symbolic addresses that don t bind to the locations you think they bind to See Program Window Commands on page 5 2 and Data Window Com mands on page 5 5 Stopping at s due to IA 32 halt instruction An IA 32 HALT inst
64. ch with an ASCII character translation on the right and the data address on the left The endianness of the displayed bytes is determined by the current value of the psrbe bit 3 10 Screen Presentation Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L which may change by the time the simulated IA 64 processor actually loads the bytes The address is expressed as a sym bol from the executable file s symbol table or as a sixteen digit hexadecimal number With the dbndl command Ski can display data formatted as IA 64 instruction bundles in hexadecimal as shown in Figure 3 15 The figure was generated by loading a program and then issuing the command dj main 10 followed by the dbndl command This is useful when you need to see the raw hexadecimal instruction encodings The first column displays the address of each bundle The second column displays the template field The remaining three columns are the 41 bit instructions from slots 0 1 and 2 Note for the purpose of setting breakpoint addresses Ski pretends that the slot 0 instruction is located at the first byte of the bundle the slot 1 instruction is located at the fourth byte and the slot 2 instruction is located at the eighth byte See How Ski Implements Breakpoints on page 8 6 for more information Data Winer GODOODOCOUOQUE eX XEKXEKKK XXXEXEXX XKXXEXEX GOOUOOUODOUOOQOUE TO xxxxxxxx XXXXXXKEX XXXXNXXXX XKXXKXEXX
65. d shutdown stat symlink truncate unlink wait4 Ski accepts but ignores the system calls shown in Table 7 2 For those that return an error indication the errno code is shown in parentheses All other ignored system calls return with a success indication having done nothing Table 7 2 Linux System Calls Accepted but Ignored by Ski _sysctl ENOSYS create module ENOSYS init module ENOSYS pretl quotactl ENOSYS sendfile bdflush ENOSYS delete_module ENOSYS msgctl ENOSYS ptrace EOPNOTSUPP rt_sigqueueinfo shmctl ENOSYS capget get_kernel_syms ENOSYS munlockall putpmsg rt_sigtimedwait sysfs ENOSYS capset getpmsg nfsservctl guery module ENOSYS semctl ENOSYS sysinfo ENOSYS All other system calls are unsupported When an IA 64 application mode program makes an unsupported system call the simulator stops the simulation and displays an error message 7 2 Linux and MS DOS ABI Emulation Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L 7 3 MS 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 t
66. discussions See the release notes for details on the mailing list address and how to subscribe Copyright 2000 Hewlett Packard Co Overview 2 1 Ski 1A 64 Simulator Reference Manual 1 0L 2 4 Ski Variations The simulator is available in three varieties distinguished by their user interfaces ski xski and bski The underlying simulation engine is identical across all three varieties The figures below show how each variety looks when first started Figure 2 1 shows Ski which uses a terminal oriented curses based character user interface Figure 2 2 shows xski using an X Window System Motif based graphical user interface Figure 2 3 shows bski which provides a batch ori ented command line driven environment and no user interface Ski command line flags some of which are shown in Figure 2 3 are described in Section 2 5 1 Command Line Flags The three varieties understand the same command language There are a few unavoidable differences and they are pointed out where appropriate in this manual Most examples and sample screen displays are taken from XSki sessions All exam ples have been verified in actual use 2 4 1 Using bski for Batch Simulations Because bski has no user interface you typically control it using a command file see Chapter 9 Command Files and the i command line flag see Section 2 5 1 Command Line Flags Ski and xski are intended for you to use interac tively while bski excels at batch simulatio
67. e Comments in Command Files on page 9 2 label Labels are targets for goto commands and are valid only in command files See Labels and Control Flow in Com mand Files on page 9 1 register name value Assign value to the register specified by register name Unless a modifying prefix such as Od 0o or Ob is used value will be treated as a hexadecimal number See Changing Registers and Memory with Assignment Commands on page 8 1 The register names recognized by Ski are listed in TA 64 Registers on page 1 1 address value 2 address value 4 address value 8 address value The value is assigned to the specified location in memory The old value at the location is lost The location may be on any allocated page including instruction pages Multiple values separated by whitespace may be supplied if so they will be assigned to sequential memory addresses Unless a modifying prefix such as 0 00 or Ob is used value will be treated as a hexadecimal number See Changing Registers and Memory with Assignment Commands on page 8 1 The 1 command truncates any extra high order bytes of the value to make a single byte The 2 command truncates or pads with zero the high order bytes of the value as necessary to make a two byte quantity Similarly the 4 and 8 commands truncate or pad high order bytes to make four and eight byte quantities respectively The psrbe bit controls whether the data is stored in big endian or
68. e In system mode the simulator traps to the unaligned access vector 6 5 Program Loading The Ski simulator supports loading IA 64 programs in the standard IA 64 ELF executable format and in MS DOS com and exe formats ELF files contain enough information to allow the simulator not only to load the program and its data but also to build a symbol table properly structure virtual memory and initialize the screen and ip with the proper values For IA 64 Linux programs the psrbe bit is always initialized to zero indicating that the program will run with little endian byte order The MS DOS formats do not include symbol table information Instead you must supply the information in the form of a mapfile compatible with those created by Microsoft s ML linker If you don t provide Ski with a mapfile no program defined symbols will be available The MS DOS formats do not specify where to place the program in memory You must provide this information to Ski yourself The com format is very basic and is supported with the iaload and romload commands described in Section 6 5 2 Summary of Program Loading Commands The exe format contains header information that is used by the iaload command and ignored by the romload command For this reason exe files are not useful in system mode simulation For IA 32 programs only IA 32 little endian byte ordering is supported 6 5 1 How to Load a Program There are two ways to load a file T
69. e a memory access violation gets translated into the SIGSEGV signal Similarly if Ski receives a keyboard signal such as the SIGINT generated usually by control C it passes this signal on to the IA 64 application Ski does not accurately simulate the siginfo and sigcontext structures that a real A 64 Linux kernel would pass to a signal handler Thus applications relying on either of these parameters can not be simulated in Ski application mode 7 2 Linux Application Environment Ski provides a commonly used subset of the Linux environment to IA 64 application mode programs Both statically linked and dynamically linked programs are supported The argc argv and envp parameters are created on the stack as described in Section 6 5 3 2 Creating the argc argv and envp Parameters Ski initializes the IA 64 registers like this sp points to the top of the stack bsp and bspstore are initialized in the same way the IA 64 version of Linux is likely to do rsc pl is initialized to 3 rsc be and psr be are cleared Ski supports the Linux system calls shown in Table 7 1 This list is subject to change consult the release notes for the lat est information The data passed between the application program and the simulated Linux environment is interpreted as 64 bit LP64 quantities Copyright 2000 Hewlett Packard Co Linux and MS DOS ABI Emulation 7 1 accept bind chown connect exit fentl fstatfs getdents getgroups getpgid getr
70. e icnt option but bski couldn t open the file you specified Perhaps you specified a file that is write protected or a pathname that includes non existent or inaccessible directories See Using bski for Batch Simulations on page 2 2 and Command Line Flags on page 2 4 Data larger than a s Truncated to 0x cllx You used 21 22 24 or 8 commands to write data to a register or to memory You provided more data than would fit so Ski truncated the excess most significant part away and used the least significant part The s field on the left is how many bytes Ski needed The llx field on the right is the value after truncation See Changing Reg isters and Memory with Assignment Commands on page 8 1 Error reading s line d Ski tried to display the source code corresponding to an IA 64 program you loaded For some reason it failed to read a line from the file represented by the 96s field at the line number represented by the d field Perhaps the file per D 2 Simulator Status and Error Messages Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L missions are wrong or a remote file has suddenly become inaccessible See The Program Window on page 3 6 and the discussion of the pm command in Program Window Commands on page 5 2 Error unrecognized restore file tag s You are trying to restore a saved simulator state and either the save file is corrupt or Ski is broken See Savin
71. e 6 3 pj address Jump the Program Window display to the specified address If no address is given the window display changes to the previous location providing a handy way to swap the display between two different parts of the program See Summary of Program Window Commands on page 5 2 pa Display the program in assembly language format only IA 64 only See Summary of Program Window Com mands on page 5 2 pb count Move the Program Window backward count IA 64 bundles or IA 32 instructions or one windowful less one bundle or instruction if no count is given See Summary of Program Window Commands on page 5 2 pd starting address ending address filename Dump memory to the screen or to the file given by filename The range dumped is between starting address and ending address inclusive The dump is formatted as disassembled instructions without source code See Summary of Program Window Commands on page 5 2 pf count Move the Program Window forward count IA 64 bundles or IA 32 instructions or one windowful less one bundle or instruction if no count is given See Summary of Program Window Commands on page 5 2 pm Display an IA 64 program in both source and assembly form The source code file must be available to the simulator in the location recorded in the executable file when this command is issued The source code is displayed for conve nience it cannot be modified or interacted with Mixed display may not b
72. e Flag bit IA 32 Sign Flag bit IA 32 Trap Flag bit IA 32 Virtual 8086 Mode bit IA 32 Zero Flag bit IA 64 End of Interrupt IA 32 Extra Segment Register IA 32 Extra Segment Register Descriptor IA 32 four byte Stack Pointer see iasp below fl e f127 e IA 64 Floating point Register exponent parts f0 m f1 m f127 m f0 s fl s fpsr fpsr traps fpsr sf0 fpsr sf0 ftz fpsr sf0 wre fpsr sf0 pc fpsr sf0 rc fpsr sf0 v fpsr sf0 d fpsr sf0 z fpsr sf0 o fpsr sf0 u fpsr sf0 1 fpsr sf1 fpsr sf2 64 Floating point Register mantissa parts f127 s 64 Floating point Register sign bits 64 Floating point Status Register 64 FPSR Trap Bits 64 FPSR Status Field 0 IA 64 FPSR Status Field 0 Flush to Zero mode bit 64 FPSR Status Field 0 Widest range exponent mode bit IA 64 FPSR Status Field 0 Precision control bits 64 FPSR Status Field 0 Rounding control bits 64 FPSR Status Field 0 IEEE Invalid Operation status bit 64 FPSR Status Field 0 Denormal Unnormal Operand status bit IA 64 FPSR Status Field 0 IEEE Zero Divide status bit IA 64 FPSR Status Field 0 IEEE Overflow status bit IA 64 FPSR Status Field 0 IEEE Underflow status bit IA 64 FPSR Status Field 0 IEEE Inexact status bit 64 FPSR Status Field 1 64 FPSR Status Field 2 B 2 Register Names Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L fpsr
73. e RUE 3 5 An XSki Pane Resizer The Small Box Between the Scrollbars 3 5 The ski Register Window at Top 3 6 xsk s Program Window Showing Part of an IA 64 hello world Program 3 7 xsk s Program Window Showing IA 64 Predication and Breakpoints 3 8 xsk s Program Window Showing IA 32 Code the Instruction Pointer and a Breakpoint 3 9 XSki s Program Window Showing Illegal Instructions 3 10 xsk s Program Window Showing Unallocated Space No Translation 3 10 xski s Data Window Showing Unallocated Space Followed by Data 3 11 xski s Data Window Showing Data Interpreted as Instruction Bundles 3 11 xsk s Command Window 3 13 ski s Command Window at Bottom 3 14 XSki s Symbol List Window 3 15 xski Evaluating Expressions 4 3 Xxski s Symbol List Window gc RR n e 4 4 xsk s Program Window Showing IA 64 Assembly Language 5 3 xsk s Program Window Showing Intermixed C and IA 64 Assembly Code 5 4 XSki s Assembly Language Dump Window 5 4 xski Showing Data as Instruction Bundles 5 5 xski Showing Data in Ra
74. e combined like this to signify optional arguments that can be supplied Zero or more times 4 3 Command Sequences Repetition and Abbreviation You can type multiple commands on a single command line by separating the individual commands with semicolons This is called a command sequence Command sequences make re executing a series of commands easy using the Command History mechanism of xski see Section 3 7 1 The xski Main Window or the command repetition mechanism of Ski see Section 3 7 2 The ski Command Window For example you might want to repeatedly execute Copyright 2000 Hewlett Packard Co Command Language 4 1 Ski 1A 64 Simulator Reference Manual 1 0L the commands step 100 and eval my buffer This pair of commands would execute one hundred instructions and then print the value of your variable named my buffer By combining these two commands into one command sequence ie step 100 eval my buffer you can use the Command History or command repetition mechanism to run these commands over and over The spaces around the semicolon are optional but improve readability There is no grouping construct in Ski This can be important when you write command files when you want to execute commands conditionally using the if command you cannot use the semicolon to group several commands into the then or else clauses Instead you must use labels and the goto command Chapter 9
75. e useful if a high degree of optimization was applied during compilation IA 64 only See Summary of Program Window Commands on page 5 2 quit return value for shell Quit the simulator If no return value for shell is given zero value is returned to the shell Return values are use ful in shell script programming See Quitting Ski on page 2 6 run Simulate the program Using the C language argc argv mechanism Ski will pass the program a copy of the com mand line parameters Ski received on its command line or if specified the command line parameters provided with the 1oad and iaload commands See Program Execution on page 6 5 rest filename Restore the state of a simulated processor from the specified file and prepare to resume a suspended simulation Only the registers and memory of the simulated processor are restored state information private to the simulator such as cycle counts is not restored See Saving and Restoring the Simulator State on page 8 8 rf count Moves the Register Window forward scroll down through the currently displayed register set The Register Win dow is scrolled count lines If count is omitted the Register Window scrolls down one windowful less one line i e A 4 Command Reference Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L the last line of the old window is displayed as the first line of the new window Ski only See ski Register Windo
76. ecimal number The 1 command truncates any extra high order bytes of the value to make a single byte The 2 command truncates or pads with zero the high order bytes of the value as necessary to make a two byte quantity Similarly the 4 and 8 commands truncate or pad high order bytes to make four and eight byte quantities respectively The 2 4 and 8 commands respect the current value of the psrbe bit which controls whether multi byte data memory references are big endian if the bit is set or little endian if the bit is clear The bit also controls the format of data display in the Data Window see Section 3 6 The Data Window You can set the psrbe bit with the command psr be 1 and you can clear it with psr be 0 Ski supports physical and virtual addressing For more information see Section 4 4 1 3 Addresses s address string without spaces The string without spaces is assigned to memory locations starting at the location specified by address A null byte is added to the end of the string automatically The old value at the location is lost The location may be on any allocated page including instruction pages as discussed in Section 8 1 3 3 Page Allocation Multiple values may be supplied separated by a space The strings may not contain spaces and quoting it is not a workaround 8 1 2 Examples of Assignment Commands rl 1234 Copyright 2000 Hewlett Packard Co Debugging 8 1 Ski 1A 64
77. eck that you typed the filename correctly and that the directories you specified are accessible Is there a permissions problem or a network failure perhaps See Filenames on page 4 5 Construct DWARF image can t find debug info section You told Ski to load a program Ski couldn t find the part of the executable file containing source code line number information As a result Ski won t be able to show source code in the Program Window See Program Window Commands on page 5 2 Could not open s for reading You told Ski to load a program but Ski couldn t open the file you specified Perhaps you specified a file that is doesn t exist or a pathname that includes non existent or inaccessible directories See Program Loading on page 6 3 couldn t find label s A command file tried to use the goto command but Ski can t find the label to which the goto refers The s field is replaced with the label Perhaps the label is spelled incorrectly See The goto Command and Labels on page 9 1 Couldn t open file s Was ski started in the right directory Ski loaded a program to simulate per your request and tried to access source code pointed to by that program But for some reason Ski couldn t open the specified file This can happen for example if files have been moved after compilation See Summary of Program Window Commands on page 5 2 Couldn t open instruction count file You started bski with th
78. eleting Program Breakpoints on page 8 5 No previous command You tried to re run the previous command in ski but you haven t executed any commands yet there is nothing to re run See The ski Command Window on page 3 13 No such command You typed a command to Ski that Ski doesn t understand Either you mis typed or Ski is broken or the rules that underpin the basic functioning of our universe have ceased to operate properly In the first case try typing your com mand correctly use the help command or see Appendix A Command Reference to find out what the com mands are In the third case you re on your own bring film No such user s 669 You specified a filename with a leading tilde causing Ski to try to expand the first word into the home directory for the corresponding user Ski wasn t able to the find the user Perhaps you mis typed the filename or specified a user that doesn t exist See Filenames on page 4 5 Non s aligned address Aligned to 0x llx You used the 2 4 or 8 commands to write data to memory but you specified an improperly aligned address The s field on the left tells what kind of alignment was needed and the llx field on the right is the address that Ski used This may not be the address you want See Changing Registers and Memory with Assignment Commands on page 8 1 Not an ELF file Copyright 2000 Hewlett Packard Co Simulator Status and Error
79. 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 Ski 1A 64 Simulator Reference Manual 1 0L 6 6 Program Execution Programs may be run in their entirety without interruption they may be stopped at appropriate places see Section 8 3 Program Breakpoints and continued or they may be single stepped for debugging purposes The different program execution choices are described below You can stop a running simulation in Ski at any time with your interrupt character usually The interrupt will be hon ored at the beginning of simulation of the next instruction XSki and bski do not have interrupt handlers if you use your interrupt character while they are running they will be terminated by the operating system 6 6 1 Summary of Program Execution Commands run Starts restarts execution of a program at the current ip value Generally used after a breakpoint is encountered cont Same function as the run command The mnemonic stands for continue step count With no argument executes a single instruction If a count is specified executes count instructions step until expression Steps through your program until the specified expression has a non zero value Because the expression must be evaluated before each simulated instruction you may notice a slowdown in Ski s si
80. er a moment the other three windows will change appropriately the Program Window will show the program code in assembly language form as shown in Figure 1 4 the Data Window will show global and static data as shown in Figure 1 5 and the Register Window will show in r12 the value of the stack pointer as shown in Figure 1 6 You may need to use the scrollbar in the general registers pane of the Register Window to see these registers Loading Your Program Copyright 2000 Hewlett Packard Co Getting Started A Ski Tutorial 1 3 Ski 1A 64 Simulator Reference Manual 1 0L si mi x Help main File View Configure Command load hello Figure 1 3 Loading the hello Program Program Window Program init 0080 start _start 0010 _start 0020 _start 0030 _start 0040 _start 0050 1 4 Getting Started A Ski Tutorial file 9 0 0 1 0 0 br ret sptk many b0 alloc r2 ar pfs 0 0 7 0 movl r3 0x000800400270033F adds r34 16 r12 movl ri xdFFfFFFFFFFFF9d88 1d8 r33 r34 8 mov 9 1 sub ri r8 ri mov m ar fpsr r3 nop f 0 0 addl r32 0x2b0 r1 addl r3B5 0x2f8 r1 nop f 0 0 addl r35 0x188 r1 1d8 r32 r32 1d8 r35 r35 adds r38 16 r12 Figure 1 4 The xski Program Window Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Data Window 10 stdin used 0000000000020001 6F77206F6c6c6568 4000
81. er documents This appendix provides a list for convenience only The register names are documented here as recognized by Ski and in a few cases don t exactly match the names in other documents due to program limitations For example the floating point registers must be accessed in three pieces the mantissa part the sign part and the biased exponent part Similarly the Not a Thing bits of the various registers are separate entities for Ski Individual bits of complex registers such as the psr are documented here as well corresponding to the names by which Ski recognizes them B 1 al ah ax eax 1 64 Registers IA 32 Registers al and ah are byte wide ax is al and ah taken together as two bytes eax is four bytes wide with ax as the two least significant bytes arO 127 IA 64 Application Registers 60 b7 64 Branch Registers bl bh bx ebx IA 32 Registers bl and bh are byte wide bx is bl and bh taken together as two bytes ebx is four bytes wide with bx as the two least significant bytes bp ebp IA 32 Base Pointers bp is two bytes wide ebp is four bytes wide with bp as the two least significant bytes bsp IA 64 Register Save Engine RSE Backing Store Pointer Register bspst IA 64 Register Save Engine RSE Backing Store Pointer Register for memory stores ccv IA 64 Compare and Exchange Value Register cl ch cx ecx IA 32 Registers cl and ch are byte wide cx is cl and ch taken together as two b
82. es xi Ski 1A 64 Simulator Reference Manual 1 0L xii List of Tables Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L 1 Getting Started A Ski Tutorial In this chapter you learn how to use Ski by executing a brief tutorial At the end of the tutorial you will learn where to look in this manual for detailed descriptions of Ski s operation and commands Introductory information on Ski is pre sented in Chapter 2 Overview 1 1 The Ski Simulator Ski simulates the IA 64 architecture and also has limited support for simulating IA 32 programs Ski runs on IA 32 Linux host systems You can use Ski for many purposes as described in Section 2 1 Introduction One of the most common uses of Ski is to test IA 64 program in a Linux environment and in this chapter you will learn how to use XSKi the X Window System version of Ski by walking through a sample session in about ten minutes Ok twenty minutes You should already be familiar with the IA 64 architecture and the C programming language have xSki installed on your Linux system and have the xski file in your home directory or in your X Window System app defaults directory typi cally usr lib X11 app defaults You will also need to have an executable Linux IA 64 program such as the classic hello world program 1 2 How to Run an 1A 64 Application Program Ski provides a Linux application environment in which an IA 64 program you
83. esgid getsid getuid Ichown Istat mmap2 msgget nanosleep poll readlink recvfrom rt_sigaction sched_get_priority_max sched_rr_get_interval select sendmsg setfsuid setitimer setresgid setsid shmat sigalstack statfs sync umask ustat write Table 7 1 Linux System Calls Supported by Ski access brk chroot dup fchdir fdatasync fsync getegid getitimer getpid getresuid getsockname ioctl link mkdir mount msgrcv open pread not atomic readv not atomic recvmsg rt_sigpending sched_get_priority_min sched_setparam semget sendto setgid setpgid setresuid setsockopt shmdt socket swapoff syslog umount utimes writev not atomic Ski 1A 64 Simulator Reference Manual 1 0L acct chdir clone fork amp vfork dup2 fchmod flock ftruncate geteuid getpagesize 4KB getppid getrlimit getsockopt ioperm listen mknod mprotect msgsnd personality pwrite not atomic reboot rename rt_sigprocmask sched_getparam sched_setscheduler semop setdomainname setgroups setpriority setreuid settimeofday shmget socketpair swapon times uname vhangup adjtimex chmod close execve IA 32 amp IA 64 fchown fstat getcwd getgid getpeername getpriority getrusage gettimeofday kill Iseek mmap mremap msync pipe read rmdir rt_sigsuspend sched_getscheduler sched_yield send setfsgid sethostname setregid setrlimit setui
84. f the ip register you can change where in the program Ski will resume simulation Enter the com mand ip main 20 in the Main Window and observe the first line of the first pane in the Register Window notice that the ip register changes to reflect your command as Figure 1 20 shows You may need to left click in the Main Win dow to make it active You can make similar changes to all of the architecturally visible non hardwired IA 64 registers which helps you debug your program You can test your program s behavior in exceptional cases such as handling unusual errors 1 14 Getting Started A Ski Tutorial Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Registers Window Figure 1 20 The xski Register Window After Changing the ip Register Changing registers isn t enough to debug most programs however Often you need to change values in memory as well Ski provides several commands for this differing in whether they modify one byte chunks two byte chunks four byte chunks eight byte chunks or variable length C language text strings For example instead of hello world you can have the program output Ski Ski Ski You can do this by using the s command string to modify the data stored at the address IO stdin used 8 The string may be stored at a different address in your program If so use the Data Window to locate the string and then use the corresponding addres
85. f you are using ski the window is fixed in size on a twenty four line terminal the window will be nine lines tall 3 5 4 Invalid Code and the Program Window Ski will disassemble the area of memory it is displaying in the program window regardless of whether the area contains program code or data If you tell Ski to display non program memory Ski attempts to display the non existent instruc tions When Ski finds bit encodings that don t represent valid instructions it displays the word 111 1 instead as shown in Figure 3 12 Sometimes Ski may display x s indicating that you asked Ski to show a page of memory that doesn t exist as shown in Figure 3 13 There are three cases to consider In application mode x s indicate a page of memory that hasn t been accessed by the program and therefore hasn t been allocated by Ski In system mode with instruction address translation enabled the psrit bit is on x s indicate a page of memory for which no entry exists in the Translation Lookaside Buffer TLB or in the Virtual Hash Page Table VHPT n system mode with instruction address translation disabled the psr it bit is off x s indicate a page of memory that has not yet been accessed by the program Application mode and system mode programming are discussed in more detail in Chapter 6 Program Simulation Copyright 2000 Hewlett Packard Co Screen Presentation 3 9 Ski 1A 64 Simulator Reference
86. four byte quantities must be on addresses evenly divisible by four and so on See Misaligned Data Access Trap on page 6 3 and Interruptions on page 7 1 Unexpected end of file You are trying to restore a saved simulator state and either the save file is corrupt or Ski is broken See Saving and Restoring the Simulator State on page 8 8 unrecognized option s You specified a command line option that Ski doesn t understand Different varieties of Ski xski ski and bski understand different flags See Command Line Flags on page 2 4 Unrecognized symbol name s You tried to refer to a symbol in an expression but Ski doesn t know about that symbol Perhaps you mis typed it Or perhaps it is a program defined symbol in a file that wasn t compiled with debugging symbol generation enabled the g flag on many compilers Or perhaps you referred to an IA 64 register using a mnemonic that Ski doesn t recog nize See Symbolic Arguments on page 4 4 Symbol Table Commands on page 8 8 and Appendix B Register Names unsupported DOS int 21 function 02 02 Your IA 32 application mode program tried to invoke an MS DOS function that Ski doesn t emulate The first hexa decimal number is the MS DOS function code and the second number is the sub function code See Application Mode IA 32 Programs on page 6 1 and MS DOS Application Environment on page 7 3 Unsupported SSC d Your 64 system m
87. g and Restoring the Simulator State on page 8 8 Expression aligned to mod lld boundary You tried to assign an address to a register that requires an address on a specific boundary but the address you spec ified isn t on that boundary Ski has adjusted the address for you but you should check to make sure the adjustment matches your intent See Changing Registers and Memory with Assignment Commands on page 8 1 Expression gt 47 You tried to assign a value greater than 47 to the rrbp register Expression 95 You tried to assign a value greater than 95 to the rrbf or rrb register File size Memory size You tried to load an IA 64 program but the library Ski uses to parse ELF files can t make sense of the file Are you sure it s an IA 64 program and not an IA 32 program an object file or something completely different See gram Loading on page 6 3 Following values could not be assigned You supplied multiple values in an 21 22 24 or 8 command Some of the values overflowed on to the next page of memory but that page hasn t been allocated Ski creates new pages of memory when the simulated program needs them Ski will not create new pages in response to assignment commands See Changing Registers and Memory with Assignment Commands on page 8 1 FP exception fault An IA 64 application mode program attempted to execute a floating point operation that doesn t make sense such as divide by zero or sq
88. gt 000000000000000000000 0 0000e 00 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 OFFFFB000000000000000 1 0000 00 gt 000000000000000000000 0 0000 00 000000000000000000000 0 0000 00 000000000000000000000 0 0000 00 psr 0000000300000000 ipsr 0000000000000000 dcr 0000000000000000 iva 0000000000000000 pta 000000000000003 gpta 0000000000000000 eax 00000000 ebx 00000000 00000000 edx 00000000 esi 00000000 edi 00000000 ebp 00000000 esp FFFFF780 cs 0000 ds 0000 es 0000 5 0000 gs 0000 ss 0000 Idt 0000 tss 0000 eflags 00000000 LlelbelltlidlaclvmIrfIntlOlofIdFlifItflsflzFlafIpfIcf1 eip 900030000010 Figure 1 6 The xski Register Window 1 2 4 To look at the argv and envp strings you need to use the Data Window Linux passes argc argv and envp on the mem ory stack r12 To look at this memory area use the dj command jump in Command area of the Main Win dow Supply as an operand the address of the memory stack For example if r12 is set to 9 fffff780 you can Inspecting Data Copyright 2000 Hewlett Packard Co Getting Started A Ski Tutorial 1 5 Ski 1A 64 Simulator Reference Manual 1 0L type r12 or dj
89. he first way is to run the simulator with a IA 64 not IA 32 executable program file name as an argument The file will be loaded immediately after the simulator initializes itself and before any command file specified with the i flag is executed See Chapter 9 Command Files and Section 2 5 1 Command Line Flags Copyright 2000 Hewlett Packard Co Program Simulation 6 3 Ski 1A 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 2 Summary 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 com or 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 environ
90. hey were command line parameters Ski supports the MS DOS INT 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 4 Program 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 lt and gt operators rec ognized by most Linux shells For example bski noconsole my program foo bar baz lt test input gt 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
91. his is a status message not an error message See Program Breakpoints on page 8 4 Breakpoint IA 32 at s An IA 32 breakpoint has been reached This is a status message not an error message See Setting Program Break points on page 8 4 Copyright 2000 Hewlett Packard Co Simulator Status and Error Messages D 1 Ski 1A 64 Simulator Reference Manual 1 0L Breakpoint d wasn t set You used the bd command to delete a specific breakpoint but that breakpoint doesn t exist Did you specify the right breakpoint Use the b1 command to list the breakpoints See Deleting Program Breakpoints on page 8 5 and per haps Listing Program Breakpoints on page 8 5 Cannot access registers outside current frame You tried to use the command to assign a new value to a register that isn t in the set of registers currently visible to your program The only registers for which this can occur are the General Registers gr and their NaT bits Ski faithfully implements IA 64 register stacking and rotation Look at the most recent ALLOC instruction Cannot open file s s for s This generic error message indicates that Ski tried to open a file and failed The first s field is replaced with the file name you provided the second s field is replaced with the filename Ski tried to use after tilde expansion and the third s field is replaced with the mode Ski tried to use either reading writing or appending Ch
92. hysical Page PgSz ED AR PL D H P KEY 1 000319 2000000000074 000000000047 1 000319 1 000306 600000000002 0000000000 0 1 000319 20000000000 00000000004 4 1 000319 2000000000058 0000000003234 1 000319 20000000000 8 00000000004 8 1 000306 6000000000014 0000000000564 1 000310 SFFFFFFFEO000 0000000000550 1 000306 6000000000018 0000000000 1 000319 200000000003c 0000000000 4 1 000319 20000000002 0000000000615 1 00030 40000000000 0000000000bf8 1 000306 6000000000000 0000000000918 1 000309 2000000000040 0000000004098 1 000510 SFFFFFFFFFFFO 0000000000518 1 000313 1 000313 1 000313 1 000313 CN gt M E ON AN E EA IE ON ON ON ON ON ON ON ON ON ON ON ON CONI 1 00031c Figure 6 2 sdt Command Output in xski 6 4 Misaligned Data Access Trap If the psr ac bit is set the IA 64 architecture requires alignment checks on memory accesses i e when data accesses are made to items larger than a byte the appropriate number of low order address bits must be zero If the bit is clear the IA 64 implementation may choose whether or not to make such checks Ski chooses to make the checks for references from IA 64 code When an IA 64 program attempts an misaligned access the behavior of the simulator depends on whether it is running in application mode or system mode see Chapter 6 Program Simulation In application mode the simula tor stops the program and displays an error messag
93. icates operand text you should modify bracketed text indicates text you may choose to omit never type the brackets and the symbol indicates items you may repeat The syntax of the command language is described in Chapter 4 Command Language The order in which commands appear here is the order in which they may be abbreviated any command may be abbrevi ated to as few letters as are needed to distinguish it from all commands preceding it in the list below For example the step command may be spelled out in full or abbreviated as ste st or s The save command can be spelled out in full or abbreviated as sav or It can t be abbreviated as s because it follows step in the list below filename Execute commands from the command file specified by filename The file is opened and its contents are executed as if they were entered from the keyboard When the contents are exhausted Ski and xski resume reading commands from the keyboard bski on the other hand executes a run command and then a quit command unless of course the command file already executed a quit command Command files can be nested to a reasonable level See Chap ter 9 Command Files comment Comments may be used to help document the design and implementation of command files A comment is any part of a line following an octothorpe The octothorpe and everything following it on the line are ignored Se
94. iding line between each pair of panes as shown in Figure 3 7 Figure 3 7 An xski Pane Resizer The Small Box Between the Scrollbars 3 4 The Register Window and ski The ski simulator as noted above uses curses to display multiple windows on non graphic text terminals and terminal emulators These windows are fixed in size and are not big enough to display all the data at the same time On a conven tional twenty four line screen Skiuses five lines for the Register Window as shown in Figure 3 8 Because of this lack of space the Register Window shows only one of the five sets of registers at a time user integer floating point system or IA 32 and then only a portion of each set If your screen is larger than twenty four lines when you start Ski ski will make use of the extra space You can resize terminal emulators using command line arguments or by using your window man ager s standard mechanisms for window resizing You use the ur gr fr sr and iar commands to tell Ski which set of registers to display To see the various registers in a set you use the rf and rb commands to scroll the Register Window forwards and backwards respectively These com mands are described in Section 5 1 1 Summary of Register Window Commands Copyright 2000 Hewlett Packard Co Screen Presentation 3 5 Ski 1A 64 Simulator Reference Manual 1 0L mvt rO 0000000000000000 0000000000000000 0000000000000000 00000000000000
95. ighlighted with a bright border When the Register Window has the X Window System focus the Page Up and Page Down keys scroll the current pane one pane full less one line of overlap The up arrow and down arrow keys scroll the current pane one line The Tab and Shift tab keys change the cur rent pane highlight to the next or previous pane respectively wrapping around the top and bottom of the Register Win dow Copyright 2000 Hewlett Packard Co Screen Presentation 3 1 Ski 1A 64 Simulator Reference Manual 1 0L Regizberz Window prs 10000000 OODOODOO DOOODOCOOD DCOOOCOCOOD OCDDCOODCOO ODOCODOO b b rac 0000 1 00 SEO CO Oe CCC CEE PEE CAME CCE CPE CIC COTE CAME CHOC HOG CHEN H OO CE 0 CI CHOVECH ODOCODOCODOOQODOOO GDOCODOODOOODOOO ac O bol U pec O ppl 0 CHOLDCOOCDOCODODCOROEOCRO GOOOODOGDOOOD OE ODOCGODOGOOOOHDO D CRIRE O H EN SOO OOOO COO S003 00600050060 S00 D000 002008 NI CH CIKO mz egoeoeonegonconooo COGOCKODOUCRORUODOODGOO BOOODCOOODOORO ODOODOCOODOODOOO bt cim pim o000000600000060 CIR OCH CCIE OUOCOODOODOU GOOD D TECTE SOOO 0 C0000 SOO CRN Oo 000000 OOO 0000 000000 rrbp rrbf rrbg ser G s l 9 i SOOO OOOOH NICK CARVE CPE CM
96. ing point arithmetic on the host computer the scientific decimal displays may be inaccurate for very large and very small numbers positive and negative The hexadecimal display is always correct as are all calcula tions done by the simulated program Copyright 2000 Hewlett Packard Co Screen Presentation 3 3 re 12 t 6 3 2 4 HOBO OCHOA EOC CHEE APIC inf TEEIETOUDGODUDODUGOUOO NaTv al nol2300000000060000123 2 5105e 71 GEET T7 0009069H9 VEL LOKO COOK Unsupported GUCODOOGOUOODUGD zO00000090000000000123 6 3101 amp e 17 Figure 3 4 The xski Floating Point Registers Pane The System Registers Pane Ski 1A 64 Simulator Reference Manual 1 0L z The system registers pane shows the Processor Status Register psr Control Registers Region Registers rr0 rr7 Pro tection Key Registers pkr0 pkr15 Data Breakpoint Registers dbr0 dbr15 Instruction Breakpoint Registers ibr0 ibr15 and Performance Monitor Configuration Registers pmc0 pmc15 in hexadecimal Application programs have limited access to these registers Addresses are displayed symbolically when possible Symbolic displays are limited to sixteen characters when more than sixteen characters are needed the first fifteen are displayed and an asterisk is added to indicate that the symbolic display has been abbreviated The iva regis
97. ints on page 8 4 Assignment failed You tried to use the 1 2 4 8 or s commands to write data to an invalid location Ski creates new pages of memory when the simulated program needs them Ski will not create new pages in response to the assignment com mands See Changing Registers and Memory with Assignment Commands on page 8 1 Bad breakpoint number Use 0 9 You tried to specify a breakpoint but used an invalid specifier There are ten breakpoints numbered 0 through 9 See Deleting Program Breakpoints on page 8 5 Break instruction fault A non Ski breakpoint BREAK instruction was executed One possible cause is a wild branch to page with all zeroes This can only happen for application mode programs system mode programs handle this fault through the interrup tion mechanism See How Ski Implements Breakpoints on page 8 6 and Interruptions on page 7 1 Breakpoint already set at that location You tried to set a breakpoint at an address where there already is a breakpoint Your request is ignored Ski will not set two breakpoints at one address See Setting Program Breakpoints on page 8 4 Breakpoint d at s s deleted You used the bd command to delete a specific breakpoint Ski is confirming that it has deleted the breakpoint This is a status message not an error message See Deleting Program Breakpoints on page 8 5 Breakpoint IA 64 at s An IA 64 breakpoint has been reached T
98. ions are displayed as shown in Figure 3 11 according to the conventions for Intel assembly code As with 64 instruction display Ski uses the first column of each assembly language instruction line to show breakpoint loca tions numbering them 0 through 9 Except for the use of iabs rather than bs IA 32 breakpoint commands are the same as IA 64 breakpoint commands and include iabs bD bd and b1 as described in Section 8 3 Program Break points In the second column Ski puts a greater than symbol gt to point to the next instruction to be executed i e the location pointed to by the ip register Because IA 32 instructions are variable in length it is possible to set the ip to point into the middle of an instruction This can happen for example when an instruction with prefix bytes is needed at the top of the first pass through a loop and the same instruction without the prefix bytes is needed at the top of subsequent passes When this happens Ski uses a plus sign in column two rather than a greater than symbol to warn you that ip points somewhere in the middle of the line of code displayed on the screen To update the display use the command pj ip This will cause Ski to reinterpret the instruction stream and to display the variable length instructions with the new interpretation 3 8 Screen Presentation Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Program
99. it the xSki file described in Section 2 5 2 The XSki File Much of xskfs user interface behavior is controlled by this file but you should be careful in making changes to any elements other than button descriptions XSKi may change in the future in ways that are not backwards compatible with changes you make Command History commands you ve already entered Command where you type commands to xski Responses responses and error messages from XSki The Menu Button and Command History areas provide shortcuts for typing commands The step button is particularly useful when you are single stepping through a program you can click on the St ep button instead of repeatedly typing the step command The Command History area provides another way to avoid typing you can double click on a command in the Command History to run the command again or single click on the command to move it to the Command area where you can edit and then re run it The Command area is where you type commands to the simulator but as mentioned above you can use the menus buttons and Command History as shortcuts Two useful commands to know are help which causes a window listing all the commands to be displayed and help command which causes information about the command to be shown in the Responses area The Responses area is also used by the simulator to give you feedback when it can t execute one of your commands XSki understands the Prev and Next
100. ject code If you turn on optimization the correspondence between source code and object code will be obscured and you may find the resulting display difficult to interpret IA 64 assembly code is displayed through disassembly the original assembler source code is not displayed Source code for IA 32 programs high level and assembly is not displayed Ski chooses whether to interpret the instructions as IA 64 or IA 32 encodings based on the setting of the psr is bit If your program has a mix of IA 64 and IA 32 code you may need to manually set or clear this bit when trying to view a part of the program that is in a different encoding from the encoding at the current ip location You can set the bit with the Ski command psr is 1 and you can clear the bit with psr is 0 If the bit is set incorrectly Ski will use the wrong instruction decoder and will show IA 64 code disassembled as if it was IA 32 code or vice versa Remember to set the bit back before resuming simulation 3 5 1 IA 64 Instruction Display Each IA 64 instruction bundle is labelled on the left with an hexadecimal byte addressed offset from the nearest preced ing symbol up to Oxffff bytes away If the symbol name and offset are longer than sixteen characters the first fifteen are displayed and an asterisk is added to indicate that the symbolic display has been abbreviated For each 128 bit bun dle the two or three instructions are displayed in the center of
101. keys and the arrow keys found on many HP keyboards When the Main Window has the X Window System focus the current area is highlighted usually with a bright outline You can make a different area current with Tab and Shift tab The Prev Next up arrow and down arrow keys scroll through the current area allowing you to easily edit and re run previous commands from the Command History and review previous messages in the Response area In addition you can use the Alternate key alt like a Shift key along with the underlined letter in each menu name as a shortcut to access the menu rather than using the mouse For example Alt F brings up the File menu This lets you spend less time shuttling between the keyboard and mouse and more time doing productive work 3 12 Screen Presentation Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Figure 3 16 xsk s Main Command Window 3 7 2 The ski Command Window ski s Command Window is simpler as shown in Figure 3 17 There no menus buttons or Command History Instead you enter commands when you see a prompt in the 4 line Command Window at the bottom of the screen Ski displays its responses in this window as well The window scrolls so that information lost off the top of the window may be recov ered using the up and down arrows on your keyboard for Emacs fans Ctrl P and Ctrl N serve the same function As a typing shortcut if you hit the enter return key
102. l Flow in Command Files 9 1 9 2 1 goto Command and Labels 9 1 9 22 Thea Command fesses a i cae dus memes esee ex bb v gas E ALS 9 2 9 3 Comments in Command Files 9 2 04 An Example Command Pile ss menu ee B BE ORE nat fee ORE ut 9 2 9 5 Summary of Command File Commands 9 3 A Command Reference aos dove eei SUE eh eo Gold B AUS EE we BOR Ge ee os 1 B Register Names 5 1c Anat ny a is Sa ee EN dat en IU oa ee T ae eet a I ee Ao B 1 DA 64 RegisterSs S af kb ey Re ee re seis eee es ot a S B 1 C Internal Variable Names sranie baned ma Sve Gee Bie ee Saw and ee ee Ge See ay ERREUR C 1 C T Internal Variables Pepy oy Gtk te tn sata A gl a te a eth ut we AR C 1 D Simulator Status and Error Messages D 1 Copyright 2000 Hewlett Packard Co Table of Contents vii Ski 1A 64 Simulator Reference Manual 1 0 viii Table of Contents Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Figure 1 1 Figure 1 2 Figure 1 3 Figure 1 4 Figure 1 5 Figure 1 6 Figure 1 7 Figure 1 8 Figure 1 9 Figure 1 10 Figure 1 11 Figure 1 12 Figure 1 13 Figure 1 14 Figure 1 15 Figure 1 16 Figure 1 17 Figure 1 18 Figure 1 19
103. language dump of the program in Figure 5 1 and Figure 5 2 The mnemonic stands for program dump rii ar pis 4 0 1 0 movi r data start nop mov or r32 r rl2zi adds rl2 32 rl or ripar r add adds r s H r12 nop x hr call sptk few b printf ar ri r35 r nag T x mop a b Hx How Figure 5 3 xsk s Assembly Language Dump Window 5 4 Screen Manipulation Commands Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L 5 3 Data Window Commands The Data Window displays an area of memory in hexadecimal format and if the window is wide enough an ASCII trans lation See Section 3 6 The Data Window The commands to adjust the Data Window are similar to those for the Pro gram Window and are described below 5 3 1 Summary of Data Window Commands dj address If address is specified repositions jumps the Data Window so that the bytes containing the specified address are first in the window If no address is given jumps to the previous location The mnemonic stands for data jump d count Moves the Data Window forward count display lines or one windowful if count is not specified The mnemonic stands for data forward db count Moves the Data Window backward count display lines or one windowful if count is not specified The mnemonic stands for data backward dbndl Displays the data as hexadecim
104. lator Reference Manual 1 0L 4 4 1 3 Addresses An address is specified by a 64 bit hexadecimal number For example the command pj 1000 repositions jumps the Program Window to address 0x1000 As discussed in Section 6 1 Application Mode and Sys tem Mode Simulation Ski supports generic addresses in application mode programs that is the concept of virtual memory doesn t apply to application mode programs and physical and virtual addresses in system mode programs For system mode programs the psr dt and psrit bits control whether Ski interprets addresses as physical or virtual In some cases you may need to change the value of one or both of these bits temporarily so that Ski will interpret addresses the way you want You should restore the bit values before resuming simulation of course You can set the psr dt bit with the Ski command psr dt 1 and clear the bit with psr dt 0 The corresponding commands for the psr it bit are psr it 1 and psr it 0 respectively Addresses may be computed using expressions For example the command dj 1000 0d50 repositions jumps the Program Window to address 1032 because 1000 hexadecimal added to 50 decimal is 1032 hexadecimal Address expressions are particularly useful in symbolic constructs as described below 4 4 2 Symbolic Arguments A symbol is a sequence of characters a Examples of symbols are program defined symbols
105. lator Reference Manual 1 0L Program Window fup m Hee nop Ox br ret sp k few main nlloc r335ar p fs 4 0 1 0 mov r3j mb or ri er ri ma re 0 adds ri Het nep b Ox madida or r35 r rH adds ro 48 rlz Ux main z M Ox moe 1 data start maine Heth nop Ome br call sptk few b s printf p mad nF or ri r335 r mtp i DEG nop Close Help Figure 8 3 Three Breakpoints 0 2 and 1 Visible in xsk s Program Window 8 3 2 Deleting Program Breakpoints Two commands delete program breakpoints The bd command deletes a specified breakpoint The bD command deletes all breakpoints currently set 8 3 3 Listing Program Breakpoints The b1 command causes list of currently set program breakpoints to be displayed on the screen symbolically if possible as shown in Figure 8 4 The first column of the display shows the breakpoint number for use with the bd command The second column displays a for physically addressed breakpoints and v for virtually addressed breakpoints The col umn labelled Address is of course the breakpoint address In the next column 64 indicates a breakpoint in IA 64 code and IA 32 indicates a breakpoint in IA 32 code The Command column is currently unused Copyright 2000 Hewlett Packard Co Debugging 8 5 Ski 1A 64 Simulator
106. le Ski has been used successfully to develop the IA 64 version of the Linux kernel IA 64 processor functional hardware verification Ski is a true implementation of the IA 64 architecture You can compare the behavior of code simulated with Ski to the same code running on other IA 64 implementations This helps you verify the correctness of those implementations 2 1 2 Ski s Scope Many different kinds of simulators can be created device simulators that function at the semiconductor quantum physics level circuit simulators that model the behavior of small numbers of transistors and other circuit elements gate simulators that model digital circuits at the boolean logic level and so on Ski is an instruction simulator which makes it very fast Ski doesn t model any particular physical IA 64 implementation Instead it models an architecturally compliant IA 64 processor with extensive compute resources 2 2 What You Need to Know to Use This Manual This manual describes the user interface of Ski in detail In reading this manual you will learn how to use Ski to simulate your IA 64 and IA 32 programs To understand this manual you should already be familiar with the IA 64 architecture IA 64 abbreviations such as ip psr and eax are used without explanation 2 3 Defects and Defect Reporting Ski is provided as is without any guarantees or warranties However a mailing list has been created for reporting Ski defects and for general Ski
107. luated to a non zero value or you left the false command blank and the expression evaluated to zero See The if Command on page 9 2 D 4 Simulator Status and Error Messages Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Missing ELF header See File size gt Memory size on page D 3 Missing file version number You are trying to restore a saved simulator state and the first non blank non comment line of the file doesn t begin with file ver the file version string Is the file a Ski simulator state save file See Saving and Restoring the Simulator State on page 8 8 missing value for option s You specified a command line option that requires an argument See Command Line Flags on page 2 4 More than d characters in expression s You gave Ski an expression that is too long for it to parse Try a shorter expression See Expressions on page 4 2 Nesting overflow You invoked a command file from within another command file and another command file from within there and again and again and you did it too much Do you have an recursive loop where a command file invokes itself See Chapter 9 Command Files No breakpoints set You tried to list all breakpoints with the bl command but there aren t any See Listing Program Breakpoints on page 8 5 No breakpoints to delete You tried to delete all breakpoints with the bD command but there aren t any See D
108. ment 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 psris 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 com format 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 psrit bit as described in Section 4 4 1 3 Addresses 6 5 3 Notes about Program Loading 6 5 3 1 Adding 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 a
109. mulation speed This command can be used to implement data write breakpoints with the caveat that it won t detect the case where the write doesn t change the value This can be useful when you are tracking down a memory corruption problem you can use step until r33 r32 for example Another example of this command is breaking into a loop after a certain number of iterations step until r35 lt 30 See Section 4 4 1 2 Expressions Copyright 2000 Hewlett Packard Co Program Simulation 6 5 Ski 1A 64 Simulator Reference Manual 1 0L 6 6 Program Simulation Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L 7 Linux and MS DOS ABI Emulation As discussed in Section 6 1 Application Mode and System Mode Simulation Ski can provide application programs with a Linux compatible or MS DOS compatible environment The environments aren t full blown operating system emulations however The most common OS functions are provided as described below 7 1 Interruptions The IA 64 architecture defines a large set of interruption types including faults traps and interrupts Interruptions may happen asynchronously during an instruction or between instructions Like application programs running on a real Linux machine IA 64 application mode programs in Ski never see interruptions Instead Ski translates interruptions into the signal that a real IA 64 Linux kernel would generate For exampl
110. n a nested command file is exhausted control returns to the next higher level command file if expression without spaces true command if expression without spaces true command false command In the first form causes the rest of the line to be ignored if expression without spaces evaluates to zero Otherwise true command is executed In the second form if expression without spaces evaluates to nonzero the true command is executed Otherwise the false command is executed The if command may be executed from the keyboard In combination with xskfs Command History see Section 3 7 1 The xski Main Window or skis command repetition mechanism see Section 3 7 2 The ski Command Window this can be quite powerful goto label In a command file only causes execution to continue following the first line in the file which contains the abel Goto s may be forward or backward comment The and all characters following it until the next newline are ignored label The colon command marks a goto label All characters following the and preceding the next newline are ignored Copyright 2000 Hewlett Packard Co Command Files 9 3 Ski 1A 64 Simulator Reference Manual 1 0L 9 4 Command Files Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L A Command Reference In the command descriptions that follow this face indicates literal text you should type this face ind
111. ndix A Command Reference Illegal operation fault An attempt was made to execute an invalid instruction probably a wild pointer in a jump table caused a wild branch This can only happen for application mode programs system mode programs handle this fault through the interrup tion mechanism See Chapter 6 Program Simulation Illegal slot field in breakpoint address You used the bs command to set an 64 breakpoint but you specified an address in the last four bytes of a bundle Because the IA 64 architecture provides for bundle level but not instruction level addressing Ski pretends that the first instruction of the bundle is in the first four bytes the second instruction is in the second four bytes and the third instruction is in the third four bytes You specified a location in the fourth four bytes of a bundle and that isn t allowed by Ski See Setting Program Breakpoints on page 8 4 and How Ski Implements Breakpoints on page 8 6 Interrupting simulation Ski received a SIGINT signal while simulating probably because you hit control C or whatever key you have con figured to interrupt a running program This is a status message not an error message See Interruptions on page 7 1 and the first few paragraphs of Chapter 9 Command Files missing command You used the if expression true command false command command Either you left the true command blank and the expression eva
112. nds the eval and if commands and the load and iaload program loading commands See Changing Registers and Memory with Assignment Commands on page 8 1 Evaluating Formulas and Formatting Data on page 8 4 The if Command on page 9 2 and the section Program Loading on page 6 3 particularly Creating the argc argv and envp Parameters on page 6 4 Too many commands in a line gt d You can type multiple commands on a line by separating them with semicolons But there s a limit as shown to the number of commands you can do this to and you exceeded it See Command Sequences Repetition and Abbrevi ation on page 4 1 Copyright 2000 Hewlett Packard Co Simulator Status and Error Messages D 7 Ski 1A 64 Simulator Reference Manual 1 0L Unable to open console window Your system mode program tried to open a console with the appropriate Simulator System Call but Ski wasn t able to spawn the corresponding xterm program First verify that environment variable DISPLAY is set to the proper hostname displaynumber string If this does not help perhaps there is no xterm available via your PATH environ ment variable Perhaps you have hit the process limit or used all the pseudo tty devices on your Linux system See System Mode IA 64 Programs page 6 2 Unaligned Data fault An attempt was made to access data on an unnatural boundary Two byte quantities must be on addresses evenly divisible by two
113. ns that might run for a long time as background jobs on your workstation or on a higher powered remote simulation server The cron and make programs work well with bski With cron you can schedule simulations to run at night and on remote servers With make you can execute complex networks of tests quickly letting make keep track of the dependencies between the tests These programs are documented in man pages xi 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 r12 0000000000000000 0000000000000000 0000000000000000 0000000000000000 r16 0000000000000000 0000000000000000 0000000000000000 0000000000000000 EEG MEN IA 64 Debugger Simulator Version 0 8731 EAS 2 5 Copyright 1996 2000 The Hewlett Packard Company All Rights Reserved eT I 0000000000000000 HMHHMHRMMMHMMMM MMMMHHHHHHHMHMHM 0000000000000010 sHHHHRHMHMHMHMMM MEMHHHHHHHHHHHHM Fr LE Le Version 0 8731 EAS 2 5 _ Figure 2 1 The Curses based ski Interface 2 2 Overview Copyright 2000 Hewlett Packard Co Ski 1A 64 Si imulator Reference Manual 1 0L Data Window Program Window 0000000000000010 0000000000000020 0000000000000030 0000000000000040 0000000000000050 0000000000000060
114. nting complex facilities on top of Ski s native commands For example you can write command files to setup the machine state just before an I O interrupt to create sophisticated breakpointing and to take complex performance measurements 9 1 Initialization File If you start Ski with a i option followed by a filename the named file will be executed as a command file before the first prompt see Section 2 5 1 Command Line Flags This feature is particularly important for bski because without a command file to guide it bski will only run your program and then quit If you want to do anything else you need a command file When you combine the i option with Ski s ability to load a program on the command line you can create a powerful debugging environment For example this command line bski i test init stats icnt instruction counts combined with this test init command file load ia test 0x26c50 romload test com etext test map uses the command file test init to load an IA 64 Platform Support File named ia test filling in Ski s symbol table for program defined symbols and then loads the IA 32 system mode program test com putting it at the location corre sponding to the symbol etext in ia test The command file finishes and bski automatically executes a run com mand followed by a guit command To start the run the ia test program receives 0x26c50 as its argv 1 value This corresponds to the value of the symbol
115. o work on a simulated processor rather than a real processor Like any good debugger Ski provides breakpoints To set a breakpoint in an IA 64 program use the bs command breakpoint set In the example that follows you will want to have the Program Window display the area of code near main Use the command pj main as you learned above To set a breakpoint at the beginning of main type bs main in the Main Window The Program Window shows a 0 in the first column of the window at the breakpoint location the alloc instruction because you just used breakpoint 0 as Figure 1 14 shows The first three columns are also used for line numbers Set a breakpoint at main 10 and another at main 20 Ski lets you set up to ten breakpoints Program Window Figure 1 14 The Program Window Showing a Breakpoint at main Use the b1 command breakpoint list to see a list of the breakpoints as shown in Figure 1 15 If you prefer using a mouse use the Breakpoints item on the View menu instead of the b1 command When you are finished viewing the breakpoint list click its Close button to dismiss the window To delete breakpoints individually use the command breakpoint delete Use the bD command breakpoint Delete all to delete all breakpoints at once Delete all your breakpoints before continuing this tutorial 1 10 Getting Started A Ski Tutorial Copyright 200
116. ode program invoked a Simulator System Call that Ski doesn t support Either your program has a bug or Ski is broken See System Mode IA 64 Programs on page 6 2 unsupported system call d Your IA 64 application mode program tried to invoke an Linux system call that Ski doesn t emulate See Linux Application Environment on page 7 1 and Application Mode IA 64 Programs on page 6 1 Usage s options file args Ski s generic command line help message D 8 Simulator Status and Error Messages Copyright 2000 Hewlett Packard Co
117. oints 8 4 8 3 2 Deleting Program Breakpoints 8 5 8 3 3 Listing Program Breakpoints 8 5 8 3 4 Notes on Program Breakpoints 8 6 8 3 5 Summary of Program Breakpoint Commands 8 6 8 4 Data Br akboints cul ewe a ie be Gk oe ere anh doe dus 8 7 8 4 1 Setting Data Breakpoints 8 7 8 4 2 Deleting Data Breakpoints lt 8 7 8 4 3 Listing Data Breakpoints 8 7 8 4 4 Summary of Data Breakpoint Commands 8 7 8 5 Dumping Registers and Memory to a File 8 8 8 6 Saving and Restoring the Simulator State 8 8 8 6 1 Summary of Save and Restore Commands 8 8 8 7 Symbol Table Commands 8 8 vi Table of Contents Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0 8 7 1 Summary of Symbol Commands 8 8 Command Files 7 tant eee be S E tele fk Ale ht neue foe Ro E EUR f deed EUER HRS 9 1 91 Initialization 84 nas Sek BAR ar Iu oe na de nes a Pau 0 9 1 9 2 Labels and Contro
118. opyright 2000 Hewlett Packard Co Debugging 8 9 Ski 1A 64 Simulator Reference Manual 1 0L 8 10 Debugging Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L 9 Command Files The dot command temporarily redirects command input to the simulator so that input is taken from the file provided as an argument to the command Into this file a command file you put commands as if you had typed them from the keyboard Several commands are specifically applicable to command files and are described below Command files may be nested i e one command file may invoke another The maximum nesting depth is operating system dependent Some syntax rules that apply to keyboard input don t make sense or would be cumbersome in command files Most nota bly in ski a shortcut for re executing the previous command is to hit the enter return key on an empty line This rule is removed in command files so you are free to put in blank lines for readability You can also indent lines as necessary The ability to assign values to registers and memory and the flow control features provide the simulator with a powerful Church Turing complete command language 1 tasks which can be accomplished in any programming language sub ject to memory constraints can be accomplished in the command language of the simulator Command files are particu larly appropriate for initializing the state of the simulator and for impleme
119. or in symbolic disassembled form correspond ing roughly to the formats in the Data Window and the Program Window respectively The commands to do this are dd and pd and are described in Section 5 3 1 Summary of Data Window Commands and Section 5 2 1 Summary of Program Window Commands respectively 8 6 Saving and Restoring the Simulator State You may need to interrupt a simulation session and continue it later For example you might be tracking down a difficult bug and want to save the state of the simulator just before the bug occurs so you can replay the problem and try different strategies The save command saves the state of the currently executing program to a named disk file Later you restore the saved file with the rest command or the rest command line flag described in Section 2 5 1 Command Line Flags The save command saves the state of the simulated IA 64 processor including the overlaid IA 32 registers the symbol table for program defined symbols and memory Certain simulator state information in particular the values of internal variables and window related information is not saved Linux and MS DOS state information such as open file handles and seek pointers is not currently saved this will probably change so you should check the release notes 8 6 1 Summary of Save and Restore Commands save filename Saves an image of the machine state IA 64 and IA 32 in the specified file rest filename
120. ow i e xj Program Window file 77 0000000000000010 0000000000000020 0000000000000030 0000000000000040 0000000000000050 0000000000000060 Registers Window 0000000000000010 0000000000000020 0000000000000030 0000000000000040 0000000000000050 0000000000000060 0000000000000070 0000000000000080 0000000000000090 ip 0000000000000000 psr um mfhlmfllacluplbe prs 10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 b 0000000000000000 0000000000000000 b2 0000000000000000 0000000000000000 b4 0000000000000000 0000000000000000 bE 0000000000000000 0000000000000000 rrbp rrbf rrbg sor sol sof lc 0000000000000000 00 bol 0 cfm 0 0 m m SE rsc 0000 0 0 0 pec 00 ppl 0 0 0 0 fi wi 0 0000000000000000 0000000000000000 000000000000
121. owing Data Interpreted as Instruction Bundles 3 6 1 Changing the Range of Locations Shown in the Data Window As with the Program Window xski doesn t place a scroll bar in the Data Window Instead like ski XSKi provides the d db and dj commands described in Section 5 3 Data Window Commands Use these commands to scroll the Data Win dow forwards and backwards and to jump the Data Window In addition XSki understands the Page Up and Page Down keys and the arrow keys When the Data Window has the X Window System focus the Page Up Page Down up arrow and down arrow keys emit the db db 1 and 1 commands respectively You can control the size of 5 Data Window with your window manager s standard mechanisms If you are using Ski the window is fixed in size on a twenty four line terminal the window will be two lines tall Copyright 2000 Hewlett Packard Co Screen Presentation 3 11 Ski 1A 64 Simulator Reference Manual 1 0L 3 6 2 Invalid Code and the Data Window If you tell Ski to display non existent memory Ski will display x s instead as shown in Figure 3 14 Non existent mem ory is defined for the Data Window similarly to its definition for the Program Window described in Section 3 5 4 Invalid Code and the Program Window except that the relevant bit for system mode programs is psr dt 3 7 The Command Main Window XSki and ski are command driven simulators Most of you
122. play Data Window contents in hexadecimal format See Data Window Commands on page 5 5 eval expression without spaces Evaluate one or more expression without spaces and print the result in an appropriate format typically hexadecimal and or decimal or symbolically An expression without spaces can include numbers registers internal variables program defined symbols operators and parentheses for grouping See Evaluating Formulas and Formatting Data on page 8 4 fr Ski Show the floating point registers in the Register Window See Register Window Commands on page 5 1 xski Toggle the display of the floating point registers pane See Register Window Commands on page 5 1 goto label Causes execution to continue following the first line in the file which contains the label Goto s may be forward or backward Goto s are valid only in command files See The goto Command and Labels on page 9 1 gr Ski Show the general registers in the Register Window See Register Window Commands on page 5 1 xski Toggle the display of the general registers pane See Register Window Commands on page 5 1 help command Display a list of the commands Ski recognizes or if a command name is specified a syntax description for that command See Command Entry on page 4 1 iar Ski Show the IA 32 registers in the Register Window See Register Window Commands on page 5 1 xski Toggle the display of the IA 32 regi
123. pplicable you may have found a Ski defect See Other Windows on page 3 14 popen failed A call to the Linux system routine popen failed that is a 1 was returned from the call This is unusual and while it doesn t indicate an internal Ski error it may suggest that your Linux operating system is corrupt perhaps due to some other program Ski uses popen when it needs to invoke a pager to display a large amount of text to you for example when you use the help and symlist commands The popen function might fail if you have the maxi mum allowed number of processes running on your computer or if you have run out of swap space Privileged operation fault Your IA 64 application mode program tried to execute a privileged instruction This can only happen for applica tion mode programs system mode programs handle this fault through the interruption mechanism See Chapter 6 Program Simulation and Interruptions on page 7 1 Privileged register fault Your 64 application mode program tried to access a privileged register This can only happen for application mode programs system mode programs handle this fault through the interruption mechanism See Chapter 6 Pro gram Simulation and Interruptions on page 7 1 program exited with status d Your IA 64 program finished execution in the normal fashion This is a status message not an error message Register NaT Consumption fault Your 64 appli
124. r interaction with them is done by typing commands Your commands are typed in a window titled main in XSki see Figure 3 16 and Command in Ski see Figure 3 17 3 7 1 The xski Main Window XSki divides the Window into five areas Menus File View Configure and Help The File menu provides a Quit selection for you to exit the program The View menu lets you choose which windows to see The Configure menu is currently non functional The Help menu provides a Commands selection that displays the commands Ski recognizes and a Product Information selection that displays information about xski Buttons Step Run Prog Data Regs Cache TLB and Quit Clicking on the Step button executes the command step 1 single stepping the simulated program Shift clicking the button executes the command step 10 step ping the simulated program through ten instructions The Run Prog Data and TLB buttons execute the run pj dj and sdt commands respectively If the Program Window has been closed removed from the screen not merely min imized to an icon the Prog button recreates it The Data button operates similarly with respect to the Data Window The Regs and Cache buttons are currently non functional XSki s buttons are configurable Using the X Window System resource mechanism you can change the number of buttons the button labels and the commands the buttons emit The easiest way to do this is to ed
125. rogram Window shows the beginning of the program For C programs this isn t the first line of user code it s the start up routine from crt1 o that provides an interface between the operating system environment and the ANSI C environment This routine is named start and the ELF header in hello names it as the start of the program That s what Ski shows in the Program Window by default the start of the program according to ELF You use the pj command program jump to jump the program window elsewhere For example jump it to the first instruction in the user s main as shown in Figure 1 12 The Program Window now looks like Figure 1 13 You can move the Program Window forwards and backwards through program code with the p program forwards and program backwards commands respectively Try these commands and then try using pj without an operand note how it jumps you back and forth between the previous and current locations The dj command does the same thing in the Data Window Handy eh 1 8 Getting Started Ski Tutorial Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L main File View Configure load hello dj SFFFFFFFFFFFF780 di r12 18 gt dj 0 dj r12 18 gt Command Figure 1 12 Jumping the Program Window to the Beginning of main Program Window Program File _ do_frame 0090 br ret sptk many nop b 0
126. ruction The mnemonic stands for program forward pb count Moves the Program Window backward count IA 64 bundles or IA 32 instructions If count is not specified moves the Program Window backward one windowful less one bundle or instruction The mnemonic stands for program backward pa Display the program being simulated in assembly language only as shown in Figure 5 1 This command is valid for IA 64 code only The mnemonic stands for program display assembly 5 2 Screen Manipulation Commands Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Program Window alloc r3d3mar pfz 4 0 1 0 mav r34zbtl or Fi r ri adda 12 32 12 Gxt Oaths z or r35 r1 ro adds r sm AH8 r127 nop b xir g main nop m x movi r36 data start maint nag m nap x br call sptk few b printf in indo050 or rl r35 r0 nop 0 0 x ma krach or ri2sr0 r32 mav b srj gov i ar pis r31 Clone Geta Help Figure 5 1 xsk s Program Window Showing IA 64 Assembly Language Code pm Display the program being simulated in its source code form with the assembly language translation mixed in as shown in Figure 5 2 The source code display is for your convenience only you cannot interact with the source code e g modify the source code click on a variable name to see its value in the Data Window and so on The source code is not embedded in
127. ruction was reached simulation has stopped This is a status message not an error message See Application Mode IA 32 Programs on page 6 1 and System Mode IA 32 Programs on page 6 2 Stopping at s due to reserved IA 32 instruction An attempt was made to execute an IA 32 instruction whose encoding has been reserved by Intel Ski recognizes the encoding but doesn t know what to do with it See Application Mode IA 32 Programs on page 6 1 and System Mode IA 32 Programs on page 6 2 Stopping at s due to unimplemented IA 32 instruction An attempt was made to execute an IA 32 instruction that isn t implemented by Ski See Application Mode IA 32 Programs on page 6 1 and System Mode IA 32 Programs on page 6 2 Stopping at s due to unimplemented instruction Your program tried to execute an IA 64 instruction that isn t implemented by Ski Symbol s not found You referred to a symbol that Ski doesn t know about Did you spell the symbol correctly with leading underscores as needed Is the symbol a C mangled name Have you loaded the right program See the section Argument Specification on page 4 2 particularly Symbolic Arguments on page 4 4 s Too many arguments gt d You passed too many operands with a Ski command Ski s internal parser can handle a maximum number of argu ments currently 64 and you tried to pass more than that number This could happen with the 1 2 4 and 8 assignment comma
128. s commands and simulation environment provided by the Ski IA 64 simulator The version of the simulator described here is Version 0 8731 How to Use This Manual The first chapter of this manual is a quick start tutorial Using only the first chapter you can learn enough about Ski to do useful work If you are using Ski to simulate an 64 application program and are familiar with debuggers such HP s xdb the first chapter and Appendix A Command Reference may be all you need to read The remaining chapters provide information about Ski in depth Use these chapters to learn about commands not covered in the tutorial and to learn more about how Ski operates Use Appendix A Command Reference and the on line help command to find a list of all Ski commands and a brief description of each command Use Appendix D Simulator Status and Error Messages to understand the causes and possible solutions for each of Ski s error messages Font Conventions In this manual fonts are used as described below Depending on how you are viewing this document paper a web page a PDF file etc some distinctions may not be visible italic is used for optional text including operand fields such as count and for the names of bitfields such as psrbe light italic is used for graphical button names such as Run fixed width bold is used for literal text including commands such as dbndl and for examples such as bski icnt foo
129. s 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 2 Creating 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 1oad or iaload commands to load the executable program You can add extra arguments to 1oad 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
130. s instead Here s what to do First make sure the Data Window is wide enough to show ASCII translations along with hexadecimal as in Figure 1 21 To avoid confusion make sure the Data Window doesn t overlap the Main Window Copyright 2000 Hewlett Packard Co Getting Started A Ski Tutorial 1 15 Ski 1A 64 Simulator Reference Manual 1 0L Data Window Figure 1 21 The xski Data Window Widened to Show ASCII Next issue the command s _IO_stdin_used 8 Ski Ski Ski in the Main Window You may need to left click in the Main Window to make it active Observe how the Data Window changes the hexadecimal values at and after _IO_stdin_used 8 have changed as have their corresponding ASCII translations and a null byte the value zero has been added to the end of your string to make it a valid C language string Compare Figure 1 21 and Figure 1 22 Data Window Figure 1 22 The xski Data Window After Changing the Hello world String The commands to change one two four and eight byte quantities are 1 2 4 and 8 respectively They are described in detail in Appendix 8 1 Changing Registers and Memory with Assignment Commands and in Appendix A Com mand Reference Often you will need to evaluate formulas For example to find the address of the first envp string you would need to compute the sum of the contents of r12 and 18 hex and then add the length of the argv vector arge 1 multiplied b
131. s shown below The i rest icnt and stats flags appear in any order ski help i filename rest filename program filename args xski help noconsole i filename rest filename program filename args bski help noconsole i filename rest filename icnt filename stats program filename args 2 5 1 1 Summary of Flags help A list of flags accepted by this variety of Ski ski xski or bski is printed out No other processing is done and Ski terminates i filename The specified file is run as a command file before the first prompt to the user If an program_filename is provided on the same command line the program_filename is loaded before the command file is run This provides a convenient way to load a program initialize other machine state and then turn control over to the user icnt filename For bski only This flag specifies instruction counts should be saved in the specified file For each kind of instruction executed during the simulation the instruction count file shows five fields of information The instruction mnemonic The total number of times the instruction was executed The number of executions that were predicated on The number of executions that were predicated off The number of executions that were predicated on predicate register 0 which is hardwired on The value in the second field equals the sum of the values in the last three fields noconsole
132. see data in ASCII translation Data Window Figure 1 9 The Data Window Showing argv and envp Strings in Hexadecimal Typing hexadecimal numbers is error prone and Ski provides several shortcuts to avoid it The first is xski s Command History an unlabeled window pane just above the Command area in the Main Window As you execute commands they move up to the Command History Later you can bring them back into the Command area A single click brings a com mand back for you to edit A double click brings the command back and re executes it immediately Try the Command History by doing this Type dj 0 to jump the Data Window to location 0 The Main Window should look like Figure 1 10 Then click on the dj 9 ffffffffff938 command in the Command History Hit the enter return key to execute it main ON Ste Run Proof teta no La naj Figure 1 10 The Main Window Showing Commands in the Command History Copyright 2000 Hewlett Packard Co Getting Started A Ski Tutorial 1 7 Ski 1A 64 Simulator Reference Manual 1 0L Another shortcut is the pointer dereference operator for indirect addressing Type dj 0 to jump the Data Window to location 0 Then type r12 18 Ski will take the contents of r12 9 780 remember add 18 hex and use that as the address of the operand The operator fetches the contents of r12 18 and uses that value
133. sf2 pc fpsr sf2 rc fpsr sf2 v fpsr sf2 d fpsr sf2 z fpsr sf2 0 fpsr sf2 u fpsr sf2 i fpsr sf3 fs fsd gdtd 8p gp nat gs gsd lasp esp ibrO ibr15 ifa ifs iha im iip ip ipsr irrO irr3 isr itir itm itv iva ivr k7 lc ldt IA 64 FPSR Status Field 2 Precision control bits IA 64 FPSR Status Field 2 Rounding control bits IA 64 FPSR Status Field 2 IEEE Invalid Operation status bit IA 64 FPSR Status Field 2 Denormal Unnormal Operand status bit IA 64 FPSR Status Field 2 IEEE Zero Divide status bit IA 64 FPSR Status Field 2 IEEE Overflow status bit IA 64 FPSR Status Field 2 IEEE Underflow status bit IA 64 FPSR Status Field 2 IEEE Inexact status bit IA 64 FPSR Status Field 3 IA 32 additional extra Segment Register IA 32 additional extra Segment Register Descriptor IA 32 Global Descriptor Table Descriptor IA 64 Global Pointer a synonym for r1 IA 64 Global Pointer Not a Thing bit a synonym for r1 nat IA 32 additional extra Segment Register IA 32 additional extra Segment Register Descriptor IA 32 Stack Pointer iasp is two bytes wide esp is four bytes wide with iasp as the two least significant bytes The x86 mnemonic for the iasp register is sp but that conflicts with the IA 64 Stack Pointer of the same name hence the name change for IA 32 IA 64 Instruction Breakpoint Registers IA 64 Interruption Faulting Address Register IA 64 Interruption Function
134. sn t appropriate for one of its four win dows it uses a pager such as more or less instead and restores the curses windows when the pager completes Ski uses three of the windows to display information to you The fourth window is shared between you and Ski You enter commands that control Ski and Ski reports errors and other immediate information to you You control the windows using Ski commands see Chapter 5 Screen Manipulation Commands and the simulator updates the windows whenever nec essary to maintain consistency with the internal state of the simulator engine The four windows are described in more detail below 3 2 The Register Window Ski divides the IA 64 processor registers into five sets In xSki all five sets are displayed in one window the Register Window with each set in its own subwindow or pane The panes show user registers general registers floating point registers system registers and IA 32 registers respectively as shown in Figure 3 1 The five panes share screen space and unless you have a very large screen it s not possible to see all five panes at full size simultaneously XSki shows portions of all five panes by default but you can toggle any panes off with commands described in Chapter 5 Screen Manipula tion Commands XSki understands the Page Up and Page Down keys and the up arrow and down arrow keys found on most keyboards These keys operate on the current pane which is usually h
135. sters pane See Register Window Commands on page 5 1 iabs address Set IA 32 breakpoint at address or at the current value of ip if address is omitted 32 code only See Setting Program Breakpoints on page 8 4 iaload filename address mapfile args Prepare for IA 32 application mode simulation Load an IA 32 executable file com or exe and prepare to pass the program args using the MS DOS command line parameter mechanism address specifies where to load the pro gram mapfile provides Ski with the mapping between program defined symbols and their addresses and must spec ify an ASCII text file exactly compatible with mapfiles produced by the Microsoft ML linker See How to Load a Program on page 6 3 if expression without spaces true command false command Execute true command if the expression without spaces evaluates to a non zero value false command if it evalu ates to zero See The if Command on page 9 2 Copyright 2000 Hewlett Packard Co Command Reference A 3 Ski 1A 64 Simulator Reference Manual 1 0L isyms filename Write internal symbols to the screen or to the file given by filename See Symbol Table Commands on page 8 8 load filename args Prepare for IA 64 application mode simulation Load the IA 64 ELF executable program file given by filename and prepare to pass the program args using the C language argc argv parameter mechanism See How to Load a Pro gram on pag
136. t 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L 4 Command Language The Ski command language is simple efficient and easy to learn It consists of commands you can invoke from the key board from a command file see Chapter 9 Command Files Each command is given with an appropriate set of argu ments some optional to further qualify the command Commonly used commands may be abbreviated as described in Appendix A Command Reference and commands may be repeated easily A limited on line help facility the help command is provided for quick reference This chapter presents the syntax of the command language Information about specific commands command semantics is in later chapters and in Appendix A Command Reference 4 1 Command Entry 5 and ski provide similar mechanisms for controlling the simulator Both provide for direct keyboard entry of com mands In addition XSki offers buttons menus and the Command History to minimize typing as described Section 3 7 1 The xski Main Window and ski provides the command repetition mechanism for the same purpose as described in Section 3 7 2 The ski Command Window You give a command to Ski by typing the command name at the keyboard followed by operands and the enter return key Use the help command to see a menu of available commandsor help fol lowed by the command name to see the command syntax XSki displays the command you
137. tead of a greater than symbol and shows the predication register in parentheses Figure 1 18 The Main Window After Reaching the Breakpoint at main 10 Move and resize your windows so the Main Window and Program Window don t overlap Now use the step command or Step button to execute one instruction Note that the greater than symbol moves down one line Ski keeps track of IA 64 bundles and groups but it simulates individual instructions You can follow the step command with a decimal number to specify how many steps Ski should take for example step 10 to execute ten instructions As a shortcut shift clicking on the Step button causes Ski to take ten steps Most Ski commands can be abbreviated as described in 6e Appendix A Command Reference The step command can be abbreviated as s 1 2 11 Changing Registers and Memory To debug a program you usually need to inspect and alter registers and memory The first three panes in the Register Win dow shows the registers of most concern to application programmers user registers in the first pane general registers in the second pane and floating point registers in the third pane as you can see in Figure 1 19 Copyright 2000 Hewlett Packard Co Getting Started A Ski Tutorial 1 13 Ski 1A 64 Simulator Reference Manual 1 0L Registers Window Figure 1 19 The xski Register Window After Stopping at a Breakpoint at main 10 By changing the value o
138. tem for 64 programs or an MS DOS oper ating system for IA 32 programs 6 2 1 Application Mode IA 64 Programs For 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
139. ter shown on the second text line in Figure 3 5 is an example of this 3 2 5 DOCDOCOODOOODO 2007 VHFT Transl atic start DOOOOOODO Ond DOCOOOOODOOOOO DOD6O b cbOOODDOODOODOD DOCODOOODOOOOUOGSODUU K C KO CHCI C 00000000 0 COCO OE Oe OHK UCSDOOODOCODOOODUOO OOOO OOO CE OH ee CE CPM ECHR CGE CHEECH DPE CHKO DOG ODO OCDOCOODOCOOOOO00 CE CC CeO ODO GSH OOH OG CCPC DSO OCC 0200000 0000000 OD 000000000 ipsr pta ida iha idtr iipa ivr irrl eoi irri O00 T SOOO OOO CO OC ASAE CCM Lest 340048 ceogoaopoooegaopooo CH OHC CE 06 dcr pnta Lis iim tpr irrz CHORO CHDOLORORO EI CHERE C CHE EO CO CI CHORO CHEN C CCS COO 0 C0 OCROL COS CODO QUOS ORO COS ASOD CI CHENE Oe DCOODDCODOODUCOUUO CCC CHEB OI CHCEM CHEN OOD CHKO CHO 0G 00 DOCH CIC SATA CHORO CROCI CE CPE CIE I CHO CHO CHCE Ch DOGO DC C CHO OCR IC DOGO 0 CHCE KO DOGO CHERE CI CE OO CCE OC CE Oe CI CR CECE CO HEC CECE DOS 0030 0S0 008900 O0 003000000000 DOD 00000000 EEE CMEC H SOO G00 0000000 UHOOCHOCOOCODOCOODOOO GA 00 Ge DRE CHERE GUOCDCODOG
140. terpreter Examples of comments are in Figure 9 1 9 4 An Example Command File Command files are easy to write The command file in Figure 9 1 for computing Fibonacci numbers was written in less than five minutes and most of that time was spent making the comments correct 9 2 Command Files Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Compute and print Fibonacci numbers from 1 to 50 Initialize variables r10 1 Hold n 2 th value PLL A Hold n 1 th value r12 0 Temporary holding place for n 1 th value r13 0 Loop counter Print out first two Fibonacci numbers initial values of r10 amp 11 eval r10 eval r11 Calculate and print the rest of the numbers The last line has the stopping value of the loop index This is a simple counting loop loop eval rll makes an expression decimal and hex printing r12 r11 Compute n th Fibonacci term rll r11 r10 r10 r12 rl3 r13 1 Increment loop counter if r13 lt 0d50 goto loop Loop again Figure 9 1 An Example Command File to Compute Fibonacci Numbers 9 5 Summary of Command File Commands filename Executes commands in the given command file The file is opened and its contents are executed as if they were entered from the keyboard When the contents of a non nested command file are exhausted xSki and Ski resume keyboard input and bski executes a run command followed by a quit command Whe
141. ters and bits Ski recognizes is in Section B 1 IA 64 Registers 8 1 3 3 Page Allocation Virtual memory is simulated only for system mode programs In system mode your program is responsible for page allo cation In application mode Ski handles page allocation for you Either way if you try to assign data to a non existent page using the assignment commands Ski will refuse with an error message The assignment commands never cause a TLB miss or replacement Copyright 2000 Hewlett Packard Co Debugging 8 3 Ski 1A 64 Simulator Reference Manual 1 0L 8 2 Evaluating Formulas and Formatting Data The eval command evaluates one or more expressions and prints the result s in decimal and hexadecimal An example of the eval command and a more complete discussion are in Section 4 4 1 2 Expressions 8 2 1 Summary of The eval Command eval expression Evaluate the expression s and print the result s on the screen If the expression is simply a register name the value is display in the appropriate format decimal hexadecimal or symbolically depending on the kind of register If the expression has any operators the result is displayed in decimal and hexadecimal For example eval ip causes the current value of the ip register to be displayed symbolically or in hexadecimal But eval ip causes the value to be printed out in hexadecimal and decimal 8 3 Program Breakpoints Program breakpoints are marks within
142. 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 Ski 1A 64 Simulator Reference Manual 1 0L 7 4 Linux and MS DOS ABI Emulation Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L 8 Debugging The simulator provides many facilities to help you debug your programs You can modify the current state of the simu lated processor set program breakpoints trace program execution and dump a memory image into a file 8 1 Changing Registers and Memory with Assignment Commands Use the command to assign a value to a register The command takes two arguments the first is the name of a register and the second is the value to be assigned To change the contents of memory you use one of five different commands depending on whether you want to set a byte two bytes four bytes eight bytes or a C language string a sequence of bytes terminated by a byte with the value zero the null byte The commands are 1 2 4 8 and s respectively Each command takes at least two arguments some take more an address or symbol or e
143. the previous location providing a handy way to swap the display between two different parts of memory See Data Window Commands on page 5 5 db count Move the Data Window backward count lines or one windowful if no count is given See Data Window Com mands on page 5 5 dbndl Display the Data Window contents as instruction bundles See Data Window Commands on page 5 5 dbs address length r w rw Set data breakpoint covering the memory area of length bytes starting at address See Setting Data Breakpoints on page 8 7 dbD Delete all data breakpoints See Deleting Program Breakpoints on page 8 5 dbd breakpoint number Delete data breakpoint breakpoint number Use the dbl command to get a list of all breakpoints and their corre sponding numbers See Deleting Program Breakpoints on page 8 5 dbl Display a list of current data breakpoints See Listing Program Breakpoints on page 8 5 dd starting address ending address filename Dump memory contents to the screen or to the file given by filename The range dumped is between starting address and ending address inclusive The dump is formatted as hexadecimal See Data Window Commands on page 5 5 A 2 Command Reference Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L d count Move the Data Window forward count lines or one windowful if no count is given See Data Window Commands on page 5 5 Dis
144. the executable file Instead the compiler and linker place into the executable file a record of the location and filename of the source code The source code file must be available to Ski in the location recorded in the executable file In practice this means you will want to run XSki or ski from the directory where the program was compiled See Section 3 5 The Program Window for more information on source code compilation This command is valid for IA 64 code only The mnemonic stands for program display mixed Copyright 2000 Hewlett Packard Co Screen Manipulation Commands 5 3 Ski 1A 64 Simulator Reference Manual 1 0L Program Window r33 ar pfs 4 0 1 0 ribi ri r ri 1 32 1 x nop b or rj5serl r adds r s 4B r12 nop b Ux 1 005 printi Hello worldXn mainta IM x mo ris data main 4n nop M Oxo nop br call sptk few b printf lesse Gaio Figure 5 2 xskrs Program Window Showing Intermixed C and IA 64 Assembly Code pd starting_address ending_address filename Dump the assembly language translation of the program in the area between the two addresses inclusive to the screen Ski to a window xski if no filename is given or to the specified file if one is Source code will not be dumped along with the assembly language even if the pm command is given Figure 5 3 shows an example of an assembly
145. the window with operands to their immediate right The template for the bundle is shown as a triplet of capital letters such as MIT to the right of the last operand of the first 3 6 Screen Presentation Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L instruction in the bundle The end of each instruction group a unit of potentially parallel execution is marked with a pair of semicolons after the last operand of the last instruction in the group Program Window Figure 3 9 xsk s Program Window Showing Part of an 1A 64 hello world Program Ski uses the first few columns for source code line numbers Ski also uses the first column to show breakpoint locations for IA 64 assembly language instructions numbering the breakpoints 0 through 9 64 breakpoint commands include bs bd and b1 and are described in Section 8 3 Program Breakpoints For the purpose of setting breakpoint addresses Ski pretends that the slot 0 instruction in a bundle is located at the first byte of the bundle the slot 1 instruc tion is located at the fourth byte and the slot 2 instruction is located at the eighth byte See How Ski Implements Break points on page 8 6 for more information Predication is IA 64 feature that increases the usable parallelism of user programs and allows better utilization of func tional units Ski shows predication information in the second col
146. tion Commands presents the Ski commands for controlling Ski s screen displays Chapter 6 Program Simulation introduces the concepts of Ski program simulation shows you how to load pro grams and presents the Ski commands for simulating a program Much of the information needed to use Ski for firm ware development and operating system simulation is in this chapter Chapter 7 Linux and MS DOS ABI Emulation discusses the Ski mechanisms and support for simulating applica tion programs If you are using Ski for to develop system software such as bootstrap firmware or operating systems you can skip this chapter Chapter 8 Debugging presents Ski commands and facilities that are useful in debugging and tuning programs Chapter 9 Command Files introduces command files a mechanism that lets you extend Ski to meet your particular needs The appendices contain summaries of the Ski command set a list of the registers and internal variables Ski recog nizes and a description of the Ski error and status messages their causes and for error messages possible solutions Copyright 2000 Hewlett Packard Co Getting Started A Ski Tutorial 1 17 Ski 1A 64 Simulator Reference Manual 1 0L 1 18 Getting Started A Ski Tutorial Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L 2 Overview 2 1 Introduction The Ski simulator is a software package designed to functionally simulate the
147. typed in the Command area of the Main Window ski displays the command in the Command Window at the bottom of the screen following the prompt Commands are case sensitive When you hit the enter return key Ski acts on your command and updates the screen to reflect any changes caused by the command For example the command db causes the Data Window to show the contents of lower addresses in memory 4 2 Command Arguments Some commands such as save require additional information If you don t provide the information Ski displays an error message Some commands have optional arguments As described in Syntax Conventions on page iii command sum maries in this manual show optional arguments surrounded by square brackets like this If you don t specify an optional argument Ski uses a suitable default value For example pf 3 causes the Program Window to advance three bundles after the last bundle in the Program Window while pf alone moves the Program Window ahead one windowful Some arguments can be supplied in a list one or more times these are shown by putting a plus sign after the argument name like this For example the syntax description for the 1 command is 1 address_or_symbol value which suggests that the command 1 _ data start 12 56 90 cd assigns the hexadecimal values 12 56 90 and cd to the four bytes starting at the location specified by the symbol data start Brackets and plus signs can b
148. uare root of a negative number This can only happen for IA 64 application mode programs IA 64 system mode programs handle this fault through the interruption mechanism See Chapter 6 Program Simula tion and Interruptions on page 7 1 FP exception trap An IA 64 application mode program caused a floating point trap This trap like all traps stops simulation of appli cation mode programs A trap is different from a fault faults are detected before the machine state is changed for example when an attempt is made to divide by zero Traps are detected after the machine state is changed for exam ple when numeric overflow occurs This can only happen for application mode programs system mode programs handle this trap through the interruption mechanism See Chapter 6 Program Simulation and Chapter 7 1 Inter ruptions goto only allowed inside a command file You tried to execute the goto command from the keyboard The command is only legal within command files See The goto Command and Labels on page 9 1 Halting Simulation Your IA 64 system mode program executed a BREAK 0 instruction at a place where there is no Ski breakpoint See Chapter 8 3 4 1 How Ski Implements Breakpoints and System Mode IA 64 Programs on page 6 2 Copyright 2000 Hewlett Packard Co Simulator Status and Error Messages D 3 Ski 1A 64 Simulator Reference Manual 1 0L help Unknown command s You asked Ski to tell you about a particul
149. umn of the Program Window as shown in Figure 3 10 If the second column of a given instruction line contains an exclamation mark the instruction is predicated on a predi cate register that is currently 0 the instruction is predicated off The predicate register is displayed in parenthesis imme diately to the left of the instruction mnemonic Ski uses a different encoding for the instruction pointed to by the ip register an asterisk indicates that the instruction is predicated off and a greater than symbol gt indicates that the instruction is predicated on That is the gt symbol means This is the next instruction to be simulated Copyright 2000 Hewlett Packard Co Screen Presentation 3 7 Ski 1A 64 Simulator Reference Manual 1 0L Program Window Program start ld r m r nop x at art Hi r Oxi r mtj r x s EE art cmp eq po 0 0 r mop x br cond zptk few start xObDdO ut art ad m Oz movi 9 signal magic cookie at art nap m z mowi rs CE EKK EN 1984 z 8 aba 9 2r amp mop E zr x 5 cstart odo rip M Ora mov r m environ starts 198 r rt nop x mop b Chase Got Help Figure 3 10 xski s Program Window Showing IA 64 Predication and Breakpoints 3 5 2 1 32 Instruction Display 32 instruct
150. variables for you to use in command files see Chapter 9 Command Files These inter nal variables are read only you cannot change their values You can refer to an internal variable in any context where you could refer to an IA 64 register Ski has four internal variables cycles The total number of virtual cycles simulated A virtual cycle is a cycle on a machine with an very large number of execution units and very fast memory a real IA 64 processor may take more cycles In a command file you might use this variable to gather statistics about the efficiency of a particular compiler optimization algorithm The value of cycles is always equal to the value of insts for IA 32 programs exited The value 0 until the simulated program exits Then the variable takes the value 1 In a command file you would use exited to detect a program termination Program termination is defined for IA 64 application mode programs as a call to the exit function or the receipt of an unhandled signal For IA 64 system mode programs normal termi nation is defined to be a call to the Simulator System Call exit function or execution of BREAK 0 instruction This variable is not supported for IA 32 programs in application mode or system mode See Section 6 1 Application Mode and System Mode Simulation for details on these modes heap This variable has meaning only for IA 64 programs running in application mode as described in Section 6 1
151. ved See Saving and Restoring the Simulator State on page 8 8 sdt Show the Data Translation Lookaside Buffer DTLB system mode only See System Mode TLB Simulation on page 6 2 sit Show Instruction Translation Lookaside Buffer ITLB system mode only See System Mode TLB Simulation on page 6 2 sr ski Show the system registers Control Registers Region Registers Debug Registers Protection Key Registers Data Breakpoint Registers Instruction Breakpoint Registers Performance Monitor Configuration Registers Perfor mance Monitor Data Registers in the Register Window See Register Window Commands on page 5 1 xski Toggle the display of the system registers pane See Register Window Commands on page 5 1 symlist filename Write program defined symbols to the screen or to the file given by filename See Symbol Table Commands on page 8 8 Copyright 2000 Hewlett Packard Co Command Reference A 5 Ski 1A 64 Simulator Reference Manual 1 0L ur Ski Show the user registers Predicate Registers Branch Registers Application Registers Instruction Pointer User Mask in the Register Window See Register Window Commands on page 5 1 xski Toggle the display of the user registers pane See Register Window Commands on page 5 1 A 6 Command Reference Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L B Register Names IA 64 registers are fully described in oth
152. w Commands on page 5 1 rb count Moves the Register Window backward scroll up through the currently displayed register set The Register Win dow is scrolled count lines If count is omitted the Register Window scrolls up one windowful less one line i e the first line of the old window is displayed as the last line of the new window Ski only See ski Register Window Commands on page 5 1 filename Dump the Register Window to the screen or to the file given by filename See Register Window Commands on page 5 1 romload filename address mapfile Load an MS DOS com format file for IA 64 IA 32 or mixed system mode simulation address specifies where to load the program mapfile provides Ski with the mapping between program defined symbols and their addresses and must specify an ASCII text file exactly compatible with mapfiles produced by the Microsoft ML linker See How to Load a Program on page 6 3 step count Execute count instructions or if no count is specified one instruction See Program Execution on page 6 5 step until expression without spaces Execute instructions until the expression without spaces has a non zero value See Program Execution on page 6 5 save filename Save the state of a simulated processor in the file given by filename Only the registers and memory of the simulated processor are saved state information private to the simulator such as cycle counts is not sa
153. w Hexadecimal and ASCII 5 6 xski s Hexadecimal Dump Window 5 6 Example Code to Simulate an External Interrupt 6 2 sdt Command Output in XSki 6 3 Copyright 2000 Hewlett Packard Co List of Figures ix Figure 8 1 Figure 8 2 Figure 8 3 Figure 8 4 Figure 8 5 Figure 9 1 Ski 1A 64 Simulator Reference Manual 1 0L The Original Program Loaded in 5 8 2 The Program After Assigning a String in Ski 8 3 Three Breakpoints 0 2 and 1 Visible in XSKf s Program Window 8 5 xsk s Breakpoint List Window Showing IA 64 and IA 32 Breakpoints 8 6 The symlist Output from XSK 8 9 An Example Command File to Compute Fibonacci Numbers 9 3 x List of Figures Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L Table 4 1 Table 7 1 Table 7 2 Table 7 3 List of Tables Ski Simulator Arithmetic and Logic Operators 4 3 Linux System Calls Supported by Si 7 2 Linux System Calls Accepted but Ignored by Ski 7 2 MS DOS System Calls in Hexadecimal Supported by Ski 7 3 Copyright 2000 Hewlett Packard Co List of Tabl
154. xpression resolving to an address and the new value you want placed there 8 1 1 Summary of Assignment Commands register_name value The value is assigned to the register specified by register_name The old value is lost Unless a modifying prefix such as Od Ob or 00 is used value will be treated as a hexadecimal number Floating point registers must be set piecewise using the register name 2 through 127 followed by a s to set the sign m to set the mantissa or e to set the exponent The first general register r0 is hardwired to 0 and any attempt to assign to it will be rejected Similarly floating registers 0 and 1 are hardwired to be 0 0 and 1 0 respectively and predicate register pO is hardwired to and they too cannot be changed Some IA 64 registers are read only according to the IA 64 architecture specification but all non hardwired reg isters are writable with Ski s command to assist your debugging 1 address value 2 address value 4 address value 8 address value The value is assigned to the specified location in memory The old value at the location is lost The location may be on any allocated page including instruction pages as discussed in Section 8 1 3 3 Page Allocation Multiple values separated by spaces may be supplied if so they will be assigned to sequential memory addresses Unless a modifying prefix such as Od Ob or 0o is used value will be treated as a hexad
155. y eight the size of a char on IA 64 To do this you use the eval command in the Main Window as shown in Figure 1 23 The use of the operator was discussed in Section 1 2 4 Inspecting Data As you see the result is shown in decimal and hexadecimal 1 16 Getting Started A Ski Tutorial Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L main O Stol Proof Batol ee zasiel Tua ae Figure 1 23 The xski Main Window Showing an eval Command and Its Result 1 2 12 Getting Help To see what commands are available type help in the Main Window or use the Help gt Commands menu selection To see the syntax of a specific command type help followed by the command name as in help eval 1 2 13 Next Steps Congratulations You now know how to use 5 to test an IA 64 program In the rest of this manual you ll find out how to use Ski and bski and many additional commands and facilities not covered in this brief tutorial Chapter 2 Overview presents the capabilities of Ski how to start it and stop it and a brief discussion of installation issues The chapter also shows how to use bski for batch simulations Chapter 3 Screen Presentation discusses the various screen displays of xSki and ski in depth Chapter 4 Command Language defines the syntax of the language you use to control Ski s operation Chapter 5 Screen Manipula
156. y program ready to run The program will not receive any command line arguments via the argc argv mechanism when you run it To run the simulator as a batch job in the background on an all night run you might execute this command line bski noconsole stats i my commands my program foo bar test data gt out stuff 2 gt bad news amp This invokes the batch bski version of the simulator and loads the IA 64 executable file my program ready to run The noconsole flag tells bski not to create a separate console window for the program s standard I O The program will receive the command line arguments foo and bar via the argc argv mechanism when bski runs it Both the simulator and the program being simulated will have standard in standard out and standard err redirected from to test_data out_stuff and bad_news respectively and the simulator will execute the commands in my commands Ski never reads from standard in so there is no possibility of confusion The stats flag specifies that at the end of the run collected statistics will be output to standard out which is redirected The ampersand amp runs the job in the background 2 5 1 Command Line Flags The simulator accepts certain flags on the command line when you start it up The flags are passed on the command line in 2 4 Overview Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L standard Linux fashion The Ski command line syntax i
157. ymbolic displays are limited to sixteen characters when more than sixteen characters are needed the first fifteen are displayed and an asterisk is added to indicate that the symbolic display has been abbreviated The fields of the Current Frame Marker cfm register and subfields of the Previous Frame Marker field p m are displayed in decimal For bit encoded registers some bits are displayed individually using their A 64 mnemonics If a bit name is displayed in uppercase the bit is currently set and if the name is displayed in lowercase the bit is currently clear For example the psr be bit is shown as BE in Figure 3 2 indicating that the bit is set The User Mask bitfield psrum from the Processor Status Register psr is displayed in this pane the entire psr is shown in the System Registers pane described in Section 3 2 4 The System Registers Pane Predicate Registers pr16 pr63 are displayed in their rotated form as indicated by the rrbp field of the Current Frame Marker cfm register The User Registers Pane At the middle of the pane the line starting clean shows in decimal the values in the internal registers that control the Register Save Engine rse The IA 64 architecture requires that these registers exist but provides no program visible access to them 3 2 Screen Presentation Copyright 2000 Hewlett Packard Co Ski 1A 64 Simulator Reference Manual 1 0L psr um ac up RE OR ip compress pras
158. ymbols and Numbers 4 5 5 Screen Manipulation Commands 5 1 5 1 Register Window Commands 5 1 5 1 1 Summary of Register Window Commands 5 1 5 2 Program Window Commands 5 2 5 2 1 Summary of Program Window Commands 5 2 5 3 Data Window Commands 5 5 5 3 1 Summary of Data Window Commands 5 5 6 Prosram Simulation Yu URN ee Aby uses NEU uelis d 6 1 6 1 Application Mode and System Mode Simulation 6 1 6 2 Ski Support for Application Mode Programs 6 1 6 2 1 Application Mode IA 64 Programs 6 1 6 2 2 Application Mode IA 32 Programs 6 1 6 3 Ski Support for System Mode Programs 6 1 6 3 1 System Mode IA 64 Programs 6 2 6 3 2 System Mode IA 32 Programs 6 2 6 3 3 System Mode TLB Simulation 6 2 6 4 Misaligned Data Access Trap 6 3 Program Eoadimg nt GAM up chine ad EO 6 3 6 5 1 How
159. ytes ecx is four bytes wide with cx as the two least significant bytes cmcv IA 64 Corrected Machine Check Vector Register crO cr127 IA 64 Control Registers cs IA 32 Code Segment Register csd IA 32 Code Segment Register Descriptor dbrO dbr15 IA 64 Data Breakpoint Registers der IA 64 Default Control Register dh dx edx IA 32 Registers dl and dh are byte wide dx is dl and dh taken together as two bytes edx is four bytes wide with dx as the two least significant bytes di edi IA 32 Arithmetic Registers di is two bytes wide edi is four bytes wide with di as the two least significant bytes ds IA 32 Data Segment Register dsd IA 32 Data Segment Register Descriptor ec IA 64 Epilog Count Register eflags IA 32 Flags Register eflags ac IA 32 Alignment Check bit eflags af IA 32 Auxiliary Carry Flag bit also called the IA 32 Adjust Flag bit eflags be IA 32 Below Equal Flag bit eflags cf IA 32 Carry Flag bit Copyright 2000 Hewlett Packard Co Register Names 1 eflags df eflags id eflags if eflags iopl eflags le eflags lt eflags nt eflags of eflags pf eflags rf eflags sf eflags tf eflags vm eflags zf eoi es esd esp Ski 1A 64 Simulator Reference Manual 1 0L IA 32 Direction Flag bit IA 32 ID Flag bit IA 32 Interruption Flag bit IA 32 I O Privilege Level bit IA 32 Less Equal Flag bit IA 32 Less Than Flag bit IA 32 Nested Task bit IA 32 Overflow Flag bit IA 32 Parity Flag bit IA 32 Resum

Download Pdf Manuals

image

Related Search

Related Contents

  SONY If product design awards  公共建築整備マニュアル 千葉市  SZ-10/SZ-20  Toro INFINITY 35-6/55-6 Sell Sheet      

Copyright © All rights reserved.
Failed to retrieve file