nn::os::StackMemory::TryInitialize Member Function

Syntax

Result TryInitialize(
     void * pMem,
     size_t size
);

Arguments

Name Description
in pMem Pointer to the beginning of the memory region to partition. Must be 4096-byte aligned.
in size Size of memory region to partition. The size argument must be a multiple of 4096.

Return Values

Returns whether process was successful.

Description

Tries to partition a memory region.

Remaps the memory region specified in the arguments to a different address allocated with 4 KB of unmapped memory before and after. Once that is done, the specified address range cannot be accessed until Finalize is called. Call MemoryBlockBase::GetAddress to get a new map address.

This function can only partition memory allocated from the heap region. It cannot partition buffers allocated statically from the code region, and it cannot partition regions in device memory.

If the region is already initialized, if the alignment restrictions of the arguments are not met, if the specified region cannot be partitioned by this function, or if address mapping fails internally, this function returns an error and fails.

Revision History

2011/08/10
Added description of the region that can be partitioned.
2011/06/22
Initial version.

CONFIDENTIAL