Rename memory related routines to follow naming convention
This commit is contained in:
parent
e64cf4d0aa
commit
8f40683270
|
@ -46,7 +46,7 @@ BlGetConfigValue(IN CONST PWCHAR ConfigName)
|
||||||
ValueLength = RtlWideStringLength(ConfigEntry->Value, 0);
|
ValueLength = RtlWideStringLength(ConfigEntry->Value, 0);
|
||||||
|
|
||||||
/* Allocate memory for value */
|
/* Allocate memory for value */
|
||||||
Status = BlMemoryAllocatePool(ValueLength * sizeof(WCHAR), (PVOID *)&Value);
|
Status = BlAllocateMemoryPool(ValueLength * sizeof(WCHAR), (PVOID *)&Value);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure, return NULL */
|
/* Memory allocation failure, return NULL */
|
||||||
|
@ -265,15 +265,15 @@ BlpParseCommandLine(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for new option */
|
/* Allocate memory for new option */
|
||||||
Status = BlMemoryAllocatePool(sizeof(XTBL_CONFIG_ENTRY), (PVOID*)&Option);
|
Status = BlAllocateMemoryPool(sizeof(XTBL_CONFIG_ENTRY), (PVOID*)&Option);
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
if(Status == STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Allocate more memory for option name */
|
/* Allocate more memory for option name */
|
||||||
Status = BlMemoryAllocatePool(sizeof(PWCHAR) * (KeyLength + 1), (PVOID*)&Option->Name);
|
Status = BlAllocateMemoryPool(sizeof(PWCHAR) * (KeyLength + 1), (PVOID*)&Option->Name);
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
if(Status == STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Allocate even more memory for option value */
|
/* Allocate even more memory for option value */
|
||||||
Status = BlMemoryAllocatePool(sizeof(PWCHAR) * (ValueLength + 1), (PVOID*)&Option->Value);
|
Status = BlAllocateMemoryPool(sizeof(PWCHAR) * (ValueLength + 1), (PVOID*)&Option->Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
@ -386,11 +386,11 @@ BlpParseConfigFile(IN CONST PCHAR RawConfig,
|
||||||
SectionLength = RtlStringLength(SectionName, 0);
|
SectionLength = RtlStringLength(SectionName, 0);
|
||||||
|
|
||||||
/* Allocate memory for new section */
|
/* Allocate memory for new section */
|
||||||
Status = BlMemoryAllocatePool(sizeof(XTBL_CONFIG_SECTION), (PVOID*)&Section);
|
Status = BlAllocateMemoryPool(sizeof(XTBL_CONFIG_SECTION), (PVOID*)&Section);
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
if(Status == STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Allocate more memory for section name */
|
/* Allocate more memory for section name */
|
||||||
Status = BlMemoryAllocatePool(sizeof(PWCHAR) * (SectionLength + 1), (PVOID*)&Section->SectionName);
|
Status = BlAllocateMemoryPool(sizeof(PWCHAR) * (SectionLength + 1), (PVOID*)&Section->SectionName);
|
||||||
}
|
}
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -456,15 +456,15 @@ BlpParseConfigFile(IN CONST PCHAR RawConfig,
|
||||||
ValueLength = RtlStringLength(Value, 0);
|
ValueLength = RtlStringLength(Value, 0);
|
||||||
|
|
||||||
/* Allocate memory for new option */
|
/* Allocate memory for new option */
|
||||||
Status = BlMemoryAllocatePool(sizeof(XTBL_CONFIG_ENTRY), (PVOID*)&Option);
|
Status = BlAllocateMemoryPool(sizeof(XTBL_CONFIG_ENTRY), (PVOID*)&Option);
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
if(Status == STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Allocate more memory for option name */
|
/* Allocate more memory for option name */
|
||||||
Status = BlMemoryAllocatePool(sizeof(PWCHAR) * (KeyLength + 1), (PVOID*)&Option->Name);
|
Status = BlAllocateMemoryPool(sizeof(PWCHAR) * (KeyLength + 1), (PVOID*)&Option->Name);
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
if(Status == STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Allocate even more memory for option value */
|
/* Allocate even more memory for option value */
|
||||||
Status = BlMemoryAllocatePool(sizeof(PWCHAR) * (ValueLength + 1), (PVOID*)&Option->Value);
|
Status = BlAllocateMemoryPool(sizeof(PWCHAR) * (ValueLength + 1), (PVOID*)&Option->Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
|
|
|
@ -28,7 +28,7 @@ BlExitBootServices()
|
||||||
BlpStatus.BootServices = FALSE;
|
BlpStatus.BootServices = FALSE;
|
||||||
|
|
||||||
/* Allocate buffer for EFI memory map */
|
/* Allocate buffer for EFI memory map */
|
||||||
Status = BlMemoryAllocatePool(sizeof(EFI_MEMORY_MAP), (PVOID*)&MemoryMap);
|
Status = BlAllocateMemoryPool(sizeof(EFI_MEMORY_MAP), (PVOID*)&MemoryMap);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
|
|
|
@ -31,7 +31,7 @@ BlpActivateSerialIOController()
|
||||||
|
|
||||||
/* Allocate memory for single EFI_HANDLE, what should be enough in most cases */
|
/* Allocate memory for single EFI_HANDLE, what should be enough in most cases */
|
||||||
PciHandleSize = sizeof(EFI_HANDLE);
|
PciHandleSize = sizeof(EFI_HANDLE);
|
||||||
Status = BlMemoryAllocatePool(PciHandleSize, (PVOID*)&PciHandle);
|
Status = BlAllocateMemoryPool(PciHandleSize, (PVOID*)&PciHandle);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
|
@ -43,8 +43,8 @@ BlpActivateSerialIOController()
|
||||||
if(Status == STATUS_EFI_BUFFER_TOO_SMALL)
|
if(Status == STATUS_EFI_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
/* Reallocate more memory as requested by UEFI */
|
/* Reallocate more memory as requested by UEFI */
|
||||||
BlMemoryFreePool(PciHandle);
|
BlFreeMemoryPool(PciHandle);
|
||||||
Status = BlMemoryAllocatePool(PciHandleSize, (PVOID*)&PciHandle);
|
Status = BlAllocateMemoryPool(PciHandleSize, (PVOID*)&PciHandle);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory reallocation failure */
|
/* Memory reallocation failure */
|
||||||
|
|
|
@ -19,6 +19,16 @@
|
||||||
typedef VOID (BLPRINTCHAR)(IN USHORT Character);
|
typedef VOID (BLPRINTCHAR)(IN USHORT Character);
|
||||||
|
|
||||||
/* XTLDR routines forward references */
|
/* XTLDR routines forward references */
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
BlAllocateMemoryPages(IN UINT64 Pages,
|
||||||
|
OUT PEFI_PHYSICAL_ADDRESS Memory);
|
||||||
|
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
BlAllocateMemoryPool(IN UINT_PTR Size,
|
||||||
|
OUT PVOID *Memory);
|
||||||
|
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
BlClearConsoleLine(IN ULONGLONG LineNo);
|
BlClearConsoleLine(IN ULONGLONG LineNo);
|
||||||
|
@ -98,6 +108,15 @@ BlFindVolumeDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL FsHandle,
|
||||||
IN CONST PWCHAR FileSystemPath,
|
IN CONST PWCHAR FileSystemPath,
|
||||||
OUT PEFI_DEVICE_PATH_PROTOCOL* DevicePath);
|
OUT PEFI_DEVICE_PATH_PROTOCOL* DevicePath);
|
||||||
|
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
BlFreeMemoryPages(IN UINT64 Pages,
|
||||||
|
IN EFI_PHYSICAL_ADDRESS Memory);
|
||||||
|
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
BlFreeMemoryPool(IN PVOID Memory);
|
||||||
|
|
||||||
XTCDECL
|
XTCDECL
|
||||||
PWCHAR
|
PWCHAR
|
||||||
BlGetConfigValue(IN CONST PWCHAR ConfigName);
|
BlGetConfigValue(IN CONST PWCHAR ConfigName);
|
||||||
|
@ -158,25 +177,6 @@ BlLocateProtocolHandles(OUT PEFI_HANDLE *Handles,
|
||||||
OUT PUINT_PTR Count,
|
OUT PUINT_PTR Count,
|
||||||
IN PEFI_GUID ProtocolGuid);
|
IN PEFI_GUID ProtocolGuid);
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMemoryAllocatePages(IN UINT64 Pages,
|
|
||||||
OUT PEFI_PHYSICAL_ADDRESS Memory);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMemoryAllocatePool(IN UINT_PTR Size,
|
|
||||||
OUT PVOID *Memory);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMemoryFreePages(IN UINT64 Pages,
|
|
||||||
IN EFI_PHYSICAL_ADDRESS Memory);
|
|
||||||
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMemoryFreePool(IN PVOID Memory);
|
|
||||||
|
|
||||||
XTCDECL
|
XTCDECL
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
BlOpenVolume(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
|
BlOpenVolume(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath,
|
||||||
|
|
168
xtldr/memory.c
168
xtldr/memory.c
|
@ -9,6 +9,88 @@
|
||||||
#include <xtldr.h>
|
#include <xtldr.h>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This routine allocates one or more 4KB pages.
|
||||||
|
*
|
||||||
|
* @param Pages
|
||||||
|
* The number of contiguous 4KB pages to allocate.
|
||||||
|
*
|
||||||
|
* @param Memory
|
||||||
|
* The pointer to a physical address.
|
||||||
|
*
|
||||||
|
* @return This routine returns a status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
BlAllocateMemoryPages(IN UINT64 Pages,
|
||||||
|
OUT PEFI_PHYSICAL_ADDRESS Memory)
|
||||||
|
{
|
||||||
|
return EfiSystemTable->BootServices->AllocatePages(AllocateAnyPages, EfiLoaderData, Pages, Memory);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This routine allocates a pool memory.
|
||||||
|
*
|
||||||
|
* @param Size
|
||||||
|
* The number of bytes to allocate from the pool.
|
||||||
|
*
|
||||||
|
* @param Memory
|
||||||
|
* The pointer to a physical address.
|
||||||
|
*
|
||||||
|
* @return This routine returns a status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
BlAllocateMemoryPool(IN UINT_PTR Size,
|
||||||
|
OUT PVOID *Memory)
|
||||||
|
{
|
||||||
|
/* Allocate pool */
|
||||||
|
return EfiSystemTable->BootServices->AllocatePool(EfiLoaderData, Size, Memory);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This routine frees memory pages.
|
||||||
|
*
|
||||||
|
* @param Pages
|
||||||
|
* The number of contiguous 4 KB pages to free.
|
||||||
|
*
|
||||||
|
* @param Memory
|
||||||
|
* The base physical address of the pages to be freed.
|
||||||
|
*
|
||||||
|
* @return This routine returns a status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
BlFreeMemoryPages(IN UINT64 Pages,
|
||||||
|
IN EFI_PHYSICAL_ADDRESS Memory)
|
||||||
|
{
|
||||||
|
return EfiSystemTable->BootServices->FreePages(Memory, Pages);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns pool memory to the system.
|
||||||
|
*
|
||||||
|
* @param Memory
|
||||||
|
* The pointer to the buffer to free.
|
||||||
|
*
|
||||||
|
* @return This routine returns a status code.
|
||||||
|
*
|
||||||
|
* @since XT 1.0
|
||||||
|
*/
|
||||||
|
XTCDECL
|
||||||
|
EFI_STATUS
|
||||||
|
BlFreeMemoryPool(IN PVOID Memory)
|
||||||
|
{
|
||||||
|
/* Free pool */
|
||||||
|
return EfiSystemTable->BootServices->FreePool(Memory);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the memory descriptors which define a memory map of all the physical memory ranges reserved by the UEFI.
|
* Returns the memory descriptors which define a memory map of all the physical memory ranges reserved by the UEFI.
|
||||||
*
|
*
|
||||||
|
@ -50,14 +132,14 @@ BlGetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap)
|
||||||
if(MemoryMap->Map)
|
if(MemoryMap->Map)
|
||||||
{
|
{
|
||||||
/* Free allocated memory */
|
/* Free allocated memory */
|
||||||
BlMemoryFreePool(MemoryMap->Map);
|
BlFreeMemoryPool(MemoryMap->Map);
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate the desired amount of memory */
|
/* Allocate the desired amount of memory */
|
||||||
MemoryMap->MapSize += 2 * MemoryMap->DescriptorSize;
|
MemoryMap->MapSize += 2 * MemoryMap->DescriptorSize;
|
||||||
BlMemoryAllocatePool(MemoryMap->MapSize, (PVOID *)&MemoryMap->Map);
|
BlAllocateMemoryPool(MemoryMap->MapSize, (PVOID *)&MemoryMap->Map);
|
||||||
}
|
}
|
||||||
while(Status == STATUS_EFI_BUFFER_TOO_SMALL);
|
while(Status == STATUS_EFI_BUFFER_TOO_SMALL);
|
||||||
|
|
||||||
|
@ -71,85 +153,3 @@ BlGetMemoryMap(OUT PEFI_MEMORY_MAP MemoryMap)
|
||||||
/* Return success */
|
/* Return success */
|
||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This routine allocates one or more 4KB pages.
|
|
||||||
*
|
|
||||||
* @param Pages
|
|
||||||
* The number of contiguous 4KB pages to allocate.
|
|
||||||
*
|
|
||||||
* @param Memory
|
|
||||||
* The pointer to a physical address.
|
|
||||||
*
|
|
||||||
* @return This routine returns a status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMemoryAllocatePages(IN UINT64 Pages,
|
|
||||||
OUT PEFI_PHYSICAL_ADDRESS Memory)
|
|
||||||
{
|
|
||||||
return EfiSystemTable->BootServices->AllocatePages(AllocateAnyPages, EfiLoaderData, Pages, Memory);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This routine allocates a pool memory.
|
|
||||||
*
|
|
||||||
* @param Size
|
|
||||||
* The number of bytes to allocate from the pool.
|
|
||||||
*
|
|
||||||
* @param Memory
|
|
||||||
* The pointer to a physical address.
|
|
||||||
*
|
|
||||||
* @return This routine returns a status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMemoryAllocatePool(IN UINT_PTR Size,
|
|
||||||
OUT PVOID *Memory)
|
|
||||||
{
|
|
||||||
/* Allocate pool */
|
|
||||||
return EfiSystemTable->BootServices->AllocatePool(EfiLoaderData, Size, Memory);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This routine frees memory pages.
|
|
||||||
*
|
|
||||||
* @param Pages
|
|
||||||
* The number of contiguous 4 KB pages to free.
|
|
||||||
*
|
|
||||||
* @param Memory
|
|
||||||
* The base physical address of the pages to be freed.
|
|
||||||
*
|
|
||||||
* @return This routine returns a status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMemoryFreePages(IN UINT64 Pages,
|
|
||||||
IN EFI_PHYSICAL_ADDRESS Memory)
|
|
||||||
{
|
|
||||||
return EfiSystemTable->BootServices->FreePages(Memory, Pages);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns pool memory to the system.
|
|
||||||
*
|
|
||||||
* @param Memory
|
|
||||||
* The pointer to the buffer to free.
|
|
||||||
*
|
|
||||||
* @return This routine returns a status code.
|
|
||||||
*
|
|
||||||
* @since XT 1.0
|
|
||||||
*/
|
|
||||||
XTCDECL
|
|
||||||
EFI_STATUS
|
|
||||||
BlMemoryFreePool(IN PVOID Memory)
|
|
||||||
{
|
|
||||||
/* Free pool */
|
|
||||||
return EfiSystemTable->BootServices->FreePool(Memory);
|
|
||||||
}
|
|
||||||
|
|
|
@ -210,7 +210,7 @@ BlLoadModule(IN PWCHAR ModuleName)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for module information block */
|
/* Allocate memory for module information block */
|
||||||
Status = BlMemoryAllocatePool(sizeof(XTBL_MODULE_INFO), (PVOID*)&ModuleInfo);
|
Status = BlAllocateMemoryPool(sizeof(XTBL_MODULE_INFO), (PVOID*)&ModuleInfo);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Failed to allocate memory */
|
/* Failed to allocate memory */
|
||||||
|
@ -251,7 +251,7 @@ BlLoadModule(IN PWCHAR ModuleName)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for module dependency */
|
/* Allocate memory for module dependency */
|
||||||
Status = BlMemoryAllocatePool(sizeof(XTBL_MODULE_DEPS), (PVOID*)&ModuleDependencies);
|
Status = BlAllocateMemoryPool(sizeof(XTBL_MODULE_DEPS), (PVOID*)&ModuleDependencies);
|
||||||
if(Status == STATUS_EFI_SUCCESS)
|
if(Status == STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocated successfully, store module's dependency */
|
/* Memory allocated successfully, store module's dependency */
|
||||||
|
@ -574,7 +574,7 @@ BlRegisterBootProtocol(IN PWCHAR SystemType,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create new boot protocol entry */
|
/* Create new boot protocol entry */
|
||||||
Status = BlMemoryAllocatePool(sizeof(XTBL_BOOT_PROTOCOL), (PVOID *)&ProtocolEntry);
|
Status = BlAllocateMemoryPool(sizeof(XTBL_BOOT_PROTOCOL), (PVOID *)&ProtocolEntry);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
|
@ -625,11 +625,11 @@ BlpInstallXtLoaderProtocol()
|
||||||
BlpLdrProtocol.Disk.CloseVolume = BlCloseVolume;
|
BlpLdrProtocol.Disk.CloseVolume = BlCloseVolume;
|
||||||
BlpLdrProtocol.Disk.OpenVolume = BlOpenVolume;
|
BlpLdrProtocol.Disk.OpenVolume = BlOpenVolume;
|
||||||
BlpLdrProtocol.Disk.ReadFile = BlReadFile;
|
BlpLdrProtocol.Disk.ReadFile = BlReadFile;
|
||||||
BlpLdrProtocol.Memory.AllocatePages = BlMemoryAllocatePages;
|
BlpLdrProtocol.Memory.AllocatePages = BlAllocateMemoryPages;
|
||||||
BlpLdrProtocol.Memory.AllocatePool = BlMemoryAllocatePool;
|
BlpLdrProtocol.Memory.AllocatePool = BlAllocateMemoryPool;
|
||||||
BlpLdrProtocol.Memory.CopyMemory = RtlCopyMemory;
|
BlpLdrProtocol.Memory.CopyMemory = RtlCopyMemory;
|
||||||
BlpLdrProtocol.Memory.FreePages = BlMemoryFreePages;
|
BlpLdrProtocol.Memory.FreePages = BlFreeMemoryPages;
|
||||||
BlpLdrProtocol.Memory.FreePool = BlMemoryFreePool;
|
BlpLdrProtocol.Memory.FreePool = BlFreeMemoryPool;
|
||||||
BlpLdrProtocol.Memory.GetMemoryMap = BlGetMemoryMap;
|
BlpLdrProtocol.Memory.GetMemoryMap = BlGetMemoryMap;
|
||||||
BlpLdrProtocol.Memory.SetMemory = RtlSetMemory;
|
BlpLdrProtocol.Memory.SetMemory = RtlSetMemory;
|
||||||
BlpLdrProtocol.Memory.ZeroMemory = RtlZeroMemory;
|
BlpLdrProtocol.Memory.ZeroMemory = RtlZeroMemory;
|
||||||
|
|
|
@ -452,7 +452,7 @@ BlDisplayInputDialog(IN PWCHAR Caption,
|
||||||
|
|
||||||
/* Get initial input text length and allocate a buffer */
|
/* Get initial input text length and allocate a buffer */
|
||||||
BufferLength = RtlWideStringLength(*InputFieldText, 0);
|
BufferLength = RtlWideStringLength(*InputFieldText, 0);
|
||||||
Status = BlMemoryAllocatePool(BufferLength * sizeof(WCHAR), (PVOID *)&InputFieldBuffer);
|
Status = BlAllocateMemoryPool(BufferLength * sizeof(WCHAR), (PVOID *)&InputFieldBuffer);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure, print error message and return */
|
/* Memory allocation failure, print error message and return */
|
||||||
|
@ -1213,7 +1213,7 @@ BlpDrawDialogMessage(IN PXTBL_DIALOG_HANDLE Handle,
|
||||||
|
|
||||||
/* Allocate memory for dialog box message */
|
/* Allocate memory for dialog box message */
|
||||||
Length = RtlWideStringLength(Message, 0);
|
Length = RtlWideStringLength(Message, 0);
|
||||||
Status = BlMemoryAllocatePool(Length * sizeof(WCHAR), (PVOID *)&Msg);
|
Status = BlAllocateMemoryPool(Length * sizeof(WCHAR), (PVOID *)&Msg);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure, print debug message and return */
|
/* Memory allocation failure, print debug message and return */
|
||||||
|
|
|
@ -166,7 +166,7 @@ BlEnumerateBlockDevices()
|
||||||
if(DriveType != XTBL_BOOT_DEVICE_UNKNOWN)
|
if(DriveType != XTBL_BOOT_DEVICE_UNKNOWN)
|
||||||
{
|
{
|
||||||
/* Allocate memory for block device */
|
/* Allocate memory for block device */
|
||||||
Status = BlMemoryAllocatePool(sizeof(EFI_BLOCK_DEVICE), (PVOID *)&BlockDevice);
|
Status = BlAllocateMemoryPool(sizeof(EFI_BLOCK_DEVICE), (PVOID *)&BlockDevice);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
BlDebugPrint(L"ERROR: Failed to allocate memory pool for block device (Status Code: 0x%lx)\n", Status);
|
BlDebugPrint(L"ERROR: Failed to allocate memory pool for block device (Status Code: 0x%lx)\n", Status);
|
||||||
|
@ -248,7 +248,7 @@ BlFindVolumeDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL FsHandle,
|
||||||
FsPathLength = RtlWideStringLength(FileSystemPath, 0) * sizeof(WCHAR);
|
FsPathLength = RtlWideStringLength(FileSystemPath, 0) * sizeof(WCHAR);
|
||||||
|
|
||||||
/* Allocate memory pool for device path */
|
/* Allocate memory pool for device path */
|
||||||
Status = BlMemoryAllocatePool(FsPathLength + DevicePathLength + sizeof(EFI_DEVICE_PATH_PROTOCOL),
|
Status = BlAllocateMemoryPool(FsPathLength + DevicePathLength + sizeof(EFI_DEVICE_PATH_PROTOCOL),
|
||||||
(PVOID *)DevicePath);
|
(PVOID *)DevicePath);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -516,7 +516,7 @@ BlReadFile(IN PEFI_FILE_HANDLE DirHandle,
|
||||||
ReadSize = sizeof(EFI_FILE_INFO) + 32;
|
ReadSize = sizeof(EFI_FILE_INFO) + 32;
|
||||||
|
|
||||||
/* Allocate necessary amount of memory */
|
/* Allocate necessary amount of memory */
|
||||||
Status = BlMemoryAllocatePool(ReadSize, (PVOID *)&FileInfo);
|
Status = BlAllocateMemoryPool(ReadSize, (PVOID *)&FileInfo);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
|
@ -529,8 +529,8 @@ BlReadFile(IN PEFI_FILE_HANDLE DirHandle,
|
||||||
if(Status == STATUS_EFI_BUFFER_TOO_SMALL)
|
if(Status == STATUS_EFI_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
/* Buffer is too small, but EFI tells the required size, so reallocate */
|
/* Buffer is too small, but EFI tells the required size, so reallocate */
|
||||||
BlMemoryFreePool(&FileInfo);
|
BlFreeMemoryPool(&FileInfo);
|
||||||
Status = BlMemoryAllocatePool(ReadSize, (PVOID *)&FileInfo);
|
Status = BlAllocateMemoryPool(ReadSize, (PVOID *)&FileInfo);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
|
@ -547,7 +547,7 @@ BlReadFile(IN PEFI_FILE_HANDLE DirHandle,
|
||||||
{
|
{
|
||||||
/* Unable to get file information */
|
/* Unable to get file information */
|
||||||
FileHandle->Close(FileHandle);
|
FileHandle->Close(FileHandle);
|
||||||
BlMemoryFreePool(&FileInfo);
|
BlFreeMemoryPool(&FileInfo);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,12 +556,12 @@ BlReadFile(IN PEFI_FILE_HANDLE DirHandle,
|
||||||
Pages = EFI_SIZE_TO_PAGES(FileInfo->FileSize);
|
Pages = EFI_SIZE_TO_PAGES(FileInfo->FileSize);
|
||||||
|
|
||||||
/* Allocate pages */
|
/* Allocate pages */
|
||||||
Status = BlMemoryAllocatePages(Pages, &Address);
|
Status = BlAllocateMemoryPages(Pages, &Address);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Pages allocation failure */
|
/* Pages allocation failure */
|
||||||
FileHandle->Close(FileHandle);
|
FileHandle->Close(FileHandle);
|
||||||
BlMemoryFreePool(&FileInfo);
|
BlFreeMemoryPool(&FileInfo);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,14 +576,14 @@ BlReadFile(IN PEFI_FILE_HANDLE DirHandle,
|
||||||
{
|
{
|
||||||
/* Failed to read data */
|
/* Failed to read data */
|
||||||
FileHandle->Close(FileHandle);
|
FileHandle->Close(FileHandle);
|
||||||
BlMemoryFreePool(&FileInfo);
|
BlFreeMemoryPool(&FileInfo);
|
||||||
BlMemoryFreePages(Pages, (EFI_PHYSICAL_ADDRESS)(UINT_PTR)*FileData);
|
BlFreeMemoryPages(Pages, (EFI_PHYSICAL_ADDRESS)(UINT_PTR)*FileData);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close handle and free memory */
|
/* Close handle and free memory */
|
||||||
FileHandle->Close(FileHandle);
|
FileHandle->Close(FileHandle);
|
||||||
BlMemoryFreePool(&FileInfo);
|
BlFreeMemoryPool(&FileInfo);
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
|
@ -657,7 +657,7 @@ BlpDiscoverEfiBlockDevices(OUT PLIST_ENTRY BlockDevices)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for block device */
|
/* Allocate memory for block device */
|
||||||
Status = BlMemoryAllocatePool(sizeof(*BlockDevice), (PVOID *)&BlockDevice);
|
Status = BlAllocateMemoryPool(sizeof(*BlockDevice), (PVOID *)&BlockDevice);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Memory allocation failure */
|
/* Memory allocation failure */
|
||||||
|
@ -674,7 +674,7 @@ BlpDiscoverEfiBlockDevices(OUT PLIST_ENTRY BlockDevices)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free handles buffer */
|
/* Free handles buffer */
|
||||||
BlMemoryFreePool(Handles);
|
BlFreeMemoryPool(Handles);
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
return STATUS_EFI_SUCCESS;
|
return STATUS_EFI_SUCCESS;
|
||||||
|
@ -838,7 +838,7 @@ BlpDissectVolumeArcPath(IN PWCHAR SystemPath,
|
||||||
/* Store ARC name if possible */
|
/* Store ARC name if possible */
|
||||||
if(ArcName)
|
if(ArcName)
|
||||||
{
|
{
|
||||||
BlMemoryAllocatePool(ArcLength * sizeof(WCHAR), (PVOID *)&LocalArcName);
|
BlAllocateMemoryPool(ArcLength * sizeof(WCHAR), (PVOID *)&LocalArcName);
|
||||||
RtlCopyMemory(LocalArcName, SystemPath, ArcLength * sizeof(WCHAR));
|
RtlCopyMemory(LocalArcName, SystemPath, ArcLength * sizeof(WCHAR));
|
||||||
LocalArcName[ArcLength] = '\0';
|
LocalArcName[ArcLength] = '\0';
|
||||||
*ArcName = LocalArcName;
|
*ArcName = LocalArcName;
|
||||||
|
@ -888,7 +888,7 @@ BlpDuplicateDevicePath(IN PEFI_DEVICE_PATH_PROTOCOL DevicePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory for the new device path */
|
/* Allocate memory for the new device path */
|
||||||
Status = BlMemoryAllocatePool(Length, (PVOID *)&DevicePathClone);
|
Status = BlAllocateMemoryPool(Length, (PVOID *)&DevicePathClone);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Failed to allocate memory */
|
/* Failed to allocate memory */
|
||||||
|
|
|
@ -193,7 +193,7 @@ BlInvokeBootProtocol(IN PLIST_ENTRY OptionsList)
|
||||||
/* Check a length of modules list */
|
/* Check a length of modules list */
|
||||||
ModuleListLength = RtlWideStringLength(Option->Value, 0);
|
ModuleListLength = RtlWideStringLength(Option->Value, 0);
|
||||||
|
|
||||||
Status = BlMemoryAllocatePool(sizeof(PWCHAR) * ModuleListLength, (PVOID *)&ModulesList);
|
Status = BlAllocateMemoryPool(sizeof(PWCHAR) * ModuleListLength, (PVOID *)&ModulesList);
|
||||||
if(Status != STATUS_EFI_SUCCESS)
|
if(Status != STATUS_EFI_SUCCESS)
|
||||||
{
|
{
|
||||||
/* Failed to allocate memory, print error message and return status code */
|
/* Failed to allocate memory, print error message and return status code */
|
||||||
|
|
Loading…
Reference in New Issue