switch_memory

All of these library headers and source can be found in the github repo https://github.com/switchbrew/libnx.Aligns a block of memory with request size to bytes size. For example, a request of memalign(0x1000, 0x1001) == 0x2000 bytes allocatedMaps a memaligned block of memory from src_addr to dst_addr. The Nintendo Switch requires this call in order to make use of memory, otherwise an invalid memory access occurs.Unmaps (frees) all memory from both dst_addr and src_addr. Must be called whenever svcMapMemory is used. The Switch will expect all memory to be allocated before gfxExit() calls (<switch/gfx/gfx.h>)

Procs

proc memalign(bytes: csize; size: csize): pointer {...}{.importc: "memalign",
    header: "<malloc.h>".}
  Source Edit
proc svcMapMemory(dst_addr: pointer; src_addr: pointer; size: uint64): uint32 {...}{.
    importc: "svcMapMemory", header: "<switch/kernel/svc.h>".}
  Source Edit
proc svcUnmapMemory(dst_addr: pointer; src_addr: pointer; size: uint64): uint32 {...}{.
    importc: "svcUnmapMemory", header: "<switch/kernel/svc.h>".}
  Source Edit
proc virtmemReserveMap(size: csize): pointer {...}{.importc: "virtmemReserveMap",
    header: "<switch/kernel/virtmem.h>".}
  Source Edit