roundup size if smaller than 4KiB

This commit is contained in:
yaloalo 2025-05-14 20:10:34 +02:00 committed by Thomas Oltmann
parent a04100136c
commit b67d47060f

View file

@ -282,7 +282,11 @@ ram_alloc_buffer(struct ppn *ppn_out, struct ram_buffer_requirements req)
TODO(); TODO();
} }
unsigned magnitude = next_pow2(req.size); if (req.size < 4096) {
req.size = 4096;
}
uint64_t next_size = next_pow2(req.size);
unsigned magnitude = __builtin_ffsl(next_size) - 1 - 12;
uint64_t addr; uint64_t addr;
if (!alloc_block(&addr, magnitude)) { if (!alloc_block(&addr, magnitude)) {