mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-03 09:23:35 +00:00
Replace the call to emalloc() to uefi pool allocation
emalloc() is called only by construct_mbi() during creating e820 mmap layout. The switching has two benefits: first, UEFI FW might keep some memory in pool, unlike call to emalloc(), call to allocate_pool() might have no impact on e820 mmap; on the other hand, we can remove emalloc() routine after this switching. Tracked-On:#1260 Signed-off-by: Chaohong Guo <chaohong.guo@intel.com> Reviewed-by: Anthony Xu <Anthony.Xu@intel.com> Acked-by: Gen Zheng <gen.zheng@intel.com>
This commit is contained in:
parent
951a24cd3d
commit
1d15b98730
@ -68,11 +68,10 @@ static inline void hv_jump(EFI_PHYSICAL_ADDRESS hv_start,
|
|||||||
|
|
||||||
EFI_STATUS construct_mbi(EFI_PHYSICAL_ADDRESS hv_hpa)
|
EFI_STATUS construct_mbi(EFI_PHYSICAL_ADDRESS hv_hpa)
|
||||||
{
|
{
|
||||||
UINTN map_size, _map_size, map_key;
|
UINTN map_size, map_key;
|
||||||
UINT32 desc_version;
|
UINT32 desc_version;
|
||||||
UINTN desc_size;
|
UINTN desc_size;
|
||||||
EFI_MEMORY_DESCRIPTOR *map_buf;
|
EFI_MEMORY_DESCRIPTOR *map_buf;
|
||||||
EFI_PHYSICAL_ADDRESS addr;
|
|
||||||
EFI_STATUS err = EFI_SUCCESS;
|
EFI_STATUS err = EFI_SUCCESS;
|
||||||
struct multiboot_info *mbi;
|
struct multiboot_info *mbi;
|
||||||
struct multiboot_mmap *mmap;
|
struct multiboot_mmap *mmap;
|
||||||
@ -92,11 +91,9 @@ EFI_STATUS construct_mbi(EFI_PHYSICAL_ADDRESS hv_hpa)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
again:
|
again:
|
||||||
_map_size = map_size;
|
err = allocate_pool(EfiLoaderData, map_size, (void **) &map_buf);
|
||||||
err = emalloc(map_size, 1, &addr);
|
|
||||||
if (err != EFI_SUCCESS)
|
if (err != EFI_SUCCESS)
|
||||||
goto out;
|
goto out;
|
||||||
map_buf = (EFI_MEMORY_DESCRIPTOR *)(UINTN)addr;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remember! We've already allocated map_buf with emalloc (and
|
* Remember! We've already allocated map_buf with emalloc (and
|
||||||
@ -115,7 +112,7 @@ again:
|
|||||||
* larger. 'map_size' has been updated by the
|
* larger. 'map_size' has been updated by the
|
||||||
* call to memory_map().
|
* call to memory_map().
|
||||||
*/
|
*/
|
||||||
efree((UINTN)map_buf, _map_size);
|
free_pool(map_buf);
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
goto out;
|
goto out;
|
||||||
|
Loading…
Reference in New Issue
Block a user