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.

Three interfaces exist, rather than just one, to improve performance on<br />

remapping. For the case of syscalls that require only one or two parameters to be<br />

remapped, the parameters may be passed in registers. This avoids the copyin()<br />

to the kernel by remap_64() of a kremap struct and is a significant performance<br />

saving. So, __remap1() or __remap2() should be used when only one or two<br />

parameters require remapping, respectively. The __remap() call should be used<br />

for syscalls requiring three or more remappings.<br />

Like other things in 64-bit libc.a, __remap() is only available to applications<br />

running in 64-bit mode and linked with the correct library. The input to __remap()<br />

are the 64-bit addresses to remap in the addr structs (in uremap). The __remap()<br />

code fills in the addr structs with remapped 32-bit addresses. It also fills in the<br />

kremap struct with the 64-bit ESIDs in the slot corresponding to the 32-bit sreg<br />

number that __remap() picked for the remapping. Slot 0 of the kremap struct<br />

corresponds to 32-bit sreg 1. This is because sreg 0 is never given out for<br />

reasons previously stated having to do with NULL pointers. As such, only fifteen<br />

different segments can be remapped with one kremap struct.<br />

There is no formal provision at the moment for remapping a given user-mode<br />

address to a specific remapped address specified by the library. It is expected<br />

that applications can avoid dependencies such as this. In the event that this is not<br />

possible, two alternatives exist; add a new force-remap service, or create a<br />

kremap structure with the specified remapping as though it had already been<br />

processed by __remap().<br />

3.2.2.5 Remap Optimization for Multiple Addresses<br />

If more than one item must be remapped, there is a folding optimization done by<br />

__remap(). For the second, and subsequent addresses in the uremap struct,<br />

__remap() determines whether the ESID of the address being operated on has<br />

already been remapped. If so, there is no need to make another kremap entry for<br />

it.<br />

The preceding works fine for circumstances where segment crossings are not<br />

involved. It does, however, become complicated when you put<br />

segment-crossings into the equation. Assume that __remap() is to process the<br />

uremap struct in array-order. The addresses will not be sorted. Also assume that<br />

the first parameter, which does not cross a segment boundary and resides in<br />

64-bit ESID 3, becomes remapped to 32-bit srno 1. If the second parameter does<br />

cross a segment boundary and starts at 64-bit ESID 2, in the absence of any<br />

special optimizations, this second parameter would have to be remapped to<br />

32-bit srnos 2 and 3 (0 is unavailable for use). Note that the second parameter<br />

must occupy adjacent 32-bit segments.<br />

There are several ways around this problem. One way is to have __remap()<br />

presort the input addr structs by ascending address, but this could get expensive,<br />

since it could have a virtually unbounded number of input address structures to<br />

process. The actual __remap() implementation is a two-pass method. The first<br />

pass (for a majority of the cases) takes a simple approach. In the preceding<br />

example, it would simply associate the 32-bit srnos 1, 2, and 3 as explained. As<br />

long as the rest of the remappings fit in the maximum fifteen slots that are<br />

available, this is not a problem, and there is no expensive sorting or<br />

post-processing required. The simple first pass will do folding only as far as<br />

checking to see if the 64-bit ESID has been remapped.<br />

64-Bit Enablement 43

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

Saved successfully!

Ooh no, something went wrong!