[riscv] Use generic external heap based on the system memory map

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-05-19 16:16:33 +01:00
parent 4d560af2b0
commit 140ceeeb08
4 changed files with 1 additions and 84 deletions

View File

@@ -1,14 +0,0 @@
#ifndef _BITS_UMALLOC_H
#define _BITS_UMALLOC_H
/** @file
*
* RISCV-specific user memory allocation API implementations
*
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <ipxe/sbi_umalloc.h>
#endif /* _BITS_UMALLOC_H */

View File

@@ -1,18 +0,0 @@
#ifndef _IPXE_SBI_UMALLOC_H
#define _IPXE_SBI_UMALLOC_H
/** @file
*
* External memory allocation
*
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#ifdef UMALLOC_SBI
#define UMALLOC_PREFIX_sbi
#else
#define UMALLOC_PREFIX_sbi __sbi_
#endif
#endif /* _IPXE_SBI_UMALLOC_H */

View File

@@ -1,51 +0,0 @@
/*
* Copyright (C) 2024 Michael Brown <mbrown@fensystems.co.uk>.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* You can also choose to distribute this program under the terms of
* the Unmodified Binary Distribution Licence (as given in the file
* COPYING.UBDL), provided that you have satisfied its requirements.
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <stdlib.h>
#include <ipxe/umalloc.h>
/** @file
*
* iPXE user memory allocation API for SBI
*
*/
/**
* Reallocate external memory
*
* @v old_ptr Memory previously allocated by umalloc(), or NULL
* @v new_size Requested size
* @ret new_ptr Allocated memory, or NULL
*
* Calling realloc() with a new size of zero is a valid way to free a
* memory block.
*/
static void * sbi_urealloc ( void * old_ptr, size_t new_size ) {
/* External allocation not yet implemented: allocate from heap */
return ( realloc ( old_ptr, new_size ) );
}
PROVIDE_UMALLOC ( sbi, urealloc, sbi_urealloc );

View File

@@ -18,7 +18,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define CONSOLE_SBI
#define REBOOT_SBI
#define UMALLOC_SBI
#define UMALLOC_UHEAP
#define MEMMAP_FDT
#define ACPI_NULL