B.2 System Software

We developed many examples in this book using computer systems that were already set up and being utilized for other purposes. No other special modifications were necessary.

All of the learners obviously need to know either the fully qualified domain name of the form computer.department.organization.tld or the IP number of the form nnn.nnn.nnn.nnn for the Itanium host.

Everyone should have a personal account. Ordinary individual user accounts with no special privileges are entirely suitable for the programming exercises suggested in this book. It may also be worthwhile to establish a group library account if some work will start from template or data files.

B.2.1 Linux

While working on this book, we used various systems running with different distributions of Linux (Red Hat, SuSE®) and different versions (2.96 and 3.0) of the suite of GNU command-line programming tools available for Itanium systems, including gcc, the C compiler and assembler combination, and g77, the FORTRAN compiler.

It is helpful to run a shell, like bash or tcsh, that supports shell command replay using the up-arrow key. One of these is usually part of a Linux distribution.

On one system, we also had access to version 5 of Intel's Linux-compatible C compiler and assembler combination (ecc) and Fortran95 compiler (efc), both of which also make use of Intel's assembler (ias). Note: efc produces warning messages about INTEGER*8 declarations. It would prefer INTEGER(8) as the syntax, but we did not make that change for the sake of retaining source code acceptability with other FORTRAN compilers that we were using.

Open-source routines from Intel Corporation

In some of our sample programs, we use integer division and remainder routines that are available on the Internet:

http://developer.intel.com/software/products/opensource/

Our readers may be especially interested in three packages: divide, square root, and remainder (num.htm); optimized mathematical functions (num.htm); and string and memory functions (opti.htm).

B.2.2 HP-UX

While working on this book, we used various systems running with Hewlett-Packard's HP-UX. It would be helpful to run a shell, like tcsh, that supports shell command replay using the up-arrow key. This shell can be downloaded:

http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,575,00.html

Installing tcsh may require privilege.

Compilers (assemblers) and debuggers

You should have the whole suite of standard Unix command-line programming tools available, including (if possible) additional high-level language compilers beyond the C compiler and assembler combination (cc).

Some Hewlett-Packard systems may be delivered only with cc_bundled, a C compiler with limited capabilities and options that is sufficient for installing and maintaining the system software. Though minimal, cc_bundled should assemble and link virtually all of the programs shown in this book, but it does not offer any levels of optimization for study. Note: If you have only the cc_bundled compiler, then you will probably have only the adb command-line debugger, but a version of gdb is also freely available from HP.

We had access to one version or another of Hewlett-Packard's separately licensed compilers called C/ANSI C (cc), aC++ (aCC -Ae for C or assembly programs), and Fortran90 (f90). Your system software or these licensed compilers may include a graphical interface debugger called wdb, which also provides the command-line gdb debugger.

Pointer lengths

During a transitional period that began with the evolution from 32- to 64-bit PA-RISC processors, Hewlett-Packard set its compilers by default to a data model called ILP32, where a long variable and a pointer in the C language are both 32-bit quantities, and where the file command reports the type of a linked executable file as ELF-32.

Over time, Hewlett-Packard expects that its customer base will adopt a newer data model called LP64, where a long variable and a pointer in the C language are both 64-bit quantities, and where the file command reports the type of a linked executable file as ELF-64.

The +DD64 command-line option requests each high-level language compiler to produce an ELF-64 executable file, which is most comparable to the Linux examples that are shown in this book.

B.2.3 The Ski Simulator

Hewlett-Packard Company developed a freeware simulator called Ski and a Native User Environment (NUE) that permit exploration of Itanium applications on a Linux/x86 (IA-32) workstation.

Ski emulates the sequential execution of Itanium instructions, not the potentially parallel execution of instructions in a group from one or two bundles. Thus Ski emulates the architecture, not any particular implementation. There are other differences between the NUE and a truly native Linux/Itanium environment.

Ski contains proprietary Hewlett-Packard code, while NUE was produced under terms of the GNU public license. Both components can be downloaded:

http://www.software.hp.com/products/LIA64/

One of the files is over 100 MiB. Hewlett-Packard has also offered a no-cost CD-ROM. While the simulator has also been offered through the Intel Web site, we caution that the version available there has sometimes not been as up-to-date as that through the Hewlett-Packard Web site.

Installation

After finding the most recent versions, operate from the root account on the Linux system to unpack the tar file and install the rpm packages. Assuming that the files are in the root directory itself, the process will go something like this:

 IF you downloaded the software, do this: root> tar -xvf nue-version.tar [possible messages] ELSE IF you obtained a CD-ROM with the software, do this: root> cd /mnt/cdrom/RPMS ENDIF in either situation, do this: root> rpm -Uhv ski-version.i386.rpm root> rpm -Uhv nue-version.i386.rpm root> rpm -Uhv nue-fs-version.i386.rpm [we ignored a message about user gdm and group gdm] created root created user root> 

