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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

• The shared memory allocator internally allocates anywhere in the address<br />

space. The reason for this is that other areas of the kernel, for example the<br />

loader, need to insert segments at ESIDs greater than 0x80000000.<br />

Therefore, shm_insert() is allowed to insert anywhere, but the higher-level<br />

user-interfaces perform the validation for the user level.<br />

Shared Memory User and Exported Kernel Programming Interfaces<br />

The shared memory component has numerous system calls surfaced to the user.<br />

All of these system calls are registered in the 64-bit libc.a and the 64-bit kernel<br />

extension. The following is the list of the 32-bit shared memory system calls:<br />

void* shmat(int shmid, const void *address, int shmflag)<br />

int shmctl(int shmid, int command, struct shmid_ds *buffer)<br />

int shmdt(const void *address)<br />

int shmget(key_t key, size_t size, int shmflag)<br />

int disclaim(char *address, uint len, uint flag)<br />

The following are the new, 64-bit-ready interfaces for the shared memory<br />

services. These interfaces are called directly from the 64-bit kernel extensions<br />

only:<br />

ptr64<br />

int<br />

int<br />

_shmat64(int shmid, ptr64 address, int shmflag)<br />

_shmdt64(ptr64 address)<br />

_disclaim64(ptr64 addr,unsigned len,unsigned flag)<br />

The _shmat64(), _shmdt64(), and _disclaim64() calls do not require parameter<br />

remapping, since they are 64-bit-enabled. They do, however, require 64-bit libc.a<br />

to split their address parameters into two adjacent general purpose registers for<br />

processing in 32-bit mode. the shmctl() call does require parameter remapping on<br />

the pointer to the shmid_ds. Additionally, shmget() takes a size_t as input. This<br />

typedef is an unsigned long, which has different widths in 32-bit and 64-bit<br />

programs.<br />

The prototype to shmget() will not change for 64 bits. The low 32 bits of the 64-bit<br />

size will be passed to the kernel, with the size being range-checked for 32 bits in<br />

the library-side. There will be no increase in size of the supported memory region.<br />

The key_t parameter to shmget() is currently a long. It will be changed to always<br />

be an int. This will be true for 32-bit and 64-bit code to make it invariant. This<br />

allows predictable message-passing between 32-bit and 64-bit processes.<br />

3.2.6.4 User Data and Stack Management<br />

The 32-bit programming interfaces for adjusting a program's data size are brk()<br />

and sbrk():<br />

int brk(void *enddatasegment)<br />

void * sbrk(int increment)<br />

There is a change to the sbrk() interface required by 64-bit mode and UNIX98<br />

standards. For UNIX98, sbrk() needs to take a long on input.<br />

This poses a breakage for those who want to have the UNIX95-behavior of sbrk()<br />

that obeys the preceding prototype, taking an int in 64-bit mode. The problem is<br />

that the 64-bit library wrapper for sbrk() has no way of determining whether it was<br />

passed a 32-bit value or a 64-bit value. The compiler will not ensure that the high<br />

32-bits of a register are 0 for int's. Since most programmers going to 64-bit with<br />

their applications will require some porting effort to do so, changing sbrk() to the<br />

64-Bit Enablement 55

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

Saved successfully!

Ooh no, something went wrong!