libnx  v4.2.2
Data Structures | Functions
tmem.h File Reference

Transfer memory handling. More...

#include "../types.h"
#include "../kernel/svc.h"

Go to the source code of this file.

Data Structures

struct  TransferMemory
 Transfer memory information structure. More...
 

Functions

Result tmemCreate (TransferMemory *t, size_t size, Permission perm)
 Creates a transfer memory object. More...
 
Result tmemCreateFromMemory (TransferMemory *t, void *buf, size_t size, Permission perm)
 Creates a transfer memory object from existing memory. More...
 
void tmemLoadRemote (TransferMemory *t, Handle handle, size_t size, Permission perm)
 Loads a transfer memory object coming from a remote process. More...
 
Result tmemMap (TransferMemory *t)
 Maps a transfer memory object. More...
 
Result tmemUnmap (TransferMemory *t)
 Unmaps a transfer memory object. More...
 
static void * tmemGetAddr (TransferMemory *t)
 Retrieves the mapped address of a transfer memory object. More...
 
Result tmemClose (TransferMemory *t)
 Frees up resources used by a transfer memory object, unmapping and closing handles, etc. More...
 

Detailed Description

Transfer memory handling.

Author
plutoo
Remarks
Transfer memory differs from shared memory in the fact that the user process (as opposed to the kernel) allocates and owns its backing memory.

Function Documentation

◆ tmemClose()

Result tmemClose ( TransferMemory t)

Frees up resources used by a transfer memory object, unmapping and closing handles, etc.

Parameters
tTransfer memory information structure.
Returns
Result code.

◆ tmemCreate()

Result tmemCreate ( TransferMemory t,
size_t  size,
Permission  perm 
)

Creates a transfer memory object.

Parameters
tTransfer memory information structure that will be filled in.
sizeSize of the transfer memory object to create.
permPermissions with which to protect the transfer memory in the local process.
Returns
Result code.

◆ tmemCreateFromMemory()

Result tmemCreateFromMemory ( TransferMemory t,
void *  buf,
size_t  size,
Permission  perm 
)

Creates a transfer memory object from existing memory.

Parameters
tTransfer memory information structure that will be filled in.
bufPointer to a page-aligned buffer.
sizeSize of the transfer memory object to create.
permPermissions with which to protect the transfer memory in the local process.
Returns
Result code.

◆ tmemGetAddr()

static void* tmemGetAddr ( TransferMemory t)
inlinestatic

Retrieves the mapped address of a transfer memory object.

Parameters
tTransfer memory information structure.
Returns
Mapped address of the transfer memory object.

◆ tmemLoadRemote()

void tmemLoadRemote ( TransferMemory t,
Handle  handle,
size_t  size,
Permission  perm 
)

Loads a transfer memory object coming from a remote process.

Parameters
tTransfer memory information structure which will be filled in.
handleHandle of the transfer memory object.
sizeSize of the transfer memory object that is being loaded.
permPermissions which the transfer memory is expected to have in the process that owns the memory.
Warning
This is a privileged operation; in normal circumstances applications shouldn't use this function.

◆ tmemMap()

Result tmemMap ( TransferMemory t)

Maps a transfer memory object.

Parameters
tTransfer memory information structure.
Returns
Result code.
Warning
This is a privileged operation; in normal circumstances applications cannot use this function.

◆ tmemUnmap()

Result tmemUnmap ( TransferMemory t)

Unmaps a transfer memory object.

Parameters
tTransfer memory information structure.
Returns
Result code.
Warning
This is a privileged operation; in normal circumstances applications cannot use this function.