mirror of https://github.com/acidanthera/audk.git
SysCall: Refactored SysCallReturnToCore handling to fix CLANGDWARF NOOPT.
This commit is contained in:
parent
0e8c250702
commit
a29bd72a05
|
@ -45,6 +45,9 @@ SysCallBootService (
|
|||
EFI_PHYSICAL_ADDRESS Physical;
|
||||
|
||||
if (Type == SysCallReturnToCore) {
|
||||
//
|
||||
// TODO: Refactoring
|
||||
//
|
||||
ReturnToCore (*(EFI_STATUS *)CoreRbp, mCoreSp);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,12 @@ CallInstallMultipleProtocolInterfaces (
|
|||
IN VOID *Function
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
ReturnToCore (
|
||||
IN EFI_STATUS Status
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
FreeProtocolsList (
|
||||
|
@ -318,6 +324,9 @@ CallBootService (
|
|||
DEBUG ((DEBUG_VERBOSE, "Type: %a\n", SysCallNames[Type]));
|
||||
|
||||
switch (Type) {
|
||||
case SysCallReturnToCore:
|
||||
ReturnToCore (CoreRbp->Argument1);
|
||||
break;
|
||||
case SysCallLocateProtocol:
|
||||
//
|
||||
// Argument 1: EFI_GUID *Protocol
|
||||
|
|
|
@ -126,10 +126,6 @@ ASM_PFX(CoreBootServices):
|
|||
mov fs, ax
|
||||
mov gs, ax
|
||||
|
||||
; Special case for SysCallReturnToCore.
|
||||
cmp ecx, 0
|
||||
je coreReturnAddress
|
||||
|
||||
; Prepare CallBootService arguments.
|
||||
call ASM_PFX(AllowSupervisorAccessToUserMemory)
|
||||
mov eax, [edx + 4 * 4] ; User Argument 3
|
||||
|
@ -202,19 +198,23 @@ ASM_PFX(CallRing3):
|
|||
sti
|
||||
sysexit
|
||||
|
||||
coreReturnAddress:
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EFIAPI
|
||||
; ReturnToCore (
|
||||
; IN EFI_STATUS Status
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
global ASM_PFX(ReturnToCore)
|
||||
ASM_PFX(ReturnToCore):
|
||||
mov eax, [esp + 4]
|
||||
|
||||
mov esp, [ASM_PFX(CoreEsp)]
|
||||
pop esi
|
||||
pop edi
|
||||
pop ebp
|
||||
pop ebx
|
||||
|
||||
call ASM_PFX(AllowSupervisorAccessToUserMemory)
|
||||
mov eax, [edx + 2 * 4] ; User Argument 1
|
||||
push eax
|
||||
call ASM_PFX(ForbidSupervisorAccessToUserMemory)
|
||||
pop eax
|
||||
|
||||
sti
|
||||
ret
|
||||
|
||||
|
|
|
@ -132,10 +132,6 @@ ASM_PFX(CoreBootServices):
|
|||
mov fs, ax
|
||||
mov gs, ax
|
||||
|
||||
; Special case for SysCallReturnToCore.
|
||||
cmp r10, 0
|
||||
je coreReturnAddress
|
||||
|
||||
; Save User Stack pointers and switch to Core SysCall Stack.
|
||||
mov rax, [ASM_PFX(gCoreSysCallStackTop)]
|
||||
sub rax, 8
|
||||
|
@ -228,7 +224,15 @@ ASM_PFX(CallRing3):
|
|||
; Pass control to user image
|
||||
o64 sysret
|
||||
|
||||
coreReturnAddress:
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; EFIAPI
|
||||
; ReturnToCore (
|
||||
; IN EFI_STATUS Status
|
||||
; );
|
||||
;------------------------------------------------------------------------------
|
||||
global ASM_PFX(ReturnToCore)
|
||||
ASM_PFX(ReturnToCore):
|
||||
mov rsp, [ASM_PFX(CoreRsp)]
|
||||
pop r15
|
||||
pop r14
|
||||
|
@ -239,7 +243,7 @@ coreReturnAddress:
|
|||
pop rbp
|
||||
pop rbx
|
||||
|
||||
mov rax, rdx
|
||||
mov rax, rcx
|
||||
sti
|
||||
ret
|
||||
|
||||
|
|
|
@ -2017,7 +2017,7 @@ typedef enum {
|
|||
//
|
||||
// BootServices
|
||||
//
|
||||
SysCallReturnToCore, // Must always be zero for CoreBootServices.nasm.
|
||||
SysCallReturnToCore,
|
||||
SysCallLocateProtocol,
|
||||
SysCallOpenProtocol,
|
||||
SysCallInstallMultipleProtocolInterfaces,
|
||||
|
|
Loading…
Reference in New Issue