/* This is the callback that is written to the Loaded Image protocol instance on the image handle. It uninstalls all registered handlers and frees all entry stub memory. */
EFI_STATUS EFIAPI PlUnloadDebugSupportDriver(IN EFI_HANDLE ImageHandle)
/* This is the callback that is written to the Loaded Image protocol instance on the image handle. It uninstalls all registered handlers and frees all entry stub memory. */
EFI_STATUS EFIAPI PlUnloadDebugSupportDriver(IN EFI_HANDLE ImageHandle)
{
  EFI_EXCEPTION_TYPE  ExceptionType;
  for (ExceptionType = 0; ExceptionType < NUM_IDT_ENTRIES; ExceptionType++) {
    ManageIdtEntryTable (NULL, ExceptionType);
    if (IdtEntryTable[ExceptionType].StubEntry != NULL) {
      FreePool ((VOID *)(UINTN)IdtEntryTable[ExceptionType].StubEntry);
    }
  }
  FreePool (IdtEntryTable);
  return EFI_SUCCESS;
}