MCPcopy Create free account
hub / github.com/devkitPro/libctru / mappableAlloc

Function mappableAlloc

libctru/source/allocator/mappable.c:38–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38void* mappableAlloc(size_t size)
39{
40 // Round up, can only allocate in page units
41 size = (size + 0xFFF) & ~0xFFF;
42
43 u32 addr = mappableFindAddressWithin(currentAddr, maxAddr, size);
44 if (addr == 0)
45 {
46 // Need to rollover (maybe)
47 addr = mappableFindAddressWithin(minAddr, currentAddr, size);
48 if (addr == 0)
49 return NULL;
50 }
51
52 currentAddr = addr + size >= maxAddr ? minAddr : addr + size;
53 return (void *)addr;
54}
55
56void mappableFree(void* mem)
57{

Callers 5

irrstInitFunction · 0.85
csndInitFunction · 0.85
gspInitFunction · 0.85
hidInitFunction · 0.85
aptScreenTransferFunction · 0.85

Calls 1

Tested by

no test coverage detected