diff options
| author | Tyrannys <80750971+Tyrannys@users.noreply.github.com> | 2026-11-27 19:13:07 -0600 |
|---|---|---|
| committer | Tyrannys <80750971+Tyrannys@users.noreply.github.com> | 2026-11-27 19:13:07 -0600 |
| commit | 0f43a7804beec409cb294cfe7c866c3fca03f8bb (patch) | |
| tree | d33d4a98127c6a11eef2587f7c10385486e251d4 /runtime/src/bcpack.cpp | |
| parent | 431ceba4f4a55c69c26fcf0e36fd83e86e1b9a32 (diff) | |
acphal: power-of-two alignment in ApuIsVirtualAddressValid; ApuAlloc(flags=2) gets the lazy default heap
From kevincommits' finding (batch 18, item 4) in #1608.
- ApuIsVirtualAddressValid and ApuRegion::is_valid_address tested
(offset & (alignment - 1)) == 0 for any alignment, which is only an
alignment test for a power of two: with 6, offset 2 passed and offset 6
failed. An alignment that is not a power of two is now invalid, as ApuAlloc
already treats it (0 still means 1).
- Before ApuCreateHeap, ApuAlloc with flags 0 or 1 created a 64 MiB default
cached heap, but flags 2 fell back to the cached heap without creating it
and returned E_OUTOFMEMORY. The fallback now comes first, so a first
allocation with flags 2 gets the same lazy default heap. A heap left out by
an explicit ApuCreateHeap stays unavailable (acphal_noncached_only).
acphal_test: alignment 6 and 3 are refused and powers of two kept (2 checks
fail on main); a new mode --lazy-noncached (ctest acphal_lazy_noncached)
allocates with flags 2 before any ApuCreateHeap (2 checks fail on main).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/bcpack.cpp')
0 files changed, 0 insertions, 0 deletions