OSMapMemory

Syntax

#include <cafe/os.h>

BOOL OSMapMemory(va_t va, pa_t pa, size_t size, int mode);

Parameters

va The starting virtual address of the range into which the memory-mapping should be made.
pa The starting physical address of the range that the memory-mapping should refer to.
size The size of the range that should be memory-mapped.
mode Either OS_MAP_RO or OS_MAP_RW, for read-only or read-write respectively.

Return Values

Returns TRUE on success, FALSE otherwise.

Description

CAUTION:
Use of OSMapMemory is not recommended.

Generally, the Cafe OS and its device drivers assume that their arguments are virtual addresses in your process’s address space as originally configured by COS. COS and device driver operations may fail in unexpected ways if they are passed virtual addresses from regions that are mapped by OSMapMemory. This is true even though you may have arranged for such aliases to point to the same underlying physical addresses that COS used to map your process’s original address space.

If you believe that you need to use the OSMapMemory function, contact your local Nintendo developer support group.

Memory-maps a range of physical addresses into a range of virtual addresses, either read-only or read-write. The range of virtual addresses must have been allocated previously through OSAllocVirtAddr and must not already contain a memory-mapping.

Do Not Call From

None.

See Also

OSGetMemBound
OSGetPageSize
OSGetMapVirtAddrRange
OSGetDataPhysAddrRange
OSGetAvailPhysAddrRange
OSAllocVirtAddr
OSFreeVirtAddr
OSUnmapMemory

Revision History

2014/01/22 Added CAUTION block to topic.
2013/05/08 Automated cleanup pass.
2012/05/25 Match actual header.
2011/12/01 Initial version.


CONFIDENTIAL