mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-30 00:54:06 +02:00
Ring3: Fixed Ring3LocateHandleBuffer().
This commit is contained in:
parent
996bc3c55f
commit
43483580fb
@ -131,42 +131,6 @@ Ring3GetMemoryMap (
|
||||
OUT UINT32 *DescriptorVersion
|
||||
);
|
||||
|
||||
/**
|
||||
Allocate pool of a particular type.
|
||||
|
||||
@param PoolType Type of pool to allocate
|
||||
@param Size The amount of pool to allocate
|
||||
@param Buffer The address to return a pointer to the allocated
|
||||
pool
|
||||
|
||||
@retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
|
||||
@retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
|
||||
@retval EFI_SUCCESS Pool successfully allocated.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Ring3AllocatePool (
|
||||
IN EFI_MEMORY_TYPE PoolType,
|
||||
IN UINTN Size,
|
||||
OUT VOID **Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Frees pool.
|
||||
|
||||
@param Buffer The allocated pool entry to free
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Buffer is not a valid value.
|
||||
@retval EFI_SUCCESS Pool successfully freed.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Ring3FreePool (
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
Creates an event.
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/MemoryPoolLib.h>
|
||||
|
||||
#include "Ring3.h"
|
||||
|
||||
@ -579,14 +580,42 @@ Ring3LocateHandleBuffer (
|
||||
OUT EFI_HANDLE **Buffer
|
||||
)
|
||||
{
|
||||
return SysCall (
|
||||
SysCallLocateHandleBuffer,
|
||||
SearchType,
|
||||
Protocol,
|
||||
SearchKey,
|
||||
NumberHandles,
|
||||
Buffer
|
||||
);
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS StatusBS;
|
||||
VOID *Pool;
|
||||
UINTN PoolSize;
|
||||
|
||||
StatusBS = SysCall (
|
||||
SysCallLocateHandleBuffer,
|
||||
SearchType,
|
||||
Protocol,
|
||||
SearchKey,
|
||||
NumberHandles,
|
||||
Buffer
|
||||
);
|
||||
|
||||
if ((NumberHandles != NULL) && (Buffer != NULL) && (*Buffer != NULL)) {
|
||||
PoolSize = *NumberHandles * sizeof (EFI_HANDLE *);
|
||||
|
||||
Status = CoreAllocatePool (EfiRing3MemoryType, PoolSize, &Pool);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
CopyMem (Pool, *Buffer, PoolSize);
|
||||
|
||||
Status = Ring3FreePages (
|
||||
(EFI_PHYSICAL_ADDRESS)*Buffer,
|
||||
EFI_SIZE_TO_PAGES (PoolSize)
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
*Buffer = Pool;
|
||||
}
|
||||
|
||||
return StatusBS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
|
@ -576,7 +576,7 @@ CallBootService (
|
||||
*(UINTN *)UserRsp->Arguments[4] = Argument4;
|
||||
}
|
||||
|
||||
if ((UINTN *)UserRsp->Arguments[5] != NULL) {
|
||||
if ((EFI_HANDLE **)UserRsp->Arguments[5] != NULL) {
|
||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)UserRsp->Arguments[5], &Attributes);
|
||||
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(UserRsp->Arguments[5] + sizeof (EFI_HANDLE *) - 1), &Attributes);
|
||||
|
Loading…
x
Reference in New Issue
Block a user