where version designates each respective software version. The messages refer to creating the directory /nue/root and additional directories of the form /nue/home/user for any existing nonroot users of the Linux system. If you create accounts later for more Linux users who will also use NUE, you would need to log in as root again and create a directory for NUE for each user:

 root> mkdir /nue/home/user2 root> chown user2 /nue/home/user2 root> chgrp user2 /nue/home/user2                  [or desired group] root> chmod 750 /nue/home/user2               [or desired protection] [similarly for user3, etc.] root> 

Documentation is placed into /usr/doc subdirectories ski-version and nue-version. The file ski-manual.pdf is about 100 pages in length.

Entering and leaving NUE

When you enter NUE, the default shell is bash, but several other available shells are ash, ksh, tcsh, and zsh.

 L> nue                              [enter NUE; default shell is bash] bash$ ksh                                              [change to ksh] $ exit                                       [return to default shell] bash$ tcsh                                            [change to tcsh] > exit                                       [return to default shell] bash$ exit                                  [exit from NUE completely] L> 

A request for bsh will be aliased to ash, csh to tcsh, and sh to bash.

Visibility of directories and files

While you are in NUE, all directory references will actually be rooted at /nue of the Linux system. Your own directory in NUE, which is /nue/home/user, will initially seem to be empty. You cannot readily look outside of NUE to your real home directory, such as /home/user, or to any mounted media. Nevertheless, you can access your NUE directory from outside the NUE environment and place files into that directory from your normal shell. If you perform a get operation for ftp transfer while in NUE, however, the files will come into your NUE directory.

Compiling and running a program with Ski in NUE

Write a brief C program and place it into your NUE directory. Then proceed as follows:

 L> nue bash$ gcc -o prog prog.c bash$ ./prog [First-time license agreement message; you must say 'yes'] [program output] bash$ 

Here ./ looks for the executable program in the current directory. You can insert printf statements into a C program for debugging purposes.

Debugging an assembly language program with Ski in NUE.

Like a command-line debugger, Ski provides access to symbolic labels like sq1 or done in the SQUARES program (Figure 1-3). You can set breakpoints, run the program, and find items in the data segment quite easily. When launched with the xski command, Ski uses support from the X Window System™ in the Linux environment to establish separate windows for code, commands, registers, and results.

As an example, assume that you have previously moved squares.s into your NUE directory, /nue/home/user. Then you could proceed as follows:

 L> startx       [start X windows if you're not there already] L> [now bring up a terminal window] L> xhost +localhost                [enable X windows for NUE] L> nue bash> gcc -Wall -O0 -o bin/squares squares.s       [assemble] bash> DISPLAY=localhost:0         [define a display location] bash> export DISPLAY           [direct X windows accordingly] bash> xski bin/squares                           [launch Ski] xski> bs done                      [set breakpoint at 'done'] xski> run          [simulate running on an Itanium processor] xski> dj sq1             [see the results in the data window] xski> q               [quitting removes all the xski windows] bash> 

where L> is the ordinary Linux prompt, bash> is the prompt within NUE, and xski> indicates what you should enter into Ski's command window. All the other Ski windows display their results dynamically.

You should see the values 1, 4, and 9 that the program computed for the squares of the first three integers. Compare this functionality with the use of the Itanium-native gdb debugger, as demonstrated in Section 3.8.2.

B.2.4 64-Bit Windows®

Triebel, Bissell, and Booth have written about development of Itanium applications using Intel or Microsoft compilers within the Microsoft Integrated Development Environment. Such tools support development for 64-bit Windows, either in a native Itanium environment or on an IA-32 system using cross-compilation. An Intel visual debugger offers capabilities similar to those of the Hewlett-Packard Ski simulator (Appendix B.2.3) for an IA-32 Linux development platform.

The Intel compilers and assembler for 64-bit Windows are comparable to those for 64-bit Linux. Our book could be used in conjunction with the book by Triebel, Bissell, and Booth to study Itanium assembly language and the behavior of high-level language compilers. Sample programs in this book that incorporate calls to Linux/HP-UX library routines would require appropriate substitutions.

B.2.5 FreeBSD

Historically, Berkeley Unix (BSD®) has been ported to a wider range of computer architectures than any other operating system. FreeBSD was the first of several commercial and freely available variants of BSD Unix to begin an active project porting the operating system to Itanium architecture. The following Web site contains links to this and other BSD variants:

http://www.bsd.org/

B.2.6 OpenVMS®

Prior to its merger with Hewlett-Packard Company, Compaq Corporation had announced intentions to port the OpenVMS operating system and programming environment from Alpha hardware to Itanium systems, but the timetable for that effort did not meet the constraints for producing this book. Further information may be available at:

http://h18000.www1.hp.com/hps/ipf-enterprise/openvms.html



ItaniumR Architecture for Programmers. Understanding 64-Bit Processors and EPIC Principles
ItaniumR Architecture for Programmers. Understanding 64-Bit Processors and EPIC Principles
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 223

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net