Rework malloc to use a "first fit" algorithm.

The existing malloc implementation effectively uses a stack - all new
allocations come from the top of the stack.  When allocating memory
with a large alignment, the pad used to align the new memory is
unavailable to other users.  Also, memory released by calling free()
is only available to other users when all memory allocated after it is
also freed.

This new malloc scheme uses a first fit approach to finding available
memory.  It makes it possible to use alignment padding and freed space
for new allocations.

This helps reduce the required memory in the permanent memory zones
(ZoneHigh and ZoneLow) where users have the need to allocate
structures with high alignment (eg, virtio and usb).
3 files changed
tree: 4cf6222680d009e1845c022342a48526ab722987
  1. .gitignore
  2. COPYING
  3. COPYING.LESSER
  4. Makefile
  5. README
  6. TODO
  7. src/
  8. tools/
  9. vgasrc/