mm/umm: Allow customizing the implementation of umm heap

and migrate arch/sim from the customized mm_heap to
umm_heap, so the default mm_heap implementation can
still be used(e.g. shared memory in OpenAMP).

Signed-off-by: ganjing <ganjing@xiaomi.com>
This commit is contained in:
ganjing 2026-01-26 13:57:19 +08:00 committed by Xiang Xiao
parent 364a633ec3
commit e941b18e29
10 changed files with 209 additions and 300 deletions

View file

@ -25,6 +25,13 @@ config MM_CUSTOMIZE_MANAGER
endchoice
config MM_UMM_CUSTOMIZE_MANAGER
bool "Customized heap manager"
default n
---help---
Customized memory manager policy. The build will fail
if the umm heap module not defined by customer.
config MM_KERNEL_HEAP
bool "Kernel dedicated heap"
default BUILD_PROTECTED || BUILD_KERNEL

View file

@ -22,29 +22,31 @@
# User heap allocator
set(SRCS
umm_globals.c
umm_initialize.c
umm_addregion.c
umm_malloc_size.c
umm_brkaddr.c
umm_calloc.c
umm_extend.c
umm_free.c
umm_mallinfo.c
umm_malloc.c
umm_memalign.c
umm_realloc.c
umm_zalloc.c
umm_heapmember.c
umm_memdump.c)
if(NOT CONFIG_MM_UMM_CUSTOMIZE_MANAGER)
set(SRCS
umm_globals.c
umm_initialize.c
umm_addregion.c
umm_malloc_size.c
umm_brkaddr.c
umm_calloc.c
umm_extend.c
umm_free.c
umm_mallinfo.c
umm_malloc.c
umm_memalign.c
umm_realloc.c
umm_zalloc.c
umm_heapmember.c
umm_memdump.c)
if(CONFIG_BUILD_KERNEL)
list(APPEND SRCS umm_sbrk.c)
if(CONFIG_BUILD_KERNEL)
list(APPEND SRCS umm_sbrk.c)
endif()
if(CONFIG_DEBUG_MM)
list(APPEND SRCS umm_checkcorruption.c)
endif()
target_sources(mm PRIVATE ${SRCS})
endif()
if(CONFIG_DEBUG_MM)
list(APPEND SRCS umm_checkcorruption.c)
endif()
target_sources(mm PRIVATE ${SRCS})

View file

@ -22,6 +22,7 @@
# User heap allocator
ifeq ($(CONFIG_MM_UMM_CUSTOMIZE_MANAGER),)
CSRCS += umm_globals.c umm_initialize.c umm_addregion.c umm_malloc_size.c
CSRCS += umm_brkaddr.c umm_calloc.c umm_extend.c umm_free.c umm_mallinfo.c
CSRCS += umm_malloc.c umm_memalign.c umm_realloc.c umm_zalloc.c umm_heapmember.c
@ -39,3 +40,4 @@ endif
DEPPATH += --dep-path umm_heap
VPATH += :umm_heap
endif