ulib Add umallocbig() and ufreebig() for non-fragmented allocations

This commit is contained in:
2025-11-09 22:21:19 +01:00
parent 02d60129b1
commit 4084336705
3 changed files with 19 additions and 0 deletions

View File

@ -148,3 +148,18 @@ void *urealloc(void *ptr, size_t newsize) {
err:
return NULL;
}
void *umallocbig(size_t size) {
size_t allocsz = ALIGN_UP(size, 4096);
uint8_t *out;
int32_t ret = mman_map(NULL, allocsz, MMAN_MAP_PF_RW, 0, &out);
if (out == NULL || ret != E_OK) {
return NULL;
}
return out;
}
void ufreebig(void *addr) {
if (addr != NULL)
mman_unmap(addr);
}