Ring3: Defined ReturnToCore() for ARM.

This commit is contained in:
Mikhail Krichanov 2024-07-09 14:03:39 +03:00
parent c40371524e
commit 84ba03fefc
2 changed files with 38 additions and 2 deletions

View File

@ -80,8 +80,8 @@ ASM_FUNC(ArmCallRing3)
// Disable interrupts. // Disable interrupts.
mrs R4, CPSR mrs R4, CPSR
orr R5, R4, #0x80 cpsid if
msr CPSR_c, R5 isb
// Set SP_usr to gRing3CallStackTop. // Set SP_usr to gRing3CallStackTop.
push {R1} push {R1}
@ -100,6 +100,31 @@ ASM_FUNC(ArmCallRing3)
push {R2} push {R2}
rfefd SP rfefd SP
//------------------------------------------------------------------------------
// VOID
// EFIAPI
// ReturnToCore (
// IN EFI_STATUS Status,
// IN UINTN CoreSp
// );
//------------------------------------------------------------------------------
ASM_FUNC(ReturnToCore)
// Switch to Core Stack.
mov SP, R1
// Restore registers and Stack.
#if (FixedPcdGet32(PcdVFPEnabled))
vpop {d0-d15}
#endif
pop {R4-R12, LR}
// Enable interrupts.
cpsie if
isb
bx LR
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// VOID // VOID
// EFIAPI // EFIAPI

View File

@ -22,6 +22,13 @@ ArmCallRing3 (
IN VOID *CoreStack IN VOID *CoreStack
); );
VOID
EFIAPI
ReturnToCore (
IN EFI_STATUS Status,
IN UINTN CoreSp
);
VOID VOID
EFIAPI EFIAPI
ArmSetPan ( ArmSetPan (
@ -46,6 +53,10 @@ 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,