SysCall: Made CoreSp STATIC, fixed UserRsp for AARCH64.

This commit is contained in:
Mikhail Krichanov 2024-05-27 13:18:02 +03:00
parent 538d1bbb8b
commit 12c9c0a53d

View File

@ -11,7 +11,7 @@
#include "DxeMain.h" #include "DxeMain.h"
UINTN CoreSp; STATIC UINTN mCoreSp;
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
@ -30,6 +30,7 @@ ReturnToCore (
IN UINTN CoreSp IN UINTN CoreSp
); );
STATIC
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
SysCallBootService ( SysCallBootService (
@ -42,13 +43,13 @@ SysCallBootService (
EFI_PHYSICAL_ADDRESS Physical; EFI_PHYSICAL_ADDRESS Physical;
if (Type == SysCallReturnToCore) { if (Type == SysCallReturnToCore) {
ReturnToCore (*(EFI_STATUS *)CoreRbp, CoreSp); ReturnToCore (*(EFI_STATUS *)CoreRbp, mCoreSp);
} }
Status = CoreAllocatePages ( Status = CoreAllocatePages (
AllocateAnyPages, AllocateAnyPages,
EfiRing3MemoryType, EfiRing3MemoryType,
EFI_SIZE_TO_PAGES (8 * sizeof (UINTN)), EFI_SIZE_TO_PAGES (9 * sizeof (UINTN)),
&Physical &Physical
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -56,7 +57,7 @@ SysCallBootService (
} }
DisableSMAP (); DisableSMAP ();
CopyMem ((VOID *)(UINTN)Physical, (VOID *)UserRsp, 8 * sizeof (UINTN)); CopyMem ((VOID *)((UINTN)Physical + sizeof (UINTN)), (VOID *)UserRsp, 8 * sizeof (UINTN));
EnableSMAP (); EnableSMAP ();
Status = CallBootService ( Status = CallBootService (
@ -65,7 +66,7 @@ SysCallBootService (
(RING3_STACK *)(UINTN)Physical (RING3_STACK *)(UINTN)Physical
); );
CoreFreePages (Physical, EFI_SIZE_TO_PAGES (8 * sizeof (UINTN))); CoreFreePages (Physical, EFI_SIZE_TO_PAGES (9 * sizeof (UINTN)));
return Status; return Status;
} }
@ -128,5 +129,5 @@ CallRing3 (
IN RING3_CALL_DATA *Data IN RING3_CALL_DATA *Data
) )
{ {
return ArmCallRing3 (Data, gRing3CallStackTop, gRing3EntryPoint, gCoreSysCallStackTop, &CoreSp); return ArmCallRing3 (Data, gRing3CallStackTop, gRing3EntryPoint, gCoreSysCallStackTop, &mCoreSp);
} }