[Zion] Ensure memory alignment of large allocations.

This commit is contained in:
Drew Galbraith 2024-08-17 12:53:25 -07:00
parent f5a27156d2
commit 71431189c9
1 changed files with 5 additions and 0 deletions

View File

@ -91,6 +91,11 @@ void* KernelHeap::Allocate(uint64_t size) {
uint64_t address = next_addr_;
alloc_count_ += 1;
next_addr_ += size;
// Ensure alingment for these pointers.
if (next_addr_ & 0x7) {
next_addr_ = (next_addr_ & ~0x7) + 0x8;
}
return reinterpret_cast<void*>(address);
}