SUMMARY:
ILIBC_64 - Selected independent IA-64 procedures from the standard C library. Distribution zip file includes sources, Makefiles, and limited documentation.

NEW LIBRARY CONTENTS.
Features of the original ilib.zip 16 bit x86 library are now implemented in another library. This library now contains an Itanium IA-64 version of the ilibc.zip library. Eventually, this "new" ilib.zip library will be relocated to a more appropriate location.

NOT A REPLACEMENT FOR INTEL LIBRARY.
Intel provides optimized IA-64 assembly language implementations of memcpy.S, memset.S, strcat.S, strcmp.S, strcpy.S, strlen.S, which now include recovery code. If you are looking for these, they may be downloaded via Intel opensource web site. The ilibc_64 library contains a larger set of standard (mostly) C library procedures, all implemented as independent procedures that do not directly call any other procedure. Intel documentation refers to these type of procedures as leaf procedures.

ASSUMPTIONS CONCERNING REGISTER USAGE.
The IA-64 Software Conventions and Runtime Architecture Guide partitions general registers r0-r31. As part of the partitioning scheme scratch r8-r11 are the procedure return value, and scratch r14-r31 are available for use. Scratch registers are caller save, which means, among other things, that the C compiler saves them prior to making the procedure call, and restores them after the call returns. The assembly language programmer writing _cdecl procedures can use any of these scratch registers without having to restore them. However, an assembly language programmer calling a _cdecl procedure must save them. In order to simplify the assembly language programmers call preparation, the scratch registers r14-r31 are subdivided further into a r14-r27 region, and a r28-r31 region. The assembly language programmer may assume  r14-r27 are preserved within the library procedures, and that r28-r31 may be either scratch or preserved. Check each individual library procedure to determine which, if any, are considered scratch, and which are preserved.
The return scratch registers r8-r11 are used to return procedure values. Almost all library procedures use r9-r11, and return their values in r8. The assembly language programmer may not assume that r9-r11 are preserved within the library procedures.
These assumptions maintain full compatibility with the C compiler, but simplify the assembly language programmers library call preparation.
If a procedure returns void, the library procedure still considers r8, r9, r10, r11 as scratch.

ASSUMPTIONS CONCERNING THE REGISTER AND MEMORY STACK.
Each library procedure uses the caller stack, and the default register stack. When the library procedure is called with br.call, the callers register stack output registers  become the callees output registers. Within the library procedures, no alloc statement is used to re-allocate the register stack. Also, the current memory stack is not altered, and not used unless specifically stated. The br.call instruction also saves and restores ar.lc.

DEVELOPMENT SYSTEM USED.
Red Hat Linux 7.0 ISBN 1-58569-103-8
Standard Pentium II (233MHz) system, with AGP video card, 17 inch monitor.
IA_64 Linux Developer's Kit PN LINUXDEV4A-10004.
 xski, IA-64 Simulator, Hewlett-Packard Co.
 gcc version 2.96-ia64-000717 snap 001117.
 GNU ld version 2.9-ia64-000717 (with BFD 2.9-ia64-000717).
 GNU assembler version 2.9-ia64-000717 (ia64-hp-linux).
 GNU Make version 3.79.1.
 GNU ar 2.9-ia64-000717
According to file, the following image file type is produced:
ELF 64-bit LSB executable, IA-64, version 1, statically linked, not stripped

INSTALLING AND USING THE TOOLS/ IA-64 LINUX DEVELOPERS KIT.
Sometimes the simplest solution is the best solution, especially when approaching new situations. If a new installation for RH7 is required to run the tools, then the simplest disk partition strategy is to use fdisk to create three partitions. The first partition should be max dos size ~2GB. The second partition should be double your ram, or about 128MB. The third partition should be the remaining size of the disk. Create as an extended partition, and then allocate that extended partition as one logical drive. Before exiting fdisk, change the type of the second partition to linux swap. After saving changes and exiting fdisk, use disk druid to assign volumes. The first partition should be  assigned /usr, and the third assigned /. Linux security experts note that this type of setup opens up a large number of security risks, but as a first try, it will work and get you going. At the end of the setup, select install everything. 
After installing RH7, as root, install the IA-64 Linux Developer's Kit as per README instructions.
Once in xwindows (the gnome manager is default) log in as a user (not as root!) start a terminal window and type:

DISPLAY=localhost:0
export DISPLAY
xhost +localhost
nue

and the IA-64 simulator should start, and bash$ prompt should appear.
The above commands are required for xski to run properly.

