mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 13:44:33 +02:00
Ring3: Defined CallRing3() for AARCH64.
This commit is contained in:
parent
04c34b8135
commit
3fc05b0473
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#include <Chipset/AArch64.h>
|
||||||
|
|
||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
@ -233,6 +235,8 @@ DefaultExceptionHandler (
|
|||||||
DEBUG ((DEBUG_ERROR, "PC 0x%012lx\n", SystemContext.SystemContextAArch64->ELR));
|
DEBUG ((DEBUG_ERROR, "PC 0x%012lx\n", SystemContext.SystemContextAArch64->ELR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArmClearPan ();
|
||||||
|
|
||||||
if ((UINT64 *)SystemContext.SystemContextAArch64->FP != 0) {
|
if ((UINT64 *)SystemContext.SystemContextAArch64->FP != 0) {
|
||||||
Idx = 0;
|
Idx = 0;
|
||||||
|
|
||||||
|
@ -276,6 +276,8 @@ extern VOID *gRing3Interfaces;
|
|||||||
extern VOID *gCoreSysCallStackBase;
|
extern VOID *gCoreSysCallStackBase;
|
||||||
extern VOID *gCoreSysCallStackTop;
|
extern VOID *gCoreSysCallStackTop;
|
||||||
extern VOID *gRing3CallStackBase;
|
extern VOID *gRing3CallStackBase;
|
||||||
|
extern VOID *gRing3CallStackTop;
|
||||||
|
extern VOID *gRing3EntryPoint;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Service Initialization Functions
|
// Service Initialization Functions
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include <AsmMacroIoLibV8.h>
|
#include <AsmMacroIoLibV8.h>
|
||||||
|
|
||||||
|
.extern ASM_PFX(Ring3Call)
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// EFI_STATUS
|
// EFI_STATUS
|
||||||
// EFIAPI
|
// EFIAPI
|
||||||
@ -24,9 +26,7 @@ ASM_FUNC(SysCall)
|
|||||||
// IN RING3_CALL_DATA *Data
|
// IN RING3_CALL_DATA *Data
|
||||||
// );
|
// );
|
||||||
//
|
//
|
||||||
// (rcx) RIP of Ring3EntryPoint saved for SYSRET in CallRing3().
|
// (x0) Data
|
||||||
// (rdx) Data
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
ASM_FUNC(Ring3EntryPoint)
|
ASM_FUNC(Ring3EntryPoint)
|
||||||
|
b ASM_PFX(Ring3Call)
|
||||||
ret
|
|
||||||
|
@ -47,7 +47,37 @@ ASM_FUNC(CoreBootServices)
|
|||||||
// IN RING3_CALL_DATA *Data
|
// IN RING3_CALL_DATA *Data
|
||||||
// );
|
// );
|
||||||
//
|
//
|
||||||
// (rcx) Data
|
// (x0) Data
|
||||||
|
// (x1) gRing3CallStackTop
|
||||||
|
// (x2) gRing3EntryPoint
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
ASM_FUNC(CallRing3)
|
ASM_FUNC(ArmCallRing3)
|
||||||
ret
|
// Disable interrupts
|
||||||
|
msr daifset, #0xf
|
||||||
|
isb
|
||||||
|
|
||||||
|
// Use SP_ELx for Exception level ELx.
|
||||||
|
msr SPsel, #1
|
||||||
|
|
||||||
|
msr sp_el0, x1
|
||||||
|
|
||||||
|
msr elr_el1, x2
|
||||||
|
|
||||||
|
// Copy PSTATE to SPSR.
|
||||||
|
mrs x1, nzcv
|
||||||
|
mrs x2, pan
|
||||||
|
orr x1, x1, x2
|
||||||
|
mrs x2, daif
|
||||||
|
orr x1, x1, x2
|
||||||
|
//
|
||||||
|
// M[3:0], bits [3:0] AArch64 Exception level and selected Stack Pointer.
|
||||||
|
// 0b0000 - EL0.
|
||||||
|
// 0b0100 - EL1 with SP_EL0 (ELt).
|
||||||
|
// 0b0101 - EL1 with SP_EL1 (EL1h).
|
||||||
|
//
|
||||||
|
msr spsr_el1, x1
|
||||||
|
|
||||||
|
isb
|
||||||
|
dsb sy
|
||||||
|
|
||||||
|
eret
|
||||||
|
@ -10,6 +10,14 @@
|
|||||||
|
|
||||||
#include "DxeMain.h"
|
#include "DxeMain.h"
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
ArmCallRing3 (
|
||||||
|
IN RING3_CALL_DATA *Data,
|
||||||
|
IN VOID *StackPointer,
|
||||||
|
IN VOID *EntryPoint
|
||||||
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InitializeMsr (
|
InitializeMsr (
|
||||||
@ -59,3 +67,12 @@ EnableSMAP (
|
|||||||
{
|
{
|
||||||
ArmSetPan ();
|
ArmSetPan ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
CallRing3 (
|
||||||
|
IN RING3_CALL_DATA *Data
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return ArmCallRing3 (Data, gRing3CallStackTop, gRing3EntryPoint);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user