sandbox: memblock: align allocated pointers to 16-byte boundary

This commit is contained in:
2023-02-02 21:01:22 +00:00
parent 799a23014a
commit d43347436f

View File

@@ -239,6 +239,11 @@ static phys_addr_t do_alloc(size_t size)
memblock_iter_t it; memblock_iter_t it;
for_each_free_mem_range (&it, region_start, region_end) { for_each_free_mem_range (&it, region_start, region_end) {
if (it.it_base & 0xF) {
it.it_base &= ~0xF;
it.it_base += 0x10;
}
size_t region_size = it.it_limit - it.it_base + 1; size_t region_size = it.it_limit - it.it_base + 1;
if (region_size >= size) { if (region_size >= size) {
allocated_base = it.it_base; allocated_base = it.it_base;