roundup size if smaller than 4KiB
This commit is contained in:
parent
a04100136c
commit
b67d47060f
1 changed files with 5 additions and 1 deletions
|
|
@ -282,7 +282,11 @@ ram_alloc_buffer(struct ppn *ppn_out, struct ram_buffer_requirements req)
|
|||
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;
|
||||
if (!alloc_block(&addr, magnitude)) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue