SysCall: Replaced AllocatePool() with CoreAllocatePages().

This commit is contained in:
Mikhail Krichanov 2024-03-22 18:09:42 +03:00
parent ede5387afd
commit 99d5d6b5a9

@ -26,23 +26,28 @@ GoToRing3 (
...
)
{
EFI_STATUS Status;
RING3_CALL_DATA *Input;
VA_LIST Marker;
UINTN Index;
EFI_STATUS Status;
RING3_CALL_DATA *Input;
VA_LIST Marker;
UINTN Index;
EFI_PHYSICAL_ADDRESS Ring3Pages;
UINT32 PagesNumber;
DisableSMAP ();
Status = gBS->AllocatePool (
EfiRing3MemoryType,
sizeof (RING3_CALL_DATA) + Number * sizeof (UINTN),
(VOID **)&Input
);
PagesNumber = (UINT32)EFI_SIZE_TO_PAGES (sizeof (RING3_CALL_DATA) + Number * sizeof (UINTN));
Status = CoreAllocatePages (
AllocateAnyPages,
EfiRing3MemoryType,
PagesNumber,
&Ring3Pages
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Ring0: Failed to allocate memory for Input data.\n"));
EnableSMAP ();
return Status;
}
Input = (RING3_CALL_DATA *)(UINTN)Ring3Pages;
DisableSMAP ();
Input->NumberOfArguments = Number;
Input->EntryPoint = EntryPoint;
@ -74,6 +79,8 @@ GoToRing3 (
);
}
CoreFreePages (Ring3Pages, PagesNumber);
return Status;
}