mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 13:44:33 +02:00
Ring3: Added SysCallAllocatePool.
This commit is contained in:
parent
2090f6ef7e
commit
b08d7cbb16
@ -77,7 +77,19 @@ Ring3AllocatePool (
|
|||||||
OUT VOID **Buffer
|
OUT VOID **Buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_UNSUPPORTED;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
Status = SysCall (
|
||||||
|
SysCallAllocatePool,
|
||||||
|
PoolType,
|
||||||
|
Size,
|
||||||
|
Buffer
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((DEBUG_ERROR, "Ring3: Failed to allocate %d bytes.\n", Size));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -310,6 +310,9 @@ GetPermissionAttributeForMemoryType (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 TestBit;
|
UINT64 TestBit;
|
||||||
|
UINT64 Attributes;
|
||||||
|
|
||||||
|
Attributes = 0;
|
||||||
|
|
||||||
if ((UINT32)MemoryType >= MEMORY_TYPE_OS_RESERVED_MIN) {
|
if ((UINT32)MemoryType >= MEMORY_TYPE_OS_RESERVED_MIN) {
|
||||||
TestBit = BIT63;
|
TestBit = BIT63;
|
||||||
@ -320,10 +323,14 @@ GetPermissionAttributeForMemoryType (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((PcdGet64 (PcdDxeNxMemoryProtectionPolicy) & TestBit) != 0) {
|
if ((PcdGet64 (PcdDxeNxMemoryProtectionPolicy) & TestBit) != 0) {
|
||||||
return EFI_MEMORY_XP;
|
Attributes |= EFI_MEMORY_XP;
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MemoryType == EfiRing3MemoryType) {
|
||||||
|
Attributes |= EFI_MEMORY_USER;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Attributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -203,6 +203,21 @@ CallBootService (
|
|||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
|
case SysCallAllocatePool:
|
||||||
|
//
|
||||||
|
// Argument 1: EFI_MEMORY_TYPE PoolType
|
||||||
|
// Argument 2: UINTN Size
|
||||||
|
// Argument 3: VOID **Buffer
|
||||||
|
//
|
||||||
|
DisableSMAP ();
|
||||||
|
Status = gBS->AllocatePool (
|
||||||
|
EfiRing3MemoryType,
|
||||||
|
CoreRbp->Argument2,
|
||||||
|
(VOID **)CoreRbp->Argument3
|
||||||
|
);
|
||||||
|
EnableSMAP ();
|
||||||
|
|
||||||
|
return Status;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,10 @@ typedef enum {
|
|||||||
/// by a corresponding call to the underlying isolation architecture.
|
/// by a corresponding call to the underlying isolation architecture.
|
||||||
///
|
///
|
||||||
EfiUnacceptedMemoryType,
|
EfiUnacceptedMemoryType,
|
||||||
|
///
|
||||||
|
/// Memory allocated for (by) Ring3 Images.
|
||||||
|
///
|
||||||
|
EfiRing3MemoryType,
|
||||||
EfiMaxMemoryType
|
EfiMaxMemoryType
|
||||||
} EFI_MEMORY_TYPE;
|
} EFI_MEMORY_TYPE;
|
||||||
|
|
||||||
|
@ -2014,10 +2014,11 @@ typedef struct {
|
|||||||
} EFI_BOOT_SERVICES;
|
} EFI_BOOT_SERVICES;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SysCallReturnToCore = 0,
|
SysCallReturnToCore, // Must always be zero for CoreBootServices.nasm.
|
||||||
SysCallLocateProtocol = 1,
|
SysCallLocateProtocol,
|
||||||
SysCallOpenProtocol = 2,
|
SysCallOpenProtocol,
|
||||||
SysCallInstallMultipleProtocolInterfaces = 3,
|
SysCallInstallMultipleProtocolInterfaces,
|
||||||
|
SysCallAllocatePool,
|
||||||
SysCallMax
|
SysCallMax
|
||||||
} SYS_CALL_TYPE;
|
} SYS_CALL_TYPE;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user