diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2013-12-14 13:14:02 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2013-12-27 12:40:02 -0500 |
commit | 743c1575390188fd628ecd0333bb679e8ecc0bec (patch) | |
tree | 2d26092e6d034d39670c10770d3a95ade70ad6bd /src/malloc.h | |
parent | 95b3d3286ff65d44f3d0240c6d7be4bec7671375 (diff) | |
download | seabios-743c1575390188fd628ecd0333bb679e8ecc0bec.tar.gz |
Remove the pmm handle argument from _malloc().
The PMM handle argument will almost always be 0xffffffff. Use
separate code for the few rare cases where it may not be the default
value. Gcc produces better code if _malloc() only requires three
parameters.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/malloc.h')
-rw-r--r-- | src/malloc.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/malloc.h b/src/malloc.h index af8a21da..2bcb5bf6 100644 --- a/src/malloc.h +++ b/src/malloc.h @@ -15,29 +15,30 @@ void malloc_preinit(void); extern u32 LegacyRamSize; void malloc_init(void); void malloc_prepboot(void); -void *_malloc(struct zone_s *zone, u32 handle, u32 size, u32 align); +void *_malloc(struct zone_s *zone, u32 size, u32 align); int _free(void *data); u32 malloc_getspace(struct zone_s *zone); -void *malloc_find(u32 handle); +void malloc_sethandle(void *data, u32 handle); +void *malloc_findhandle(u32 handle); #define MALLOC_DEFAULT_HANDLE 0xFFFFFFFF // Minimum alignment of malloc'd memory #define MALLOC_MIN_ALIGN 16 // Helper functions for memory allocation. static inline void *malloc_low(u32 size) { - return _malloc(&ZoneLow, MALLOC_DEFAULT_HANDLE, size, MALLOC_MIN_ALIGN); + return _malloc(&ZoneLow, size, MALLOC_MIN_ALIGN); } static inline void *malloc_high(u32 size) { - return _malloc(&ZoneHigh, MALLOC_DEFAULT_HANDLE, size, MALLOC_MIN_ALIGN); + return _malloc(&ZoneHigh, size, MALLOC_MIN_ALIGN); } static inline void *malloc_fseg(u32 size) { - return _malloc(&ZoneFSeg, MALLOC_DEFAULT_HANDLE, size, MALLOC_MIN_ALIGN); + return _malloc(&ZoneFSeg, size, MALLOC_MIN_ALIGN); } static inline void *malloc_tmplow(u32 size) { - return _malloc(&ZoneTmpLow, MALLOC_DEFAULT_HANDLE, size, MALLOC_MIN_ALIGN); + return _malloc(&ZoneTmpLow, size, MALLOC_MIN_ALIGN); } static inline void *malloc_tmphigh(u32 size) { - return _malloc(&ZoneTmpHigh, MALLOC_DEFAULT_HANDLE, size, MALLOC_MIN_ALIGN); + return _malloc(&ZoneTmpHigh, size, MALLOC_MIN_ALIGN); } static inline void *malloc_tmp(u32 size) { void *ret = malloc_tmphigh(size); @@ -46,16 +47,16 @@ static inline void *malloc_tmp(u32 size) { return malloc_tmplow(size); } static inline void *memalign_low(u32 align, u32 size) { - return _malloc(&ZoneLow, MALLOC_DEFAULT_HANDLE, size, align); + return _malloc(&ZoneLow, size, align); } static inline void *memalign_high(u32 align, u32 size) { - return _malloc(&ZoneHigh, MALLOC_DEFAULT_HANDLE, size, align); + return _malloc(&ZoneHigh, size, align); } static inline void *memalign_tmplow(u32 align, u32 size) { - return _malloc(&ZoneTmpLow, MALLOC_DEFAULT_HANDLE, size, align); + return _malloc(&ZoneTmpLow, size, align); } static inline void *memalign_tmphigh(u32 align, u32 size) { - return _malloc(&ZoneTmpHigh, MALLOC_DEFAULT_HANDLE, size, align); + return _malloc(&ZoneTmpHigh, size, align); } static inline void *memalign_tmp(u32 align, u32 size) { void *ret = memalign_tmphigh(align, size); |