[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

__remap Subroutine

Purpose

Remap 64-bit addresses into 32-bit addresses.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/remap.h>
int __remap(uvp, kp, hp, nparms)
void *uvp;
kremap *kp;
remap_handle *hp;
int *nparms;

Description

The __remap subroutine remaps 64-bit addresses into 32-bit addresses suitable for passing to the kernel. The REMAP macro should be used rather than calling this subroutine directly.

The remap_addr structs in the uremap struct on input should contain 64-bit addresses with their corresponding lengths, to be remapped. __remap will map these addresses to 32-bit quantities, and return these mappings in the remap_addr structs for each 64-bit address. These 32-bit addresses should be passed as the addresses for the respective system call parameters.

Additionally, the kremap struct will be filled in with all the 64-bit address to 32-bit address mappings.

The remap_handle will be constructed to allow the most efficient transfer of these remappings to the kernel. In the case of all the 64-bit segment numbers mapping to the same 32-bit segment number (1 remapping), this single remapping will be included directly in the remap_handle structure and the kremap structure will not be used. Similarly, if there are 2 remappings and if there are few enough parameters to pass on the system call, then both remappings will be included directly in the remap_handle structure. This will avoid a copyin64 in the kernel. If there are more than 2 remappings, or 2 remappings but too many parameters to pass them in-line, the remap_handle structure will have a pointer to the kremap structure with all the remappings.

The remap_handle structure must be passed across the system call to the remap_64 kernel service. The structure must be broken up into 32-bit register values for use in the kernel.

The caller of __remap should use the REMAP_DCL(), REMAP_SETUP(), REMAP(), REMAPPED() and REMAP_HANDLEx macros described in sys/remap.h to simplify the declaration, initialization, calling, and passing of the remap_handle structure.

This service may only be called from a 64-bit user process.

Parameters

uvp pointer to a list of 64-bit addresses to remap.
kp address of where the output kernel remappings are to be stored.
hp pointer to remap_handle to be passed to kernel, eventually to remap_64 kernel service
nparms the number of (32-bit) parameters to be passed on this system call

Return Values

0 Successful completion.
-1 Unable to complete the remapping due to insufficient resources. In this case ERRNO is set to EINVAL.

Implementation Specifics

The __remap subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The __remap_identity subroutine, remap_64 kernel service, the as_remap64 kernel service, the as_unremap64 kernel service.

Memory Kernel Services and Understanding Virtual Memory Manager Interfaces in AIX Version 4 Kernel Extensions and Device Support Programming Concepts.


[ Previous | Next | Contents | Glossary | Home | Search ]