mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-30 17:14:07 +02:00
Ring3: Added NumberOfArguments to SysCall() and CallBootService().
This commit is contained in:
parent
213713f790
commit
502bafe41b
@ -2749,6 +2749,7 @@ EFI_STATUS
|
|||||||
EFIAPI
|
EFIAPI
|
||||||
CallBootService (
|
CallBootService (
|
||||||
IN UINT8 Type,
|
IN UINT8 Type,
|
||||||
|
IN UINT8 NumberOfArguments,
|
||||||
IN UINTN *UserArguments,
|
IN UINTN *UserArguments,
|
||||||
IN UINTN ReturnSP
|
IN UINTN ReturnSP
|
||||||
);
|
);
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
// EFI_STATUS
|
// EFI_STATUS
|
||||||
// EFIAPI
|
// EFIAPI
|
||||||
// SysCall (
|
// SysCall (
|
||||||
// IN UINT8 Type,
|
// IN UINT8 Type,
|
||||||
|
// IN UINT8 NumberOfArguments,
|
||||||
// ...
|
// ...
|
||||||
// );
|
// );
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -11,7 +11,8 @@
|
|||||||
// EFI_STATUS
|
// EFI_STATUS
|
||||||
// EFIAPI
|
// EFIAPI
|
||||||
// SysCall (
|
// SysCall (
|
||||||
// IN UINT8 Type,
|
// IN UINT8 Type,
|
||||||
|
// IN UINT8 NumberOfArguments,
|
||||||
// ...
|
// ...
|
||||||
// );
|
// );
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -238,7 +238,7 @@ Ring3Call (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SysCall (SysCallReturnToCore, Status);
|
SysCall (SysCallReturnToCore, 1, Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
; SPDX-License-Identifier: BSD-3-Clause
|
; SPDX-License-Identifier: BSD-3-Clause
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <Uefi/UefiSpec.h>
|
||||||
|
|
||||||
extern ASM_PFX(Ring3Call)
|
extern ASM_PFX(Ring3Call)
|
||||||
|
|
||||||
DEFAULT REL
|
DEFAULT REL
|
||||||
@ -12,18 +14,36 @@ SECTION .text
|
|||||||
; EFI_STATUS
|
; EFI_STATUS
|
||||||
; EFIAPI
|
; EFIAPI
|
||||||
; SysCall (
|
; SysCall (
|
||||||
; IN UINT8 Type,
|
; IN UINT8 Type,
|
||||||
|
; IN UINT8 NumberOfArguments,
|
||||||
; ...
|
; ...
|
||||||
; );
|
; );
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
global ASM_PFX(SysCall)
|
global ASM_PFX(SysCall)
|
||||||
ASM_PFX(SysCall):
|
ASM_PFX(SysCall):
|
||||||
|
push ebx
|
||||||
mov edx, esp
|
mov edx, esp
|
||||||
mov ecx, [esp + 4] ; Type
|
mov ecx, [esp + 4*2] ; Type
|
||||||
|
mov ebx, [esp + 4*3] ; NumberOfArguments
|
||||||
lea eax, [userReturnAddress]
|
lea eax, [userReturnAddress]
|
||||||
|
; Fixup NumberOfArguments.
|
||||||
|
cmp ecx, SC_FREE_PAGES
|
||||||
|
je fixup
|
||||||
|
cmp ecx, SC_BLOCK_IO_READ
|
||||||
|
je fixup
|
||||||
|
cmp ecx, SC_BLOCK_IO_WRITE
|
||||||
|
je fixup
|
||||||
|
cmp ecx, SC_DISK_IO_READ
|
||||||
|
je fixup
|
||||||
|
cmp ecx, SC_DISK_IO_WRITE
|
||||||
|
je fixup
|
||||||
|
jmp makecall
|
||||||
|
fixup:
|
||||||
|
add ebx, 1
|
||||||
|
makecall:
|
||||||
sysenter
|
sysenter
|
||||||
userReturnAddress:
|
userReturnAddress:
|
||||||
|
pop ebx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
SysCall (
|
SysCall (
|
||||||
IN UINT8 Type,
|
IN UINT8 Type,
|
||||||
|
IN UINT8 NumberOfArguments,
|
||||||
...
|
...
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ Ring3BlockIoReset (
|
|||||||
{
|
{
|
||||||
return SysCall (
|
return SysCall (
|
||||||
SysCallBlockIoReset,
|
SysCallBlockIoReset,
|
||||||
|
2,
|
||||||
This,
|
This,
|
||||||
ExtendedVerification
|
ExtendedVerification
|
||||||
);
|
);
|
||||||
@ -33,6 +34,7 @@ Ring3BlockIoRead (
|
|||||||
{
|
{
|
||||||
return SysCall (
|
return SysCall (
|
||||||
SysCallBlockIoRead,
|
SysCallBlockIoRead,
|
||||||
|
5,
|
||||||
This,
|
This,
|
||||||
MediaId,
|
MediaId,
|
||||||
BufferSize,
|
BufferSize,
|
||||||
@ -53,6 +55,7 @@ Ring3BlockIoWrite (
|
|||||||
{
|
{
|
||||||
return SysCall (
|
return SysCall (
|
||||||
SysCallBlockIoWrite,
|
SysCallBlockIoWrite,
|
||||||
|
5,
|
||||||
This,
|
This,
|
||||||
MediaId,
|
MediaId,
|
||||||
BufferSize,
|
BufferSize,
|
||||||
@ -69,6 +72,7 @@ Ring3BlockIoFlush (
|
|||||||
{
|
{
|
||||||
return SysCall (
|
return SysCall (
|
||||||
SysCallBlockIoFlush,
|
SysCallBlockIoFlush,
|
||||||
|
1,
|
||||||
This
|
This
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -85,6 +89,7 @@ Ring3DiskIoRead (
|
|||||||
{
|
{
|
||||||
return SysCall (
|
return SysCall (
|
||||||
SysCallDiskIoRead,
|
SysCallDiskIoRead,
|
||||||
|
5,
|
||||||
This,
|
This,
|
||||||
MediaId,
|
MediaId,
|
||||||
BufferSize,
|
BufferSize,
|
||||||
@ -105,6 +110,7 @@ Ring3DiskIoWrite (
|
|||||||
{
|
{
|
||||||
return SysCall (
|
return SysCall (
|
||||||
SysCallDiskIoWrite,
|
SysCallDiskIoWrite,
|
||||||
|
5,
|
||||||
This,
|
This,
|
||||||
MediaId,
|
MediaId,
|
||||||
BufferSize,
|
BufferSize,
|
||||||
@ -123,6 +129,7 @@ Ring3UnicodeStriColl (
|
|||||||
{
|
{
|
||||||
return (INTN)SysCall (
|
return (INTN)SysCall (
|
||||||
SysCallUnicodeStriColl,
|
SysCallUnicodeStriColl,
|
||||||
|
3,
|
||||||
This,
|
This,
|
||||||
Str1,
|
Str1,
|
||||||
Str2
|
Str2
|
||||||
@ -139,6 +146,7 @@ Ring3UnicodeMetaiMatch (
|
|||||||
{
|
{
|
||||||
return (BOOLEAN)SysCall (
|
return (BOOLEAN)SysCall (
|
||||||
SysCallUnicodeMetaiMatch,
|
SysCallUnicodeMetaiMatch,
|
||||||
|
3,
|
||||||
This,
|
This,
|
||||||
String,
|
String,
|
||||||
Pattern
|
Pattern
|
||||||
@ -154,6 +162,7 @@ Ring3UnicodeStrLwr (
|
|||||||
{
|
{
|
||||||
SysCall (
|
SysCall (
|
||||||
SysCallUnicodeStrLwr,
|
SysCallUnicodeStrLwr,
|
||||||
|
2,
|
||||||
This,
|
This,
|
||||||
Str
|
Str
|
||||||
);
|
);
|
||||||
@ -168,6 +177,7 @@ Ring3UnicodeStrUpr (
|
|||||||
{
|
{
|
||||||
SysCall (
|
SysCall (
|
||||||
SysCallUnicodeStrUpr,
|
SysCallUnicodeStrUpr,
|
||||||
|
2,
|
||||||
This,
|
This,
|
||||||
Str
|
Str
|
||||||
);
|
);
|
||||||
@ -184,6 +194,7 @@ Ring3UnicodeFatToStr (
|
|||||||
{
|
{
|
||||||
SysCall (
|
SysCall (
|
||||||
SysCallUnicodeFatToStr,
|
SysCallUnicodeFatToStr,
|
||||||
|
4,
|
||||||
This,
|
This,
|
||||||
FatSize,
|
FatSize,
|
||||||
Fat,
|
Fat,
|
||||||
@ -202,6 +213,7 @@ Ring3UnicodeStrToFat (
|
|||||||
{
|
{
|
||||||
return (BOOLEAN)SysCall (
|
return (BOOLEAN)SysCall (
|
||||||
SysCallUnicodeStrToFat,
|
SysCallUnicodeStrToFat,
|
||||||
|
4,
|
||||||
This,
|
This,
|
||||||
String,
|
String,
|
||||||
FatSize,
|
FatSize,
|
||||||
|
@ -98,6 +98,7 @@ Ring3RaiseTpl (
|
|||||||
{
|
{
|
||||||
return (EFI_TPL)SysCall (
|
return (EFI_TPL)SysCall (
|
||||||
SysCallRaiseTpl,
|
SysCallRaiseTpl,
|
||||||
|
1,
|
||||||
NewTpl
|
NewTpl
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -110,6 +111,7 @@ Ring3RestoreTpl (
|
|||||||
{
|
{
|
||||||
SysCall (
|
SysCall (
|
||||||
SysCallRestoreTpl,
|
SysCallRestoreTpl,
|
||||||
|
1,
|
||||||
NewTpl
|
NewTpl
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -127,6 +129,7 @@ Ring3AllocatePages (
|
|||||||
|
|
||||||
Status = SysCall (
|
Status = SysCall (
|
||||||
SysCallAllocatePages,
|
SysCallAllocatePages,
|
||||||
|
4,
|
||||||
Type,
|
Type,
|
||||||
EfiRing3MemoryType,
|
EfiRing3MemoryType,
|
||||||
NumberOfPages,
|
NumberOfPages,
|
||||||
@ -150,6 +153,7 @@ Ring3FreePages (
|
|||||||
|
|
||||||
Status = SysCall (
|
Status = SysCall (
|
||||||
SysCallFreePages,
|
SysCallFreePages,
|
||||||
|
2,
|
||||||
NumberOfPages,
|
NumberOfPages,
|
||||||
Memory
|
Memory
|
||||||
);
|
);
|
||||||
@ -302,6 +306,7 @@ Ring3HandleProtocol (
|
|||||||
|
|
||||||
Status = SysCall (
|
Status = SysCall (
|
||||||
SysCallHandleProtocol,
|
SysCallHandleProtocol,
|
||||||
|
3,
|
||||||
CoreUserHandle,
|
CoreUserHandle,
|
||||||
Protocol,
|
Protocol,
|
||||||
Interface
|
Interface
|
||||||
@ -511,6 +516,7 @@ Ring3OpenProtocol (
|
|||||||
|
|
||||||
Status = SysCall (
|
Status = SysCall (
|
||||||
SysCallOpenProtocol,
|
SysCallOpenProtocol,
|
||||||
|
6,
|
||||||
CoreUserHandle,
|
CoreUserHandle,
|
||||||
Protocol,
|
Protocol,
|
||||||
Interface,
|
Interface,
|
||||||
@ -536,6 +542,7 @@ Ring3CloseProtocol (
|
|||||||
{
|
{
|
||||||
return SysCall (
|
return SysCall (
|
||||||
SysCallCloseProtocol,
|
SysCallCloseProtocol,
|
||||||
|
4,
|
||||||
UserHandle,
|
UserHandle,
|
||||||
Protocol,
|
Protocol,
|
||||||
AgentHandle,
|
AgentHandle,
|
||||||
@ -587,6 +594,7 @@ Ring3LocateHandleBuffer (
|
|||||||
|
|
||||||
StatusBS = SysCall (
|
StatusBS = SysCall (
|
||||||
SysCallLocateHandleBuffer,
|
SysCallLocateHandleBuffer,
|
||||||
|
5,
|
||||||
SearchType,
|
SearchType,
|
||||||
Protocol,
|
Protocol,
|
||||||
SearchKey,
|
SearchKey,
|
||||||
@ -631,6 +639,7 @@ Ring3LocateProtocol (
|
|||||||
|
|
||||||
Status = SysCall (
|
Status = SysCall (
|
||||||
SysCallLocateProtocol,
|
SysCallLocateProtocol,
|
||||||
|
3,
|
||||||
Protocol,
|
Protocol,
|
||||||
CoreRegistration,
|
CoreRegistration,
|
||||||
Interface
|
Interface
|
||||||
@ -673,6 +682,7 @@ Ring3InstallMultipleProtocolInterfaces (
|
|||||||
|
|
||||||
return SysCall (
|
return SysCall (
|
||||||
SysCallInstallMultipleProtocolInterfaces,
|
SysCallInstallMultipleProtocolInterfaces,
|
||||||
|
2,
|
||||||
Handle,
|
Handle,
|
||||||
ArgList
|
ArgList
|
||||||
);
|
);
|
||||||
@ -700,6 +710,7 @@ Ring3CalculateCrc32 (
|
|||||||
{
|
{
|
||||||
return SysCall (
|
return SysCall (
|
||||||
SysCallCalculateCrc32,
|
SysCallCalculateCrc32,
|
||||||
|
3,
|
||||||
Data,
|
Data,
|
||||||
DataSize,
|
DataSize,
|
||||||
Crc32
|
Crc32
|
||||||
|
@ -91,6 +91,7 @@ Ring3GetVariable (
|
|||||||
{
|
{
|
||||||
return SysCall (
|
return SysCall (
|
||||||
SysCallGetVariable,
|
SysCallGetVariable,
|
||||||
|
5,
|
||||||
VariableName,
|
VariableName,
|
||||||
VendorGuid,
|
VendorGuid,
|
||||||
Attributes,
|
Attributes,
|
||||||
|
@ -12,7 +12,8 @@ SECTION .text
|
|||||||
; EFI_STATUS
|
; EFI_STATUS
|
||||||
; EFIAPI
|
; EFIAPI
|
||||||
; SysCall (
|
; SysCall (
|
||||||
; IN UINT8 Type,
|
; IN UINT8 Type,
|
||||||
|
; IN UINT8 NumberOfArguments,
|
||||||
; ...
|
; ...
|
||||||
; );
|
; );
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
@ -20,7 +21,21 @@ global ASM_PFX(SysCall)
|
|||||||
ASM_PFX(SysCall):
|
ASM_PFX(SysCall):
|
||||||
; Save Type for CoreBootServices().
|
; Save Type for CoreBootServices().
|
||||||
mov r10, rcx
|
mov r10, rcx
|
||||||
|
; Construct User Arguments[].
|
||||||
|
cmp rdx, 2
|
||||||
|
jg continue
|
||||||
|
push r9
|
||||||
|
push r8
|
||||||
|
mov r8, rsp
|
||||||
|
sub r8, 8
|
||||||
|
add rsp, 8*2
|
||||||
|
jmp makecall
|
||||||
|
continue:
|
||||||
|
mov [rsp + 8*4], r9
|
||||||
|
mov [rsp + 8*3], r8
|
||||||
|
mov r8, rsp
|
||||||
|
add r8, 8*2
|
||||||
|
makecall:
|
||||||
; SYSCALL saves RFLAGS into R11 and the RIP of the next instruction into RCX.
|
; SYSCALL saves RFLAGS into R11 and the RIP of the next instruction into RCX.
|
||||||
syscall
|
syscall
|
||||||
; SYSRET copies the value in RCX into RIP and loads RFLAGS from R11.
|
; SYSRET copies the value in RCX into RIP and loads RFLAGS from R11.
|
||||||
|
@ -39,7 +39,7 @@ SysCallBootService (
|
|||||||
Status = CoreAllocatePages (
|
Status = CoreAllocatePages (
|
||||||
AllocateAnyPages,
|
AllocateAnyPages,
|
||||||
EfiRing3MemoryType,
|
EfiRing3MemoryType,
|
||||||
EFI_SIZE_TO_PAGES (8 * sizeof (UINTN)),
|
EFI_SIZE_TO_PAGES (7 * sizeof (UINTN)),
|
||||||
&Physical
|
&Physical
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -47,16 +47,17 @@ SysCallBootService (
|
|||||||
}
|
}
|
||||||
|
|
||||||
AllowSupervisorAccessToUserMemory ();
|
AllowSupervisorAccessToUserMemory ();
|
||||||
CopyMem ((VOID *)Physical, (VOID *)&(Context.SystemContextAArch64->X0), 8 * sizeof (UINTN));
|
CopyMem ((VOID *)Physical, (VOID *)&(Context.SystemContextAArch64->X1), 7 * sizeof (UINTN));
|
||||||
ForbidSupervisorAccessToUserMemory ();
|
ForbidSupervisorAccessToUserMemory ();
|
||||||
|
|
||||||
Status = CallBootService (
|
Status = CallBootService (
|
||||||
Context.SystemContextAArch64->X0,
|
Context.SystemContextAArch64->X0,
|
||||||
|
Context.SystemContextAArch64->X1,
|
||||||
(UINTN *)Physical,
|
(UINTN *)Physical,
|
||||||
*(UINTN *)Context.SystemContextAArch64->SP
|
*(UINTN *)Context.SystemContextAArch64->SP
|
||||||
);
|
);
|
||||||
|
|
||||||
CoreFreePages (Physical, EFI_SIZE_TO_PAGES (9 * sizeof (UINTN)));
|
CoreFreePages (Physical, EFI_SIZE_TO_PAGES (7 * sizeof (UINTN)));
|
||||||
|
|
||||||
ArmDisableInterrupts ();
|
ArmDisableInterrupts ();
|
||||||
|
|
||||||
|
@ -32,13 +32,26 @@ SysCallBootService (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_PHYSICAL_ADDRESS Physical;
|
EFI_PHYSICAL_ADDRESS Physical;
|
||||||
|
UINT8 Type;
|
||||||
|
UINT8 NumberOfArguments;
|
||||||
|
|
||||||
ArmEnableInterrupts ();
|
ArmEnableInterrupts ();
|
||||||
|
|
||||||
|
Type = Context.SystemContextArm->R0;
|
||||||
|
NumberOfArguments = Context.SystemContextArm->R1;
|
||||||
|
|
||||||
|
if ((Type == SysCallFreePages)
|
||||||
|
|| (Type == SysCallBlockIoRead)
|
||||||
|
|| (Type == SysCallBlockIoWrite)
|
||||||
|
|| (Type == SysCallDiskIoRead)
|
||||||
|
|| (Type == SysCallDiskIoWrite)) {
|
||||||
|
++NumberOfArguments;
|
||||||
|
}
|
||||||
|
|
||||||
Status = CoreAllocatePages (
|
Status = CoreAllocatePages (
|
||||||
AllocateAnyPages,
|
AllocateAnyPages,
|
||||||
EfiRing3MemoryType,
|
EfiRing3MemoryType,
|
||||||
EFI_SIZE_TO_PAGES (8 * sizeof (UINTN)),
|
EFI_SIZE_TO_PAGES ((NumberOfArguments + 1) * sizeof (UINTN)),
|
||||||
&Physical
|
&Physical
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
@ -46,25 +59,47 @@ SysCallBootService (
|
|||||||
}
|
}
|
||||||
|
|
||||||
AllowSupervisorAccessToUserMemory ();
|
AllowSupervisorAccessToUserMemory ();
|
||||||
//
|
if (Type == SysCallFreePages) {
|
||||||
// First 3 arguments are passed through R1-R3 and copied to SysCall Stack.
|
//
|
||||||
//
|
// R0 == Type, R1 == NumberOfArguments, R2 == NumberOfPages, R3 == NULL
|
||||||
CopyMem ((VOID *)(UINTN)Physical, (VOID *)&(Context.SystemContextArm->R0), 4 * sizeof (UINTN));
|
// [SP] == Memory
|
||||||
//
|
// Memory is passed as 2 words on stack and aligned on 8 bytes.
|
||||||
// All remaining arguments are on User Stack.
|
//
|
||||||
//
|
CopyMem ((VOID *)(UINTN)Physical, (VOID *)&(Context.SystemContextArm->R1), 2 * sizeof (UINTN));
|
||||||
CopyMem ((VOID *)((UINTN)Physical + 4 * sizeof (UINTN)), (VOID *)Context.SystemContextArm->SP, 4 * sizeof (UINTN));
|
CopyMem (
|
||||||
|
(VOID *)((UINTN)Physical + 2 * sizeof (UINTN)),
|
||||||
|
(VOID *)Context.SystemContextArm->SP,
|
||||||
|
2 * sizeof (UINTN)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// First 2 arguments are passed through R2-R3 and copied to SysCall Stack.
|
||||||
|
//
|
||||||
|
CopyMem ((VOID *)(UINTN)Physical, (VOID *)&(Context.SystemContextArm->R1), 3 * sizeof (UINTN));
|
||||||
|
|
||||||
|
if (NumberOfArguments > 2) {
|
||||||
|
//
|
||||||
|
// All remaining arguments are on User Stack.
|
||||||
|
//
|
||||||
|
CopyMem (
|
||||||
|
(VOID *)((UINTN)Physical + 3 * sizeof (UINTN)),
|
||||||
|
(VOID *)Context.SystemContextArm->SP,
|
||||||
|
(NumberOfArguments - 2) * sizeof (UINTN)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
ForbidSupervisorAccessToUserMemory ();
|
ForbidSupervisorAccessToUserMemory ();
|
||||||
|
|
||||||
Status = CallBootService (
|
Status = CallBootService (
|
||||||
Context.SystemContextArm->R0,
|
Type,
|
||||||
|
NumberOfArguments,
|
||||||
(UINTN *)(UINTN)Physical,
|
(UINTN *)(UINTN)Physical,
|
||||||
*(UINTN *)Context.SystemContextArm->SP_EL1
|
*(UINTN *)Context.SystemContextArm->SP_EL1
|
||||||
);
|
);
|
||||||
//
|
//
|
||||||
// TODO: Fix memory leak for ReturnToCore().
|
// TODO: Fix memory leak for ReturnToCore().
|
||||||
//
|
//
|
||||||
CoreFreePages (Physical, EFI_SIZE_TO_PAGES (9 * sizeof (UINTN)));
|
CoreFreePages (Physical, EFI_SIZE_TO_PAGES ((NumberOfArguments + 1) * sizeof (UINTN)));
|
||||||
|
|
||||||
ArmDisableInterrupts ();
|
ArmDisableInterrupts ();
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ STATIC
|
|||||||
UINTN *
|
UINTN *
|
||||||
EFIAPI
|
EFIAPI
|
||||||
CopyUserArguments (
|
CopyUserArguments (
|
||||||
IN UINTN NumberOfArguments,
|
IN UINT8 NumberOfArguments,
|
||||||
IN UINTN *UserArguments
|
IN UINTN *UserArguments
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -330,6 +330,7 @@ EFI_STATUS
|
|||||||
EFIAPI
|
EFIAPI
|
||||||
CallBootService (
|
CallBootService (
|
||||||
IN UINT8 Type,
|
IN UINT8 Type,
|
||||||
|
IN UINT8 NumberOfArguments,
|
||||||
IN UINTN *UserArguments,
|
IN UINTN *UserArguments,
|
||||||
IN UINTN ReturnSP
|
IN UINTN ReturnSP
|
||||||
)
|
)
|
||||||
@ -367,13 +368,12 @@ CallBootService (
|
|||||||
Argument5 = 0;
|
Argument5 = 0;
|
||||||
Argument6 = 0;
|
Argument6 = 0;
|
||||||
Interface = NULL;
|
Interface = NULL;
|
||||||
|
Arguments = CopyUserArguments (NumberOfArguments, UserArguments);
|
||||||
|
|
||||||
DEBUG ((DEBUG_VERBOSE, "Type: %a\n", SysCallNames[Type]));
|
DEBUG ((DEBUG_VERBOSE, "Type: %a\n", SysCallNames[Type]));
|
||||||
|
|
||||||
switch (Type) {
|
switch (Type) {
|
||||||
case SysCallReturnToCore:
|
case SysCallReturnToCore:
|
||||||
Arguments = CopyUserArguments (1, UserArguments);
|
|
||||||
|
|
||||||
ReturnToCore (Arguments[1], ReturnSP);
|
ReturnToCore (Arguments[1], ReturnSP);
|
||||||
break;
|
break;
|
||||||
case SysCallLocateProtocol:
|
case SysCallLocateProtocol:
|
||||||
@ -382,8 +382,6 @@ CallBootService (
|
|||||||
// Argument 2: VOID *CoreRegistration
|
// Argument 2: VOID *CoreRegistration
|
||||||
// Argument 3: VOID **Interface
|
// Argument 3: VOID **Interface
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (3, UserArguments);
|
|
||||||
|
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[1], &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[1], &Attributes);
|
||||||
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(Arguments[1] + sizeof (EFI_GUID) - 1), &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(Arguments[1] + sizeof (EFI_GUID) - 1), &Attributes);
|
||||||
@ -428,8 +426,6 @@ CallBootService (
|
|||||||
// Argument 5: EFI_HANDLE CoreControllerHandle
|
// Argument 5: EFI_HANDLE CoreControllerHandle
|
||||||
// Argument 6: UINT32 Attributes
|
// Argument 6: UINT32 Attributes
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (6, UserArguments);
|
|
||||||
|
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[2], &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[2], &Attributes);
|
||||||
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(Arguments[2] + sizeof (EFI_GUID) - 1), &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(Arguments[2] + sizeof (EFI_GUID) - 1), &Attributes);
|
||||||
@ -476,8 +472,6 @@ CallBootService (
|
|||||||
// Argument 1: EFI_HANDLE *Handle
|
// Argument 1: EFI_HANDLE *Handle
|
||||||
// ...
|
// ...
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (2, UserArguments);
|
|
||||||
|
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[1], &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[1], &Attributes);
|
||||||
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(Arguments[1] + sizeof (EFI_HANDLE *) - 1), &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(Arguments[1] + sizeof (EFI_HANDLE *) - 1), &Attributes);
|
||||||
@ -588,8 +582,6 @@ CallBootService (
|
|||||||
// Argument 3: EFI_HANDLE CoreAgentHandle
|
// Argument 3: EFI_HANDLE CoreAgentHandle
|
||||||
// Argument 4: EFI_HANDLE CoreControllerHandle
|
// Argument 4: EFI_HANDLE CoreControllerHandle
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (4, UserArguments);
|
|
||||||
|
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[2], &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[2], &Attributes);
|
||||||
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(Arguments[2] + sizeof (EFI_GUID) - 1), &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(Arguments[2] + sizeof (EFI_GUID) - 1), &Attributes);
|
||||||
@ -619,8 +611,6 @@ CallBootService (
|
|||||||
// Argument 2: EFI_GUID *Protocol
|
// Argument 2: EFI_GUID *Protocol
|
||||||
// Argument 3: VOID **Interface
|
// Argument 3: VOID **Interface
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (3, UserArguments);
|
|
||||||
|
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[2], &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[2], &Attributes);
|
||||||
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(Arguments[2] + sizeof (EFI_GUID) - 1), &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(Arguments[2] + sizeof (EFI_GUID) - 1), &Attributes);
|
||||||
@ -663,8 +653,6 @@ CallBootService (
|
|||||||
// Argument 3: UINTN NumberOfPages
|
// Argument 3: UINTN NumberOfPages
|
||||||
// Argument 4: EFI_PHYSICAL_ADDRESS *Memory
|
// Argument 4: EFI_PHYSICAL_ADDRESS *Memory
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (4, UserArguments);
|
|
||||||
|
|
||||||
Status = gBS->AllocatePages (
|
Status = gBS->AllocatePages (
|
||||||
(EFI_ALLOCATE_TYPE)Arguments[1],
|
(EFI_ALLOCATE_TYPE)Arguments[1],
|
||||||
(EFI_MEMORY_TYPE)Arguments[2],
|
(EFI_MEMORY_TYPE)Arguments[2],
|
||||||
@ -689,8 +677,7 @@ CallBootService (
|
|||||||
// Argument 1: UINTN NumberOfPages
|
// Argument 1: UINTN NumberOfPages
|
||||||
// Argument 2: EFI_PHYSICAL_ADDRESS Memory
|
// Argument 2: EFI_PHYSICAL_ADDRESS Memory
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (3, UserArguments);
|
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[2];
|
||||||
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[2];
|
|
||||||
|
|
||||||
gCpu->GetMemoryAttributes (gCpu, PhysAddr, &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, PhysAddr, &Attributes);
|
||||||
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
||||||
@ -706,8 +693,6 @@ CallBootService (
|
|||||||
//
|
//
|
||||||
// Argument 1: EFI_TPL NewTpl
|
// Argument 1: EFI_TPL NewTpl
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (1, UserArguments);
|
|
||||||
|
|
||||||
Status = (EFI_STATUS)gBS->RaiseTPL ((EFI_TPL)Arguments[1]);
|
Status = (EFI_STATUS)gBS->RaiseTPL ((EFI_TPL)Arguments[1]);
|
||||||
|
|
||||||
FreePool (Arguments);
|
FreePool (Arguments);
|
||||||
@ -717,8 +702,6 @@ CallBootService (
|
|||||||
//
|
//
|
||||||
// Argument 1: EFI_TPL NewTpl
|
// Argument 1: EFI_TPL NewTpl
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (1, UserArguments);
|
|
||||||
|
|
||||||
gBS->RestoreTPL ((EFI_TPL)Arguments[1]);
|
gBS->RestoreTPL ((EFI_TPL)Arguments[1]);
|
||||||
|
|
||||||
FreePool (Arguments);
|
FreePool (Arguments);
|
||||||
@ -732,8 +715,6 @@ CallBootService (
|
|||||||
// Argument 4: UINTN *NumberHandles
|
// Argument 4: UINTN *NumberHandles
|
||||||
// Argument 5: EFI_HANDLE **Buffer
|
// Argument 5: EFI_HANDLE **Buffer
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (5, UserArguments);
|
|
||||||
|
|
||||||
if ((EFI_GUID *)Arguments[2] != NULL) {
|
if ((EFI_GUID *)Arguments[2] != NULL) {
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[2], &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[2], &Attributes);
|
||||||
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
||||||
@ -805,8 +786,6 @@ CallBootService (
|
|||||||
// Argument 2: UINTN DataSize
|
// Argument 2: UINTN DataSize
|
||||||
// Argument 3: UINT32 *Crc32
|
// Argument 3: UINT32 *Crc32
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (3, UserArguments);
|
|
||||||
|
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[1], &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[1], &Attributes);
|
||||||
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(Arguments[1] + Arguments[2] - 1), &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)(Arguments[1] + Arguments[2] - 1), &Attributes);
|
||||||
@ -847,8 +826,6 @@ CallBootService (
|
|||||||
// Argument 4: UINTN *DataSize
|
// Argument 4: UINTN *DataSize
|
||||||
// Argument 5: VOID *Data OPTIONAL
|
// Argument 5: VOID *Data OPTIONAL
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (5, UserArguments);
|
|
||||||
|
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[1], &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[1], &Attributes);
|
||||||
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
ASSERT ((Attributes & EFI_MEMORY_USER) != 0);
|
||||||
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[2], &Attributes);
|
gCpu->GetMemoryAttributes (gCpu, (EFI_PHYSICAL_ADDRESS)Arguments[2], &Attributes);
|
||||||
@ -938,8 +915,6 @@ CallBootService (
|
|||||||
// Argument 1: EFI_BLOCK_IO_PROTOCOL *This
|
// Argument 1: EFI_BLOCK_IO_PROTOCOL *This
|
||||||
// Argument 2: BOOLEAN ExtendedVerification
|
// Argument 2: BOOLEAN ExtendedVerification
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (2, UserArguments);
|
|
||||||
|
|
||||||
BlockIo = FindInterface (FALSE, (VOID *)Arguments[1]);
|
BlockIo = FindInterface (FALSE, (VOID *)Arguments[1]);
|
||||||
|
|
||||||
if (BlockIo == NULL) {
|
if (BlockIo == NULL) {
|
||||||
@ -963,16 +938,7 @@ CallBootService (
|
|||||||
// Argument 4: VOID *Buffer
|
// Argument 4: VOID *Buffer
|
||||||
// Argument 5: EFI_LBA Lba
|
// Argument 5: EFI_LBA Lba
|
||||||
//
|
//
|
||||||
#if defined (MDE_CPU_ARM)
|
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[5];
|
||||||
//
|
|
||||||
// EFI_LBA Lba is aligned on 8 bytes.
|
|
||||||
//
|
|
||||||
Arguments = CopyUserArguments (7, UserArguments);
|
|
||||||
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[6];
|
|
||||||
#else
|
|
||||||
Arguments = CopyUserArguments (6, UserArguments);
|
|
||||||
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[5];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BlockIo = FindInterface (FALSE, (VOID *)Arguments[1]);
|
BlockIo = FindInterface (FALSE, (VOID *)Arguments[1]);
|
||||||
|
|
||||||
@ -1017,16 +983,7 @@ CallBootService (
|
|||||||
// Argument 4: VOID *Buffer
|
// Argument 4: VOID *Buffer
|
||||||
// Argument 5: EFI_LBA Lba
|
// Argument 5: EFI_LBA Lba
|
||||||
//
|
//
|
||||||
#if defined (MDE_CPU_ARM)
|
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[5];
|
||||||
//
|
|
||||||
// EFI_LBA Lba is aligned on 8 bytes.
|
|
||||||
//
|
|
||||||
Arguments = CopyUserArguments (7, UserArguments);
|
|
||||||
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[6];
|
|
||||||
#else
|
|
||||||
Arguments = CopyUserArguments (6, UserArguments);
|
|
||||||
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[5];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
BlockIo = FindInterface (FALSE, (VOID *)Arguments[1]);
|
BlockIo = FindInterface (FALSE, (VOID *)Arguments[1]);
|
||||||
|
|
||||||
@ -1067,8 +1024,6 @@ CallBootService (
|
|||||||
//
|
//
|
||||||
// Argument 1: EFI_BLOCK_IO_PROTOCOL *This
|
// Argument 1: EFI_BLOCK_IO_PROTOCOL *This
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (1, UserArguments);
|
|
||||||
|
|
||||||
BlockIo = FindInterface (FALSE, (VOID *)Arguments[1]);
|
BlockIo = FindInterface (FALSE, (VOID *)Arguments[1]);
|
||||||
|
|
||||||
if (BlockIo == NULL) {
|
if (BlockIo == NULL) {
|
||||||
@ -1089,16 +1044,7 @@ CallBootService (
|
|||||||
// Argument 4: VOID *Buffer
|
// Argument 4: VOID *Buffer
|
||||||
// Argument 5: UINT64 Offset
|
// Argument 5: UINT64 Offset
|
||||||
//
|
//
|
||||||
#if defined (MDE_CPU_ARM)
|
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[5];
|
||||||
//
|
|
||||||
// UINT64 Offset is aligned on 8 bytes.
|
|
||||||
//
|
|
||||||
Arguments = CopyUserArguments (7, UserArguments);
|
|
||||||
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[6];
|
|
||||||
#else
|
|
||||||
Arguments = CopyUserArguments (6, UserArguments);
|
|
||||||
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[5];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DiskIo = FindInterface (FALSE, (VOID *)Arguments[1]);
|
DiskIo = FindInterface (FALSE, (VOID *)Arguments[1]);
|
||||||
|
|
||||||
@ -1143,16 +1089,7 @@ CallBootService (
|
|||||||
// Argument 4: VOID *Buffer
|
// Argument 4: VOID *Buffer
|
||||||
// Argument 5: UINT64 Offset
|
// Argument 5: UINT64 Offset
|
||||||
//
|
//
|
||||||
#if defined (MDE_CPU_ARM)
|
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[5];
|
||||||
//
|
|
||||||
// UINT64 Offset is aligned on 8 bytes.
|
|
||||||
//
|
|
||||||
Arguments = CopyUserArguments (7, UserArguments);
|
|
||||||
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[6];
|
|
||||||
#else
|
|
||||||
Arguments = CopyUserArguments (6, UserArguments);
|
|
||||||
PhysAddr = *(EFI_PHYSICAL_ADDRESS *)&Arguments[5];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DiskIo = FindInterface (FALSE, (VOID *)Arguments[1]);
|
DiskIo = FindInterface (FALSE, (VOID *)Arguments[1]);
|
||||||
|
|
||||||
@ -1195,8 +1132,6 @@ CallBootService (
|
|||||||
// Argument 2: CHAR16 *Str1
|
// Argument 2: CHAR16 *Str1
|
||||||
// Argument 3: CHAR16 *Str2
|
// Argument 3: CHAR16 *Str2
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (3, UserArguments);
|
|
||||||
|
|
||||||
Unicode = FindInterface (FALSE, (VOID *)Arguments[1]);
|
Unicode = FindInterface (FALSE, (VOID *)Arguments[1]);
|
||||||
|
|
||||||
if (Unicode == NULL) {
|
if (Unicode == NULL) {
|
||||||
@ -1263,8 +1198,6 @@ CallBootService (
|
|||||||
// Argument 2: CHAR16 *String
|
// Argument 2: CHAR16 *String
|
||||||
// Argument 3: CHAR16 *Pattern
|
// Argument 3: CHAR16 *Pattern
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (3, UserArguments);
|
|
||||||
|
|
||||||
Unicode = FindInterface (FALSE, (VOID *)Arguments[1]);
|
Unicode = FindInterface (FALSE, (VOID *)Arguments[1]);
|
||||||
|
|
||||||
if (Unicode == NULL) {
|
if (Unicode == NULL) {
|
||||||
@ -1330,8 +1263,6 @@ CallBootService (
|
|||||||
// Argument 1: EFI_UNICODE_COLLATION_PROTOCOL *This
|
// Argument 1: EFI_UNICODE_COLLATION_PROTOCOL *This
|
||||||
// Argument 2: CHAR16 *Str
|
// Argument 2: CHAR16 *Str
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (2, UserArguments);
|
|
||||||
|
|
||||||
Unicode = FindInterface (FALSE, (VOID *)Arguments[1]);
|
Unicode = FindInterface (FALSE, (VOID *)Arguments[1]);
|
||||||
|
|
||||||
if (Unicode == NULL) {
|
if (Unicode == NULL) {
|
||||||
@ -1376,8 +1307,6 @@ CallBootService (
|
|||||||
// Argument 1: EFI_UNICODE_COLLATION_PROTOCOL *This
|
// Argument 1: EFI_UNICODE_COLLATION_PROTOCOL *This
|
||||||
// Argument 2: CHAR16 *Str
|
// Argument 2: CHAR16 *Str
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (2, UserArguments);
|
|
||||||
|
|
||||||
Unicode = FindInterface (FALSE, (VOID *)Arguments[1]);
|
Unicode = FindInterface (FALSE, (VOID *)Arguments[1]);
|
||||||
|
|
||||||
if (Unicode == NULL) {
|
if (Unicode == NULL) {
|
||||||
@ -1424,8 +1353,6 @@ CallBootService (
|
|||||||
// Argument 3: CHAR8 *Fat
|
// Argument 3: CHAR8 *Fat
|
||||||
// Argument 4: CHAR16 *String
|
// Argument 4: CHAR16 *String
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (4, UserArguments);
|
|
||||||
|
|
||||||
Unicode = FindInterface (FALSE, (VOID *)Arguments[1]);
|
Unicode = FindInterface (FALSE, (VOID *)Arguments[1]);
|
||||||
|
|
||||||
if (Unicode == NULL) {
|
if (Unicode == NULL) {
|
||||||
@ -1494,8 +1421,6 @@ CallBootService (
|
|||||||
// Argument 3: UINTN FatSize
|
// Argument 3: UINTN FatSize
|
||||||
// Argument 4: CHAR8 *Fat
|
// Argument 4: CHAR8 *Fat
|
||||||
//
|
//
|
||||||
Arguments = CopyUserArguments (4, UserArguments);
|
|
||||||
|
|
||||||
Unicode = FindInterface (FALSE, (VOID *)Arguments[1]);
|
Unicode = FindInterface (FALSE, (VOID *)Arguments[1]);
|
||||||
|
|
||||||
if (Unicode == NULL) {
|
if (Unicode == NULL) {
|
||||||
|
@ -109,6 +109,7 @@ ASM_PFX(SysCallBase):
|
|||||||
; );
|
; );
|
||||||
;
|
;
|
||||||
; (eax) User return address.
|
; (eax) User return address.
|
||||||
|
; (ebx) Number of User Arguments.
|
||||||
; (ecx) Type.
|
; (ecx) Type.
|
||||||
; (edx) User Stack Pointer.
|
; (edx) User Stack Pointer.
|
||||||
;
|
;
|
||||||
@ -135,8 +136,9 @@ ASM_PFX(CoreBootServices):
|
|||||||
mov ebp, esp
|
mov ebp, esp
|
||||||
mov eax, [esp + 4*3]
|
mov eax, [esp + 4*3]
|
||||||
push eax ; ReturnSP
|
push eax ; ReturnSP
|
||||||
add edx, 4 ; User Arguments[]
|
add edx, 4*3
|
||||||
push edx
|
push edx ; User Arguments[]
|
||||||
|
push ebx ; NumberOfArguments
|
||||||
push ecx ; Type
|
push ecx ; Type
|
||||||
|
|
||||||
sti
|
sti
|
||||||
|
@ -117,13 +117,10 @@ ASM_PFX(SysCallBase):
|
|||||||
; );
|
; );
|
||||||
;
|
;
|
||||||
; (rcx) RIP of the next instruction saved by SYSCALL in SysCall().
|
; (rcx) RIP of the next instruction saved by SYSCALL in SysCall().
|
||||||
; (rdx) Argument 1 of the called function.
|
; (rdx) Number of User Arguments.
|
||||||
; (r8) Argument 2 of the called function.
|
; (r8) User Arguments[].
|
||||||
; (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 User Stack) Argument 4, 5, ...
|
|
||||||
;------------------------------------------------------------------------------
|
;------------------------------------------------------------------------------
|
||||||
global ASM_PFX(CoreBootServices)
|
global ASM_PFX(CoreBootServices)
|
||||||
ASM_PFX(CoreBootServices):
|
ASM_PFX(CoreBootServices):
|
||||||
@ -147,23 +144,14 @@ ASM_PFX(CoreBootServices):
|
|||||||
push rcx
|
push rcx
|
||||||
; Save User RFLAGS for SYSRET.
|
; Save User RFLAGS for SYSRET.
|
||||||
push r11
|
push r11
|
||||||
; Save User Arguments [1..3] on User stack.
|
|
||||||
call ASM_PFX(AllowSupervisorAccessToUserMemory)
|
|
||||||
mov rax, [rsp + 8*3]
|
|
||||||
mov [rax + 8*2], rdx
|
|
||||||
mov [rax + 8*3], r8
|
|
||||||
mov [rax + 8*4], r9
|
|
||||||
call ASM_PFX(ForbidSupervisorAccessToUserMemory)
|
|
||||||
mov rbp, rsp
|
mov rbp, rsp
|
||||||
; Reserve space on stack for 4 CallBootService arguments (NOOPT prerequisite).
|
; Reserve space on stack for 4 CallBootService arguments (NOOPT prerequisite).
|
||||||
sub rsp, 8*4
|
sub rsp, 8*4
|
||||||
|
|
||||||
; Prepare CallBootService arguments.
|
; Prepare CallBootService arguments.
|
||||||
mov rcx, r10 ; Type
|
mov rcx, r10 ; Type
|
||||||
mov rdx, [rbp + 8*3]
|
|
||||||
add rdx, 8 ; User Arguments[]
|
|
||||||
mov rax, [ASM_PFX(SysCallStackTop)]
|
mov rax, [ASM_PFX(SysCallStackTop)]
|
||||||
mov r8, [rax] ; ReturnSP
|
mov r9, [rax] ; ReturnSP
|
||||||
|
|
||||||
sti
|
sti
|
||||||
call ASM_PFX(CallBootService)
|
call ASM_PFX(CallBootService)
|
||||||
|
@ -2036,7 +2036,7 @@ typedef enum {
|
|||||||
SysCallCloseProtocol,
|
SysCallCloseProtocol,
|
||||||
SysCallHandleProtocol,
|
SysCallHandleProtocol,
|
||||||
SysCallAllocatePages,
|
SysCallAllocatePages,
|
||||||
SysCallFreePages,
|
SysCallFreePages = 7,
|
||||||
SysCallRaiseTpl,
|
SysCallRaiseTpl,
|
||||||
SysCallRestoreTpl,
|
SysCallRestoreTpl,
|
||||||
SysCallLocateHandleBuffer,
|
SysCallLocateHandleBuffer,
|
||||||
@ -2049,11 +2049,11 @@ typedef enum {
|
|||||||
// Protocols
|
// Protocols
|
||||||
//
|
//
|
||||||
SysCallBlockIoReset,
|
SysCallBlockIoReset,
|
||||||
SysCallBlockIoRead,
|
SysCallBlockIoRead = 14,
|
||||||
SysCallBlockIoWrite,
|
SysCallBlockIoWrite = 15,
|
||||||
SysCallBlockIoFlush,
|
SysCallBlockIoFlush,
|
||||||
SysCallDiskIoRead,
|
SysCallDiskIoRead = 17,
|
||||||
SysCallDiskIoWrite,
|
SysCallDiskIoWrite = 18,
|
||||||
SysCallUnicodeStriColl,
|
SysCallUnicodeStriColl,
|
||||||
SysCallUnicodeMetaiMatch,
|
SysCallUnicodeMetaiMatch,
|
||||||
SysCallUnicodeStrLwr,
|
SysCallUnicodeStrLwr,
|
||||||
@ -2064,6 +2064,11 @@ typedef enum {
|
|||||||
} SYS_CALL_TYPE;
|
} SYS_CALL_TYPE;
|
||||||
|
|
||||||
#define MAX_LIST 32
|
#define MAX_LIST 32
|
||||||
|
#define SC_FREE_PAGES 7
|
||||||
|
#define SC_BLOCK_IO_READ 14
|
||||||
|
#define SC_BLOCK_IO_WRITE 15
|
||||||
|
#define SC_DISK_IO_READ 17
|
||||||
|
#define SC_DISK_IO_WRITE 18
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the
|
/// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user