mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 16:14:04 +02:00
SysCall: Refactored ReturnToCore() for AARCH64, ARM.
This commit is contained in:
parent
97371df2b6
commit
d12742da3d
@ -113,11 +113,13 @@ ASM_FUNC(ArmCallRing3)
|
|||||||
// VOID
|
// VOID
|
||||||
// EFIAPI
|
// EFIAPI
|
||||||
// ReturnToCore (
|
// ReturnToCore (
|
||||||
// IN EFI_STATUS Status,
|
// IN EFI_STATUS Status
|
||||||
// IN UINTN CoreSp
|
|
||||||
// );
|
// );
|
||||||
|
//
|
||||||
|
// (x0) Status
|
||||||
|
// (x1) mCoreSp
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
ASM_FUNC(ReturnToCore)
|
ASM_FUNC(ArmReturnToCore)
|
||||||
// Switch to Core Stack.
|
// Switch to Core Stack.
|
||||||
mov sp, x1
|
mov sp, x1
|
||||||
// Restore registers and Stack.
|
// Restore registers and Stack.
|
||||||
|
@ -26,11 +26,20 @@ ArmCallRing3 (
|
|||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ReturnToCore (
|
ArmReturnToCore (
|
||||||
IN EFI_STATUS Status,
|
IN EFI_STATUS Status,
|
||||||
IN UINTN CoreSp
|
IN UINTN CoreSp
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
ReturnToCore (
|
||||||
|
IN EFI_STATUS Status
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ArmReturnToCore (Status, mCoreSp);
|
||||||
|
}
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -43,13 +52,6 @@ SysCallBootService (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_PHYSICAL_ADDRESS Physical;
|
EFI_PHYSICAL_ADDRESS Physical;
|
||||||
|
|
||||||
if (Type == SysCallReturnToCore) {
|
|
||||||
//
|
|
||||||
// TODO: Refactoring
|
|
||||||
//
|
|
||||||
ReturnToCore (*(EFI_STATUS *)CoreRbp, mCoreSp);
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = CoreAllocatePages (
|
Status = CoreAllocatePages (
|
||||||
AllocateAnyPages,
|
AllocateAnyPages,
|
||||||
EfiRing3MemoryType,
|
EfiRing3MemoryType,
|
||||||
|
@ -102,11 +102,13 @@ ASM_FUNC(ArmCallRing3)
|
|||||||
// VOID
|
// VOID
|
||||||
// EFIAPI
|
// EFIAPI
|
||||||
// ReturnToCore (
|
// ReturnToCore (
|
||||||
// IN EFI_STATUS Status,
|
// IN EFI_STATUS Status
|
||||||
// IN UINTN CoreSp
|
|
||||||
// );
|
// );
|
||||||
|
//
|
||||||
|
// (r0) Status
|
||||||
|
// (r1) mCoreSp
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
ASM_FUNC(ReturnToCore)
|
ASM_FUNC(ArmReturnToCore)
|
||||||
// Switch to Core Stack.
|
// Switch to Core Stack.
|
||||||
mov SP, R1
|
mov SP, R1
|
||||||
|
|
||||||
|
@ -25,11 +25,20 @@ ArmCallRing3 (
|
|||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ReturnToCore (
|
ArmReturnToCore (
|
||||||
IN EFI_STATUS Status,
|
IN EFI_STATUS Status,
|
||||||
IN UINTN CoreSp
|
IN UINTN CoreSp
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
ReturnToCore (
|
||||||
|
IN EFI_STATUS Status
|
||||||
|
)
|
||||||
|
{
|
||||||
|
ArmReturnToCore (Status, mCoreSp);
|
||||||
|
}
|
||||||
|
|
||||||
STATIC
|
STATIC
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -42,10 +51,6 @@ SysCallBootService (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_PHYSICAL_ADDRESS Physical;
|
EFI_PHYSICAL_ADDRESS Physical;
|
||||||
|
|
||||||
if (Type == SysCallReturnToCore) {
|
|
||||||
ReturnToCore (*(EFI_STATUS *)CoreRbp, mCoreSp);
|
|
||||||
}
|
|
||||||
|
|
||||||
Status = CoreAllocatePages (
|
Status = CoreAllocatePages (
|
||||||
AllocateAnyPages,
|
AllocateAnyPages,
|
||||||
EfiRing3MemoryType,
|
EfiRing3MemoryType,
|
||||||
@ -78,14 +83,16 @@ SysCallBootService (
|
|||||||
(CORE_STACK *)CoreRbp,
|
(CORE_STACK *)CoreRbp,
|
||||||
(RING3_STACK *)(UINTN)Physical
|
(RING3_STACK *)(UINTN)Physical
|
||||||
);
|
);
|
||||||
|
//
|
||||||
|
// TODO: Fix memory leak for ReturnToCore().
|
||||||
|
//
|
||||||
|
CoreFreePages (Physical, EFI_SIZE_TO_PAGES (9 * sizeof (UINTN)));
|
||||||
|
|
||||||
CoreFreePages (Physical, EFI_SIZE_TO_PAGES (9 * sizeof (UINTN)));
|
SetUefiImageMemoryAttributes (
|
||||||
|
gUartBaseAddress,
|
||||||
SetUefiImageMemoryAttributes (
|
EFI_PAGE_SIZE,
|
||||||
gUartBaseAddress,
|
EFI_MEMORY_XP | EFI_MEMORY_USER
|
||||||
EFI_PAGE_SIZE,
|
);
|
||||||
EFI_MEMORY_XP | EFI_MEMORY_USER
|
|
||||||
);
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user