On x86 mremap() is used to provide malloc'ed memory. This can't be used on PA-RISC, so provide an own malloc() implementation. Since PA-RISC is fully 32-/64-bit use "unsigned long" instead of "u32".
Signed-off-by: Helge Deller deller@gmx.de --- src/malloc.c | 4 ++-- src/malloc.h | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/malloc.c b/src/malloc.c index 3733855..b840883 100644 --- a/src/malloc.c +++ b/src/malloc.c @@ -232,7 +232,7 @@ zonelow_expand(u32 size, u32 align, struct allocinfo_s *fill) ****************************************************************/
// Allocate physical memory from the given zone and track it as a PMM allocation -u32 +unsigned long malloc_palloc(struct zone_s *zone, u32 size, u32 align) { ASSERT32FLAT(); @@ -263,7 +263,7 @@ malloc_palloc(struct zone_s *zone, u32 size, u32 align)
// Allocate virtual memory from the given zone void * __malloc -_malloc(struct zone_s *zone, u32 size, u32 align) +x86_malloc(struct zone_s *zone, u32 size, u32 align) { return memremap(malloc_palloc(zone, size, align), size); } diff --git a/src/malloc.h b/src/malloc.h index 960a7f8..73962b4 100644 --- a/src/malloc.h +++ b/src/malloc.h @@ -1,6 +1,7 @@ #ifndef __MALLOC_H #define __MALLOC_H
+#include "autoconf.h" // CONFIG_* #include "types.h" // u32
// malloc.c @@ -15,8 +16,11 @@ void malloc_preinit(void); extern u32 LegacyRamSize; void malloc_init(void); void malloc_prepboot(void); -u32 malloc_palloc(struct zone_s *zone, u32 size, u32 align); -void *_malloc(struct zone_s *zone, u32 size, u32 align); +unsigned long malloc_palloc(struct zone_s *zone, u32 size, u32 align); +void *parisc_malloc(u32 size, u32 align); +void *x86_malloc(struct zone_s *zone, u32 size, u32 align); +#define _malloc(zone, size, align) \ + (CONFIG_X86 ? x86_malloc(zone, size, align) : parisc_malloc(size, align)) int malloc_pfree(u32 data); void free(void *data); u32 malloc_getspace(struct zone_s *zone); -- 2.29.2