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



Call __remap to remap 64-bit addresses into 32-bit addresses.


#include <sys/types.h>
#include <sys/errno.h>
#include <sys/remap.h>
int nparms;
int nparms;


The REMAP macro calls the __remap subroutine to remap 64-bit addresses into 32-bit addresses suitable for passing to the kernel. This macro should be used in conjunction with the REMAP_DCL(), REMAP_SETUP(), REMAPPED(), and REMAP_HANDLEx macros. The macro is dependent on structures declared by REMAP_DCL and initialized by REMAP_SETUP.

Here is an example of the usage of REMAP:

naccept (int s,
	struct sockaddr * name,
	int * anamelan)
    REMAP_DCL (2);				<--2 addrs to remap
    int rc;
    REMAP_SETUP_WITH_LEN(0, name, *anamelan);	<--1st addr, explicit len
    REMAP_SETUP (1, anamelen);			<--2nd addr, implied len
    REMAP (3);		<-------+------------------3 parameters to pass
    rc = __naccept (REMAP_HANDLE3, s, REMAPPED(0), REMAPPED(1));
    return rc;				       ^            ^		
}					       |	    |	
				1st remapped addr   2nd remapped addr

In the example shown, there are 2 addresses to be remapped (name and anamelen). REMAP_DCL(2) is used to declare the structures necessary for the remapping of 2 addresses. The first address range to be remapped (name) is defined to be of length *anamelen. Therefore REMAP_SETUP_WITH_LEN is called to set up the first remapping (remapping #0) so the length can be specified. The length of the 2nd range (remapping #1) is implied by the type (int), so REMAP_SETUP is used.

REMAP is then called, and nparms is 3 since there are a total of 3 parameters for the naccept system call. Finally, the 32-bit system call is called passing the remap_handle structure followed by the parameters, including the remapped addresses. The REMAP_HANDLE3 macro is used to pass the remap_handle structure appropriate for a system call with 3 parameters. The REMAPPED macros are used to pass remapped address #0 (name) and remapped address #1 (anamelen).

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


nparms the number of (32-bit) parameters to be passed on this system call.

Return Values

On error, the errno value has been set by __remap and the REMAP macro calls return to return -1 to the caller of the system call. If the system call is a void, the REMAP_VOID macro should be used (same syntax). In this case, if there is an error the REMAP_VOID macro simply calls return with no value.

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. The REMAP macro is defined in sys/remap.h.

Related Information

The REMAP_IDENTITY macro, REMAP_DCL macro, REMAP_SETUP macro, __remap 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 ]