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 addr struct is a library-side structure that holds the information relevant to the<br />

remapping of the address of a single 64-bit area. It also holds the size of the<br />

structure pointed to. Segment crossings are allowed for items in the addr struct,<br />

with the limitation that a single item to remap may not be contained in more than<br />

fifteen segments. This limits the maximum size of an object to be remapped to<br />

3.75 GB, assuming that it is aligned to a segment boundary.<br />

The uremap struct is a library-side structure that consists of an array of addr<br />

structs and an integer giving the size of the array. In the general case, the<br />

number of entries can be quite large, such as the number of addresses of<br />

environment variables passed on execve(). The size is set at 17 in the structure<br />

definition to cover cases that need to pass this many addresses (writev() is one<br />

such case). Cases with more than 17 addresses require individually-constructed<br />

structs similar to uremap or just the C-allowed use of an index greater than an<br />

array-size, with appropriate storage malloc()’d by the caller. The naddr field of the<br />

uremap struct can accommodate large numbers of addr structs input. The point is<br />

that __remap() is not limited to 17 addresses to remap on one call. It can accept<br />

a large quantity. As of this writing, the upper bound has not been set. The number<br />

17 was specifically arrived at from the iovec struct. 17 is iovcnt+1 to allow for the<br />

vectors plus the address of the structure itself.<br />

The remap struct is the basic data structure used to communicate remapping<br />

information from the library side to the kernel extension. A single remap struct<br />

contains an unremapped 64-bit address (actually ESID), and additionally, the low<br />

bits of a remap struct (address) also have meaning. This will be discussed later.<br />

The kremap struct is an array of remap structs plus an integer giving the number<br />

of array elements actually used. In the general case, this structure is passed by<br />

the library side to the kernel extension, which accesses it through copyin64(). The<br />

elements of the r[.] array represent up to fifteen unremapped 64-bit addresses.<br />

The remapping code gets the right answer implicitly by making sure that the<br />

library remap code and the kernel remap code allocate srnos in the same order<br />

while processing the kremap struct. It is particularly important, for segment<br />

crossings, that adjacent segments become allocated in the kernel as needed.<br />

The r_xingcnt field in the remap struct is used to indicate the number of segments<br />

that a particular mapping crosses, so the segments may be created adjacently.<br />

It is important not to confuse the uremap and kremap structures. The uremap<br />

structures are where the full 64-bit to 32-bit address translations are kept for each<br />

64-bit address remapped. The kremap structs are passed to the kernel and<br />

indicate on a segment-basis which 64-bit ESIDs are remapped to which 32-bit<br />

sreg numbers. The mapping of entries in a uremap struct to entries in a kremap<br />

struct is typically many-to-one. For example, two pointers in the same ESID will<br />

create two uremap entries and one kremap entry.<br />

3.2.2.4 Remap Library Programming Interfaces<br />

The remap library services set up the remap data structures to be passed to the<br />

kernel remap services. There are three library remapping interfaces:<br />

union __remap_handle __remap(struct uremap *up, struct kremap *kp)<br />

struct remap __remap1(struct addr *ua)<br />

void __remap2(struct addr *ua, struct kremap *kp)<br />

42 <strong>AIX</strong> <strong>Version</strong> <strong>4.3</strong> <strong>Differences</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!