| 36 | } |
| 37 | |
| 38 | void* 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 | |
| 56 | void mappableFree(void* mem) |
| 57 | { |
no test coverage detected