TRANSFERRING THE LIBRARY INTO THE SIMULATOR
The default install location for the IA-64 simulator is the /nue directory. As part of the install process, all currently defined users are transferred to the simulator. If your user account is foo, then your normal home directory is /home/foo, and the simulator install process will create /nue/home/foo, which will be your new home directory after the simulator starts up. Prior to starting the simulator, place the zip file into the /nue/home/foo directory, and unzip it. Upon entry into the simulator, the "new" home directory, ~/, will now contain the project.

BUILDING THE LIBRARY.
The library was zipped using zip 2.3. Use unzip (5.41 works) to decompress the library. Pkzip and zip are compatible.

Edit Makefile.g as necessary.
type
bash$make clean all install

The make clean process:
Creates the debug and release directory structures.
Removes all unnecessary files.

The make all process:
Creates two libraries - release/libilibc_64.a and debug/libilibcd64.a

The install process:
Places them and the appropriate include files into:
INCLUDE_C_DIR/ilibc_64
INCLUDE_ASM_DIR/ilibc_64
LIB_DIR/lib

Removing the library after install.
make install_clean
(assuming Makefile.g has not been altered,) removes the libraries, and deletes the include directories.

LINKING TO THE LIBRARY.
The easiest way to link with the library is to place the library archive on the gcc command line as if it were an object file. This way, gcc will select the library procedures instead of the default system library procedures.

Prior to including the ilibc_64/*.h files in source code, define
_DEFINED_SIZE_T if size_t has already been defined in another system *.h file.

Prior to including the ilibc_64/*.h files in source code, define the variables exactly as they were defined to build the library.

Finally, these procedures have only been tested , archived, and linked with, using the default values, from within the provided simulator. As Itanium II hardware becomes available, the library will be moved from simulation to implementation.

GENERAL
Independent means that each procedure included in ilibc_64.a is completely independent of any other procedure. Most C library procedures are dependent on other library procedures, computer hardware, BIOS, and may require initialization. Because each ilibc_64.a procedure is independent, no initialization is required, and each individual procedure may be included as required in an application. Programmers developing applications requiring independent procedures should appreciate ilibc_64.a. Due to the independent nature of each procedure, only a subset of the standard C library may be implemented. As demand warrants, and/or as they are completed, and/or as they are donated, procedures that may be implemented as independent will be added to ilibc_64.a. Contributions gladly accepted, especially sprintf and sscanf.

DOCUMENTATION:
See the Run-Time Library Reference manual for each individual procedure. Except where noted, ilibc_64.a procedure parameters and return values are identical.

POINTERS TO PROCEDURES
Pointers to procedures may be built into the library by specifying ILIBC_64_EXTERN_PTRS=1. A pointer to each member procedure is placed into the global .data segment.

POINTERS TO PROCEDURES NAMING CONVENTION
The nameing convention for the pointers is as follows; The complete name is prefixed with p_fn_.

POINTERS TO PROCEDURES NAMING CONVENTION EXAMPLE
p_fn_strlen is the __cdecl pointer to strlen.

COPYRIGHT INFORMATION:
All work, including, but not limited to, source files, make files, documentation files, project organization, included herein the distribution are copyrighted by the author. Commercial use and commercial distribution of this library, or any portion of code, documentation, or files, without the prior written permission of the author is prohibited. Library may only be distributed for personal non commercial use, in original zip format, by the simtel network. This copyright information includes all legal interpretations, but intends to specifically prohibit using this library, without negotiating a separate license agreement with the author, as part of any commercial application that results in, either direct or indirect, net or gross financial gain by the commercial user.

DISCLAIMER
No warranty, expressed or implied, is given concerning the functionality or operability of the code included in this distribution. In fact, many code portions may require debugging.

CONTACT INFORMATION:
email:
bkyoung@cwnet.com

Address:
Byron Young
2351 Woodthrush Way
Pleasanton, CA 94566

BUGS
Bug reports gladly accepted, and are appreciated.

REVISIONS
Release_04 12/14/2002 ilib_04.zip
Project retargeted to IA-64.
Rewrote all sources for IA-64 gcc/as interface, ia-64 simulator.
Rewrote all Makefiles for gnu make.
Procedures work with simple test cases.
More complex test cases may be required.

Release_03 09/14/2002 ilib_03.zip
Major project reorganization. New Makefiles, source directories.
Added test sources to project.

Release_02 09/14/2002 ilib_02.zip
Fastcall functions debugged.
Numerous bug fixes in other functions.

Release_01 09/04/2002 ilib_01.zip
Initial Release.












