mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
Ring3: Defined CallRing3() for ARM.
This commit is contained in:
parent
618149a40d
commit
ae234e908f
@ -5,6 +5,8 @@
|
||||
|
||||
#include <AsmMacroIoLib.h>
|
||||
|
||||
.extern ASM_PFX(Ring3Call)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// EFI_STATUS
|
||||
// EFIAPI
|
||||
@ -14,8 +16,8 @@
|
||||
// );
|
||||
//------------------------------------------------------------------------------
|
||||
ASM_FUNC(SysCall)
|
||||
|
||||
bx LR
|
||||
svc #0
|
||||
bx LR
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// VOID
|
||||
@ -24,9 +26,7 @@ ASM_FUNC(SysCall)
|
||||
// IN RING3_CALL_DATA *Data
|
||||
// );
|
||||
//
|
||||
// (rcx) RIP of Ring3EntryPoint saved for SYSRET in CallRing3().
|
||||
// (rdx) Data
|
||||
// (r0) Data
|
||||
//------------------------------------------------------------------------------
|
||||
ASM_FUNC(Ring3EntryPoint)
|
||||
|
||||
bx LR
|
||||
b ASM_PFX(Ring3Call)
|
||||
|
@ -91,7 +91,7 @@ ASM_FUNC(ArmCallRing3)
|
||||
// Prepare Ring3 SP and EntryPoint.
|
||||
msr sp_el0, x1
|
||||
msr elr_el1, x2
|
||||
// Save Core SP and switch to Ring3Call Stack.
|
||||
// Save Core SP and switch to CoreSysCall Stack.
|
||||
mov x5, sp
|
||||
str x5, [x4]
|
||||
mov sp, x3
|
||||
|
@ -49,10 +49,45 @@ ASM_FUNC(CoreBootServices)
|
||||
// IN RING3_CALL_DATA *Data
|
||||
// );
|
||||
//
|
||||
// (rcx) Data
|
||||
// (r0) Data
|
||||
// (r1) gRing3CallStackTop
|
||||
// (r2) gRing3EntryPoint
|
||||
// (r3) gCoreSysCallStackTop
|
||||
//
|
||||
// (On Core Stack) &CoreSp
|
||||
//------------------------------------------------------------------------------
|
||||
ASM_FUNC(CallRing3)
|
||||
bx LR
|
||||
ASM_FUNC(ArmCallRing3)
|
||||
// Save registers.
|
||||
push {R4-R12, LR}
|
||||
// R6 is &CoreSp
|
||||
ldr R6, [SP, #0x28]
|
||||
|
||||
#if (FixedPcdGet32(PcdVFPEnabled))
|
||||
// Save vstm registers in case they are used in optimizations.
|
||||
vpush {d0-d15}
|
||||
#endif
|
||||
|
||||
// Disable interrupts.
|
||||
mrs R4, CPSR
|
||||
orr R5, R4, #0x80
|
||||
msr CPSR_c, R5
|
||||
|
||||
// Set SP_usr to gRing3CallStackTop.
|
||||
push {R1}
|
||||
mov R1, SP
|
||||
ldmia R1, {SP}^
|
||||
pop {R1}
|
||||
// Set SPSR M[3:0] bits to User mode.
|
||||
and R4, R4, #0xFFFFFFF0
|
||||
|
||||
// Save Core SP and switch to CoreSysCall Stack.
|
||||
mov R5, SP
|
||||
str R5, [R6]
|
||||
mov SP, R3
|
||||
|
||||
push {R4}
|
||||
push {R2}
|
||||
rfefd SP
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// VOID
|
||||
|
@ -9,6 +9,18 @@
|
||||
|
||||
#include "DxeMain.h"
|
||||
|
||||
STATIC UINTN mCoreSp;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ArmCallRing3 (
|
||||
IN RING3_CALL_DATA *Data,
|
||||
IN VOID *StackPointer,
|
||||
IN VOID *EntryPoint,
|
||||
IN VOID *SysCallStack,
|
||||
IN VOID *CoreStack
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
ArmSetPan (
|
||||
@ -35,7 +47,7 @@ InitializeMsr (
|
||||
ArmSetPan ();
|
||||
} else {
|
||||
DEBUG ((DEBUG_ERROR, "Core: Failed to initialize MSRs for Ring3.\n"));
|
||||
ASSERT (FALSE);
|
||||
// ASSERT (FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,7 +57,9 @@ DisableSMAP (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
ArmClearPan ();
|
||||
if (ArmHasPan ()) {
|
||||
ArmClearPan ();
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
@ -54,5 +68,16 @@ EnableSMAP (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
ArmSetPan ();
|
||||
if (ArmHasPan ()) {
|
||||
ArmSetPan ();
|
||||
}
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CallRing3 (
|
||||
IN RING3_CALL_DATA *Data
|
||||
)
|
||||
{
|
||||
return ArmCallRing3 (Data, gRing3CallStackTop, gRing3EntryPoint, gCoreSysCallStackTop, &mCoreSp);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user