Ring3: Fixed bug in IA32 SetPosition() and Open().

This commit is contained in:
Mikhail Krichanov 2024-03-25 14:37:06 +03:00
parent 2f5a386490
commit 044a40c898
2 changed files with 65 additions and 0 deletions

View File

@ -143,6 +143,29 @@ EFI_STATUS
IN UINTN Argument5
);
typedef
EFI_STATUS
(EFIAPI *FUNCTION_6)(
IN UINTN Argument1,
IN UINTN Argument2,
IN UINTN Argument3,
IN UINTN Argument4,
IN UINTN Argument5,
IN UINTN Argument6
);
typedef
EFI_STATUS
(EFIAPI *FUNCTION_7)(
IN UINTN Argument1,
IN UINTN Argument2,
IN UINTN Argument3,
IN UINTN Argument4,
IN UINTN Argument5,
IN UINTN Argument6,
IN UINTN Argument7
);
VOID
EFIAPI
Ring3Call (
@ -156,6 +179,8 @@ Ring3Call (
FUNCTION_3 Function3;
FUNCTION_4 Function4;
FUNCTION_5 Function5;
FUNCTION_6 Function6;
FUNCTION_7 Function7;
switch (Data->NumberOfArguments) {
case 0:
@ -182,6 +207,14 @@ Ring3Call (
Function5 = (FUNCTION_5)Data->EntryPoint;
Status = Function5 (Data->Arguments[0], Data->Arguments[1], Data->Arguments[2], Data->Arguments[3], Data->Arguments[4]);
break;
case 6:
Function6 = (FUNCTION_6)Data->EntryPoint;
Status = Function6 (Data->Arguments[0], Data->Arguments[1], Data->Arguments[2], Data->Arguments[3], Data->Arguments[4], Data->Arguments[5]);
break;
case 7:
Function7 = (FUNCTION_7)Data->EntryPoint;
Status = Function7 (Data->Arguments[0], Data->Arguments[1], Data->Arguments[2], Data->Arguments[3], Data->Arguments[4], Data->Arguments[5], Data->Arguments[6]);
break;
default:
Status = EFI_UNSUPPORTED;
break;

View File

@ -322,12 +322,27 @@ CoreFileSetPosition (
File = (RING3_EFI_FILE_PROTOCOL *)This;
#if defined (MDE_CPU_X64)
return GoToRing3 (
2,
(VOID *)mRing3FileProtocol.SetPosition,
File->Ring3File,
Position
);
#endif
#if defined (MDE_CPU_IA32)
//
// UINT64 Position is passed as 2 double words on stack.
//
return GoToRing3 (
3,
(VOID *)mRing3FileProtocol.SetPosition,
File->Ring3File,
Position
);
#endif
}
STATIC
@ -582,6 +597,7 @@ CoreFileOpen (
return Status;
}
#if defined (MDE_CPU_X64)
Status = GoToRing3 (
5,
(VOID *)mRing3FileProtocol.Open,
@ -591,6 +607,22 @@ CoreFileOpen (
OpenMode,
Attributes
);
#endif
#if defined (MDE_CPU_IA32)
//
// UINT64 OpenMode and Attributes are each passed as 2 double words on stack.
//
Status = GoToRing3 (
7,
(VOID *)mRing3FileProtocol.Open,
File->Ring3File,
Ring3NewHandle,
Ring3FileName,
OpenMode,
Attributes
);
#endif
if (EFI_ERROR (Status)) {
*NewHandle = NULL;
CoreFreePages (Ring3Pages, PagesNumber);