• Jason Ekstrand's avatar
    util: Add a virtual memory allocator · f19ad5d3
    Jason Ekstrand authored
    This is simple linear-walk first-fit allocator roughly based on the
    allocator in the radeon winsys code.  This allocator has two primary
    functional differences:
     1) It cleanly returns 0 on allocation failure
     2) It allocates addresses top-down instead of bottom-up.
    The second one is needed for Intel because high addresses (with bit 47
    set) need to be canonicalized in order to work properly.  If we allocate
    bottom-up, then high addresses will be very rare (if they ever happen).
    We'd rather always have high addresses so that the canonicalization code
    gets better testing.
    v2: - [scott-ph] remove _heap_validate() if NDEBUG is defined (Jordan)
    Reviewed-by: D Scott Phillips's avatarScott D Phillips <scott.d.phillips@intel.com>
    Tested-by: D Scott Phillips's avatarScott D Phillips <scott.d.phillips@intel.com>
    Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
vma.h 1.76 KB