Skip to content

Commit

Permalink
Ring3: Added SysCallCloseProtocol.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Krichanov committed Feb 22, 2024
1 parent 031adc2 commit 9d797a6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
8 changes: 7 additions & 1 deletion MdeModulePkg/Core/Dxe/DxeRing3/Ring3UefiBootServices.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,13 @@ Ring3CloseProtocol (
IN EFI_HANDLE ControllerHandle
)
{
return EFI_UNSUPPORTED;
return SysCall (
SysCallCloseProtocol,
UserHandle,
Protocol,
AgentHandle,
ControllerHandle
);
}

EFI_STATUS
Expand Down
28 changes: 27 additions & 1 deletion MdeModulePkg/Core/Dxe/SysCall/BootServices.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ CallBootService (

case SysCallFreePool:
//
// Argument 1: IN VOID *Buffer
// Argument 1: VOID *Buffer
//
DisableSMAP ();
Status = gBS->FreePool (
Expand All @@ -298,6 +298,32 @@ CallBootService (

return Status;

case SysCallCloseProtocol:
//
// Argument 1: EFI_HANDLE CoreUserHandle
// Argument 2: EFI_GUID *Protocol
// Argument 3: EFI_HANDLE CoreAgentHandle
// Argument 4: EFI_HANDLE CoreControllerHandle
//
DisableSMAP ();
Status = FindGuid ((EFI_GUID *)CoreRbp->Argument2, &CoreProtocol, &MemoryCoreSize);
if (EFI_ERROR (Status)) {
EnableSMAP ();
return Status;
}

Argument4 = UserRsp->Arguments[4];
EnableSMAP ();

Status = gBS->CloseProtocol (
(EFI_HANDLE)CoreRbp->Argument1,
CoreProtocol,
(EFI_HANDLE)CoreRbp->Argument3,
(EFI_HANDLE)Argument4
);

return Status;

case SysCallBlockIoReset:
//
// Argument 1: EFI_BLOCK_IO_PROTOCOL *This
Expand Down
1 change: 1 addition & 0 deletions MdePkg/Include/Uefi/UefiSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -1969,6 +1969,7 @@ typedef enum {
SysCallInstallMultipleProtocolInterfaces,
SysCallAllocatePool,
SysCallFreePool,
SysCallCloseProtocol,
//
// Protocols
//
Expand Down

0 comments on commit 9d797a6

Please sign in to comment.