mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 23:54:02 +02:00
Ring3: Refactored out FunctionAddress from API.
This commit is contained in:
parent
b0c91ce70c
commit
9d5ef4f68e
@ -2839,7 +2839,6 @@ UINTN
|
|||||||
EFIAPI
|
EFIAPI
|
||||||
CoreBootServices (
|
CoreBootServices (
|
||||||
IN UINT8 Type,
|
IN UINT8 Type,
|
||||||
IN UINTN FunctionAddress,
|
|
||||||
...
|
...
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ UINTN
|
|||||||
EFIAPI
|
EFIAPI
|
||||||
CallBootService (
|
CallBootService (
|
||||||
IN UINT8 Type,
|
IN UINT8 Type,
|
||||||
IN VOID **FunctionAddress,
|
|
||||||
IN UINTN CoreRbp,
|
IN UINTN CoreRbp,
|
||||||
IN UINTN UserRsp
|
IN UINTN UserRsp
|
||||||
)
|
)
|
||||||
@ -52,11 +51,12 @@ CallBootService (
|
|||||||
|
|
||||||
// Stack:
|
// Stack:
|
||||||
// rcx - Rip for SYSCALL
|
// rcx - Rip for SYSCALL
|
||||||
// r8 - Argument 1
|
// rdx - Argument 1
|
||||||
// rbp - User Rbp
|
// rbp - User Rbp
|
||||||
// r9 - Argument 2
|
// r8 - Argument 2
|
||||||
// r11 - User data segment selector <- CoreRbp
|
// r11 - User data segment selector <- CoreRbp
|
||||||
// rsp - User Rsp
|
// rsp - User Rsp
|
||||||
|
// r9 - Argument 3
|
||||||
switch (Type) {
|
switch (Type) {
|
||||||
case SysCallLocateProtocol:
|
case SysCallLocateProtocol:
|
||||||
DisableSMAP ();
|
DisableSMAP ();
|
||||||
@ -87,7 +87,7 @@ CallBootService (
|
|||||||
}
|
}
|
||||||
|
|
||||||
DisableSMAP ();
|
DisableSMAP ();
|
||||||
*(UINTN *)(*((UINTN *)UserRsp + 5)) = (UINTN)Pointer;
|
*(UINTN *)(*((UINTN *)CoreRbp - 2)) = (UINTN)Pointer;
|
||||||
EnableSMAP ();
|
EnableSMAP ();
|
||||||
|
|
||||||
FreePool (CoreProtocol);
|
FreePool (CoreProtocol);
|
||||||
@ -97,9 +97,9 @@ CallBootService (
|
|||||||
case SysCallOpenProtocol:
|
case SysCallOpenProtocol:
|
||||||
DisableSMAP ();
|
DisableSMAP ();
|
||||||
CoreProtocol = AllocateCopyPool (sizeof (EFI_GUID), (VOID *)*((UINTN *)CoreRbp + 1));
|
CoreProtocol = AllocateCopyPool (sizeof (EFI_GUID), (VOID *)*((UINTN *)CoreRbp + 1));
|
||||||
Arg4 = (VOID *)*((UINTN *)UserRsp + 6);
|
Arg4 = (VOID *)*((UINTN *)UserRsp + 5);
|
||||||
Arg5 = (VOID *)*((UINTN *)UserRsp + 7);
|
Arg5 = (VOID *)*((UINTN *)UserRsp + 6);
|
||||||
Arg6 = (UINT32)*((UINTN *)UserRsp + 8);
|
Arg6 = (UINT32)*((UINTN *)UserRsp + 7);
|
||||||
EnableSMAP ();
|
EnableSMAP ();
|
||||||
if (CoreProtocol == NULL) {
|
if (CoreProtocol == NULL) {
|
||||||
DEBUG ((DEBUG_ERROR, "Ring0: Failed to allocate core copy of the Protocol variable.\n"));
|
DEBUG ((DEBUG_ERROR, "Ring0: Failed to allocate core copy of the Protocol variable.\n"));
|
||||||
@ -129,7 +129,7 @@ CallBootService (
|
|||||||
}
|
}
|
||||||
|
|
||||||
DisableSMAP ();
|
DisableSMAP ();
|
||||||
*(UINTN *)(*((UINTN *)UserRsp + 5)) = (UINTN)Pointer;
|
*(UINTN *)(*((UINTN *)CoreRbp - 2)) = (UINTN)Pointer;
|
||||||
EnableSMAP ();
|
EnableSMAP ();
|
||||||
|
|
||||||
FreePool (CoreProtocol);
|
FreePool (CoreProtocol);
|
||||||
|
@ -15,6 +15,7 @@ extern ASM_PFX(gCoreSysCallStackTop)
|
|||||||
; Prepare SYSRET arguments.
|
; Prepare SYSRET arguments.
|
||||||
mov rcx, [rbp + 8*4]
|
mov rcx, [rbp + 8*4]
|
||||||
pop rdx
|
pop rdx
|
||||||
|
pop rdx
|
||||||
|
|
||||||
; Switch from Core to User data segment selectors.
|
; Switch from Core to User data segment selectors.
|
||||||
pop r11
|
pop r11
|
||||||
@ -61,17 +62,16 @@ ASM_PFX(EnableSMAP):
|
|||||||
; EFIAPI
|
; EFIAPI
|
||||||
; CoreBootServices (
|
; CoreBootServices (
|
||||||
; IN UINT8 Type,
|
; IN UINT8 Type,
|
||||||
; IN UINTN FunctionAddress,
|
|
||||||
; ...
|
; ...
|
||||||
; );
|
; );
|
||||||
;
|
;
|
||||||
; (rcx) RIP of the next instruction saved by SYSCALL in SysCall().
|
; (rcx) RIP of the next instruction saved by SYSCALL in SysCall().
|
||||||
; (rdx) FunctionAddress.
|
; (rdx) Argument 1 of the called function.
|
||||||
; (r8) Argument 1 of the called function.
|
; (r8) Argument 2 of the called function.
|
||||||
; (r9) Argument 2 of the called function.
|
; (r9) Argument 3 of the called function.
|
||||||
; (r10) Type.
|
; (r10) Type.
|
||||||
; (r11) RFLAGS saved by SYSCALL in SysCall().
|
; (r11) RFLAGS saved by SYSCALL in SysCall().
|
||||||
;On stack Argument 3, 4, ...
|
;On stack Argument 4, 5, ...
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
global ASM_PFX(CoreBootServices)
|
global ASM_PFX(CoreBootServices)
|
||||||
ASM_PFX(CoreBootServices):
|
ASM_PFX(CoreBootServices):
|
||||||
@ -92,21 +92,22 @@ ASM_PFX(CoreBootServices):
|
|||||||
mov [rax], rcx
|
mov [rax], rcx
|
||||||
mov rcx, r10
|
mov rcx, r10
|
||||||
sub rax, 8
|
sub rax, 8
|
||||||
mov [rax], r8
|
mov [rax], rdx
|
||||||
sub rax, 8
|
sub rax, 8
|
||||||
mov [rax], rbp
|
mov [rax], rbp
|
||||||
sub rax, 8
|
sub rax, 8
|
||||||
mov [rax], r9
|
mov [rax], r8
|
||||||
; Save User data segment selector on Core SysCall Stack.
|
; Save User data segment selector on Core SysCall Stack.
|
||||||
sub rax, 8
|
sub rax, 8
|
||||||
mov [rax], r11
|
mov [rax], r11
|
||||||
|
|
||||||
mov r9, rsp
|
mov r8, rsp
|
||||||
|
|
||||||
mov rsp, rax
|
mov rsp, rax
|
||||||
|
|
||||||
mov rbp, rsp
|
mov rbp, rsp
|
||||||
mov r8, rbp
|
mov rdx, rbp
|
||||||
|
push r8
|
||||||
push r9
|
push r9
|
||||||
|
|
||||||
call ASM_PFX(CallBootService)
|
call ASM_PFX(CallBootService)
|
||||||
|
@ -9,7 +9,6 @@ UINTN
|
|||||||
EFIAPI
|
EFIAPI
|
||||||
SysCall (
|
SysCall (
|
||||||
IN UINT8 Type,
|
IN UINT8 Type,
|
||||||
IN UINTN FunctionAddress,
|
|
||||||
...
|
...
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -443,7 +443,6 @@ Ring3OpenProtocol (
|
|||||||
|
|
||||||
Status = (EFI_STATUS)SysCall (
|
Status = (EFI_STATUS)SysCall (
|
||||||
SysCallOpenProtocol,
|
SysCallOpenProtocol,
|
||||||
0,
|
|
||||||
CoreUserHandle,
|
CoreUserHandle,
|
||||||
Protocol,
|
Protocol,
|
||||||
Interface,
|
Interface,
|
||||||
@ -531,7 +530,6 @@ Ring3LocateProtocol (
|
|||||||
|
|
||||||
Status = (EFI_STATUS)SysCall (
|
Status = (EFI_STATUS)SysCall (
|
||||||
SysCallLocateProtocol,
|
SysCallLocateProtocol,
|
||||||
0,
|
|
||||||
Protocol,
|
Protocol,
|
||||||
CoreRegistration,
|
CoreRegistration,
|
||||||
Interface
|
Interface
|
||||||
|
@ -35,3 +35,7 @@
|
|||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
DebugLib
|
DebugLib
|
||||||
|
|
||||||
|
[Protocols]
|
||||||
|
gEfiDevicePathUtilitiesProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
|
gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
; EFIAPI
|
; EFIAPI
|
||||||
; SysCall (
|
; SysCall (
|
||||||
; IN UINT8 Type,
|
; IN UINT8 Type,
|
||||||
; IN UINTN FunctionAddress,
|
|
||||||
; ...
|
; ...
|
||||||
; );
|
; );
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user