24.05.2014 Views

AIX Version 4.3 Differences Guide

AIX Version 4.3 Differences Guide

AIX Version 4.3 Differences Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

name of the 32-bit system call. If a particular 32-bit system call is named bletch(),<br />

then:<br />

• The name of the C language routine in libc64.a that intercepts 64-bit calls to<br />

bletch() is precisely that: bletch. Note that the kernel does not export a symbol<br />

named bletch to 64-bit-mode processes, so all 64-bit calls to that label reach<br />

the library routine.<br />

• The C language routine library, at the point where it needs to invoke the kernel<br />

extension routine for this system call, calls __bletch() (two leading<br />

underscores). This is an assembly-language glue routine reached through the<br />

branch-and-link instruction. The name of its actual entry point will be .__bletch<br />

(leading period).<br />

• The glue routine, still in the 64-bit library, loads an entry from the TOC and<br />

issues a system call instruction. The TOC entry is assembled as a pointer to<br />

bletch64 (no prefix, suffix 64).<br />

• The kernel extension routine is named bletch64(), and this is the name that<br />

the kernel extension exports as a syscall. The kernel extension routine will<br />

itself call bletch() the existing 32-bit kernel service.<br />

The reason for the two underscores is for conformance with ANSI C, which<br />

reserves names not starting with two underscores (or one underscore and a<br />

capital letter) for the user, except for existing non-conforming UNIX names that<br />

are grandfathered. All external symbols in libc64.a must begin with two<br />

underscores.<br />

3.2.2.1 64-Bit to 32-Bit Data Reformatting<br />

The goal of the 64-bit interface is to make it appear to the kernel that the system<br />

service request came from a 32-bit program. To this end, the width of any data<br />

passed across the interface in either direction must be adjusted to match the<br />

expected size.<br />

Data reformatting is done by the 64-bit library routine that is the call target of<br />

64-bit system calls. It receives 64-bit data from the caller, does any necessary<br />

reformatting to 32-bit data, and calls its corresponding kernel extension routine<br />

that passes the (now 32-bit) data on to the kernel's system call service routine.<br />

On completion of the system call, a return code is (generally) passed back. In<br />

addition, the kernel may have passed data back in user space. When the library<br />

routine regains control, it expands the return code from 32 bits to 64 and expands<br />

any returned data in user space.<br />

For scalar parameters, the library does the following before calling the kernel<br />

extension routine:<br />

• char, unsigned char - Passed without change.<br />

• short, unsigned short - Passed without change.<br />

• int, unsigned int, long, unsigned long - Tested to make sure that the value<br />

being passed will fit in the 32-bit version of int or unsigned int. A value that is<br />

too large generally results in setting errno to EINVAL and returning a return<br />

code of -1. Values that are not too large are passed as 32-bit integers.<br />

Note: Integers that are larger than 2 32 are valid in some cases. For example,<br />

the lseek() routine takes an off_t (that is a long) as the seek position, a value<br />

64-Bit Enablement 39

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!