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.

and an execution environment. The 64-bit XCOFF magic number implies a 64-bit<br />

PowerPC processor and 64-bit execution mode on that processor.<br />

The magic number keeps the linkage editor from binding 64-bit programs with<br />

32-bit programs and keeps the loader from trying to execute 64-bit programs on<br />

32-bit hardware.<br />

The magic number is defined in the header file /usr/include/filehdr.h and has the<br />

name U803XTOCMAGIC with the value 0757.<br />

3.2.4 Device Drivers<br />

<strong>AIX</strong> <strong>4.3</strong> supports 64-bit applications on 64-bit PowerPC hosts in addition to<br />

maintaining support for 32-bit applications on all other supported hosts. Thus, on<br />

64-bit hosts, both 32-bit and 64-bit applications can run simultaneously. To<br />

minimize the impact of adding 64-bit support, the kernel continues to run in 32-bit<br />

mode but provides interfaces to 64-bit applications by remapping the 64-bit<br />

application space address into a 32-bit address for the kernel. Thus, the following<br />

is true for device drivers in general and I/O drivers specifically:<br />

• 32-bit versions of device drivers will operate correctly without change on <strong>AIX</strong><br />

<strong>Version</strong> <strong>4.3</strong> in support of 32-bit applications.<br />

• 64-bit applications require modification of only the entry points (such as<br />

ioctl()s) for proper operation.<br />

The 4/8/8 model requires two primary changes for an I/O device driver:<br />

• Providing ioctl support for 64-bit applications.<br />

• Ensuring that structures describing fixed sized entities are size-invariant<br />

between both 32-bit and 64-bit applications.<br />

3.2.4.1 Changes to ioctl()<br />

The third argument of an ioctl call is referred to as the arg parameter. For some<br />

ioctls, the arg parameter can be a pointer. For <strong>AIX</strong> <strong>4.3</strong>, the kernel guarantees that<br />

the arg parameter received by a device driver is always a 32-bit value. For 64-bit<br />

applications, the kernel will remap the address to a 32-bit address. Often, the arg<br />

parameter is a pointer to a data structure that may contain additional pointers.<br />

The kernel has no knowledge of this and, as a result, it is the device driver's<br />

responsibility to interpret these correctly. Device drivers that support 64-bit<br />

embedded pointers need to notify the kernel of this by setting the DEV_64BIT<br />

define for the d_opts flag passed to the devswadd() call from the config entry<br />

point of the device driver. For example a 64-bit-enabled SMP driver would use the<br />

following code segment:<br />

devsw_struct.d_opts = DEV_MPSAFE | DEV_64BIT;<br />

devswadd(devno,&devsw_struct);<br />

For device drivers that do not set the DEV_64BIT flag, all ioctls from 64-bit<br />

applications will fail with an errno of EINVAL.<br />

Since data structures with embedded pointers cannot remain size-invariant<br />

between 32-bit and 64-bit applications, a 64-bit-enabled device driver will need to<br />

maintain an internal-use-only 64-bit equivalent (recall the device driver will be<br />

compiled for 32-bit mode) of all such structures that can be passed as arg<br />

parameters. This can be accomplished by cloning the structure definition and<br />

replacing all pointers with type ptr64 (defined in types.h as unsigned long long).<br />

64-Bit Enablement 49

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

Saved successfully!

Ooh no, something went wrong!