TianoCore EDK2 master
|
#include "DebugSupport.h"
Go to the source code of this file.
Variables | |
IDT_ENTRY * | IdtEntryTable = NULL |
IA32/x64 generic functions to support Debug Support protocol.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file PlDebugSupport.c.
EFI_STATUS EFIAPI GetMaximumProcessorIndex | ( | IN EFI_DEBUG_SUPPORT_PROTOCOL * | This, |
OUT UINTN * | MaxProcessorIndex | ||
) |
Returns the maximum value that may be used for the ProcessorIndex parameter in RegisterPeriodicCallback() and RegisterExceptionCallback().
Hard coded to support only 1 processor for now.
This | A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. |
MaxProcessorIndex | Pointer to a caller-allocated UINTN in which the maximum supported processor index is returned. Always 0 returned. |
EFI_SUCCESS | Always returned with **MaxProcessorIndex set to 0. |
Definition at line 164 of file PlDebugSupport.c.
VOID HookEntry | ( | IN EFI_EXCEPTION_TYPE | ExceptionType, |
IN CALLBACK_FUNC | NewCallback | ||
) |
Creates a nes entry stub. Then saves the current IDT entry and replaces it with an interrupt gate for the new entry point. The IdtEntryTable is updated with the new registered function.
This code executes in boot services context. The stub entry executes in interrupt context.
ExceptionType | Specifies which vector to hook. |
NewCallback | A pointer to the new function to be registered. |
Definition at line 73 of file PlDebugSupport.c.
VOID InterruptDistrubutionHub | ( | EFI_EXCEPTION_TYPE | ExceptionType, |
EFI_SYSTEM_CONTEXT_IA32 * | ContextRecord | ||
) |
Common piece of code that invokes the registered handlers.
This code executes in exception context so no efi calls are allowed. This code is called from assembly file.
ExceptionType | Exception type |
ContextRecord | System context |
Definition at line 264 of file PlDebugSupport.c.
EFI_STATUS EFIAPI InvalidateInstructionCache | ( | IN EFI_DEBUG_SUPPORT_PROTOCOL * | This, |
IN UINTN | ProcessorIndex, | ||
IN VOID * | Start, | ||
IN UINT64 | Length | ||
) |
Invalidates processor instruction cache for a memory range. Subsequent execution in this range causes a fresh memory fetch to retrieve code to be executed.
This | A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. |
ProcessorIndex | Specifies which processor's instruction cache is to be invalidated. |
Start | Specifies the physical base of the memory range to be invalidated. |
Length | Specifies the minimum number of bytes in the processor's instruction cache to invalidate. |
EFI_SUCCESS | Always returned. |
Definition at line 242 of file PlDebugSupport.c.
EFI_STATUS PlInitializeDebugSupportDriver | ( | VOID | ) |
Initializes driver's handler registration database.
This code executes in boot services context. Must be public because it's referenced from DebugSupport.c
EFI_UNSUPPORTED | If IA32/x64 processor does not support FXSTOR/FXRSTOR instructions, the context save will fail, so these processors are not supported. |
EFI_OUT_OF_RESOURCES | Fails to allocate memory. |
EFI_SUCCESS | Initializes successfully. |
Definition at line 325 of file PlDebugSupport.c.
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.
ImageHandle | The firmware allocated handle for the EFI image. |
EFI_SUCCESS | Always. |
Definition at line 291 of file PlDebugSupport.c.
VOID ReadIdtGateDescriptor | ( | IN EFI_EXCEPTION_TYPE | Vector, |
OUT IA32_IDT_GATE_DESCRIPTOR * | IdtGateDescriptor | ||
) |
Read IDT Gate Descriptor from IDT Table.
Vector | Specifies vector number. |
IdtGateDescriptor | Pointer to IDT Gate Descriptor read from IDT Table. |
Definition at line 24 of file PlDebugSupport.c.
EFI_STATUS EFIAPI RegisterExceptionCallback | ( | IN EFI_DEBUG_SUPPORT_PROTOCOL * | This, |
IN UINTN | ProcessorIndex, | ||
IN EFI_EXCEPTION_CALLBACK | ExceptionCallback, | ||
IN EFI_EXCEPTION_TYPE | ExceptionType | ||
) |
Registers a function to be called when a given processor exception occurs.
This code executes in boot services context.
This | A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. |
ProcessorIndex | Specifies which processor the callback function applies to. |
ExceptionCallback | A pointer to a function of type EXCEPTION_CALLBACK that is called when the processor exception specified by ExceptionType occurs. |
ExceptionType | Specifies which processor exception to hook. |
EFI_SUCCESS | The function completed successfully. |
EFI_ALREADY_STARTED | Non-NULL PeriodicCallback parameter when a callback function was previously registered. |
EFI_OUT_OF_RESOURCES | System has insufficient memory resources to register new callback function. |
Definition at line 217 of file PlDebugSupport.c.
EFI_STATUS EFIAPI RegisterPeriodicCallback | ( | IN EFI_DEBUG_SUPPORT_PROTOCOL * | This, |
IN UINTN | ProcessorIndex, | ||
IN EFI_PERIODIC_CALLBACK | PeriodicCallback | ||
) |
Registers a function to be called back periodically in interrupt context.
This | A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. |
ProcessorIndex | Specifies which processor the callback function applies to. |
PeriodicCallback | A pointer to a function of type PERIODIC_CALLBACK that is the main periodic entry point of the debug agent. |
EFI_SUCCESS | The function completed successfully. |
EFI_ALREADY_STARTED | Non-NULL PeriodicCallback parameter when a callback function was previously registered. |
EFI_OUT_OF_RESOURCES | System has insufficient memory resources to register new callback function. |
Definition at line 189 of file PlDebugSupport.c.
VOID UnhookEntry | ( | IN EFI_EXCEPTION_TYPE | ExceptionType | ) |
Undoes HookEntry. This code executes in boot services context.
ExceptionType | Specifies which entry to unhook |
Definition at line 125 of file PlDebugSupport.c.
VOID WriteIdtGateDescriptor | ( | EFI_EXCEPTION_TYPE | Vector, |
IA32_IDT_GATE_DESCRIPTOR * | IdtGateDescriptor | ||
) |
Write IDT Gate Descriptor into IDT Table.
Vector | Specifies vector number. |
IdtGateDescriptor | Pointer to IDT Gate Descriptor written into IDT Table. |
Definition at line 46 of file PlDebugSupport.c.
Definition at line 14 of file PlDebugSupport.c.