X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FInclude%2FProtocol%2FDebugSupport.h;h=deb9c29016038ae9f2971b68ef612e69bb909dc2;hb=6d3ea23f1183f3378a53e44d34c0a27aebec7d9a;hp=8313bf5b5d93dd4b43b9ae5a0fda7967af83b4a8;hpb=77206d75adb5b2f1763352e57e5211edb07a6101;p=mirror_edk2.git diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h index 8313bf5b5d..deb9c29016 100644 --- a/MdePkg/Include/Protocol/DebugSupport.h +++ b/MdePkg/Include/Protocol/DebugSupport.h @@ -5,7 +5,7 @@ The DebugSupport protocol is used by source level debuggers to abstract the processor and handle context save and restore operations. - Copyright (c) 2006, Intel Corporation + Copyright (c) 2006 - 2009, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -14,31 +14,33 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - Module Name: DebugSupport.h - **/ #ifndef __DEBUG_SUPPORT_H__ #define __DEBUG_SUPPORT_H__ +#include +#include + typedef struct _EFI_DEBUG_SUPPORT_PROTOCOL EFI_DEBUG_SUPPORT_PROTOCOL; -// -// Debug Support protocol {2755590C-6F3C-42FA-9EA4-A3BA543CDA25} -// +/// +/// Debug Support protocol {2755590C-6F3C-42FA-9EA4-A3BA543CDA25} +/// #define EFI_DEBUG_SUPPORT_PROTOCOL_GUID \ { \ 0x2755590C, 0x6F3C, 0x42FA, {0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 } \ } -// -// Debug Support definitions -// +/// +/// Processor exception to be hooked. +/// All exception types for IA32, X64, Itanium and EBC processors are defined. +/// typedef INTN EFI_EXCEPTION_TYPE; -// -// IA-32 processor exception types -// +/// +/// IA-32 processor exception types +/// #define EXCEPT_IA32_DIVIDE_ERROR 0 #define EXCEPT_IA32_DEBUG 1 #define EXCEPT_IA32_NMI 2 @@ -57,13 +59,10 @@ typedef INTN EFI_EXCEPTION_TYPE; #define EXCEPT_IA32_MACHINE_CHECK 18 #define EXCEPT_IA32_SIMD 19 -// -// IA-32 processor context definition -// -// -// FXSAVE_STATE -// FP / MMX / XMM registers (see fxrstor instruction definition) -// +/// +/// FXSAVE_STATE +/// FP / MMX / XMM registers (see fxrstor instruction definition) +/// typedef struct { UINT16 Fcw; UINT16 Fsw; @@ -75,7 +74,6 @@ typedef struct { UINT32 DataOffset; UINT16 Ds; UINT8 Reserved2[10]; -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) UINT8 St0Mm0[10], Reserved3[6]; UINT8 St1Mm1[10], Reserved4[6]; UINT8 St2Mm2[10], Reserved5[6]; @@ -94,26 +92,13 @@ typedef struct { UINT8 Xmm7[16]; UINT8 Reserved11[14 * 16]; } EFI_FX_SAVE_STATE_IA32; -#else - UINT8 St0Mm0[10], Reserved3[6]; - UINT8 St0Mm1[10], Reserved4[6]; - UINT8 St0Mm2[10], Reserved5[6]; - UINT8 St0Mm3[10], Reserved6[6]; - UINT8 St0Mm4[10], Reserved7[6]; - UINT8 St0Mm5[10], Reserved8[6]; - UINT8 St0Mm6[10], Reserved9[6]; - UINT8 St0Mm7[10], Reserved10[6]; - UINT8 Reserved11[22 * 16]; -} EFI_FX_SAVE_STATE; -#endif +/// +/// IA-32 processor context definition +/// typedef struct { UINT32 ExceptionData; -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) EFI_FX_SAVE_STATE_IA32 FxSaveState; -#else - EFI_FX_SAVE_STATE FxSaveState; -#endif UINT32 Dr0; UINT32 Dr1; UINT32 Dr2; @@ -147,9 +132,9 @@ typedef struct { UINT32 Eax; } EFI_SYSTEM_CONTEXT_IA32; -// -// X64 processor exception types -// +/// +/// x64 processor exception types +/// #define EXCEPT_X64_DIVIDE_ERROR 0 #define EXCEPT_X64_DEBUG 1 #define EXCEPT_X64_NMI 2 @@ -168,12 +153,10 @@ typedef struct { #define EXCEPT_X64_MACHINE_CHECK 18 #define EXCEPT_X64_SIMD 19 -// -// X64 processor context definition -// -// FXSAVE_STATE -// FP / MMX / XMM registers (see fxrstor instruction definition) -// +/// +/// FXSAVE_STATE +/// FP / MMX / XMM registers (see fxrstor instruction definition) +/// typedef struct { UINT16 Fcw; UINT16 Fsw; @@ -198,25 +181,15 @@ typedef struct { UINT8 Xmm5[16]; UINT8 Xmm6[16]; UINT8 Xmm7[16]; -#if (EFI_SPECIFICATION_VERSION >= 0x00020000) // - // NOTE: UEFI 2.0 spec definition as follows. It should be updated - // after spec update. + // NOTE: UEFI 2.0 spec definition as follows. // UINT8 Reserved11[14 * 16]; -#else - UINT8 Xmm8[16]; - UINT8 Xmm9[16]; - UINT8 Xmm10[16]; - UINT8 Xmm11[16]; - UINT8 Xmm12[16]; - UINT8 Xmm13[16]; - UINT8 Xmm14[16]; - UINT8 Xmm15[16]; - UINT8 Reserved10[6 * 16]; -#endif } EFI_FX_SAVE_STATE_X64; +/// +/// x64 processor context definition +/// typedef struct { UINT64 ExceptionData; EFI_FX_SAVE_STATE_X64 FxSaveState; @@ -262,9 +235,9 @@ typedef struct { UINT64 R15; } EFI_SYSTEM_CONTEXT_X64; -// -// IPF processor exception types -// +/// +/// Itanium Processor Family Exception types +/// #define EXCEPT_IPF_VHTP_TRANSLATION 0 #define EXCEPT_IPF_INSTRUCTION_TLB 1 #define EXCEPT_IPF_DATA_TLB 2 @@ -307,9 +280,9 @@ typedef struct { #define EXCEPT_IPF_IA32_INTERCEPT 46 #define EXCEPT_IPF_IA32_INTERRUPT 47 -// -// IPF processor context definition -// +/// +/// IPF processor context definition +/// typedef struct { // // The first reserved field is necessary to preserve alignment for the correct @@ -463,28 +436,28 @@ typedef struct { } EFI_SYSTEM_CONTEXT_IPF; -// -// EBC processor exception types -// +/// +/// EBC processor exception types +/// #define EXCEPT_EBC_UNDEFINED 0 #define EXCEPT_EBC_DIVIDE_ERROR 1 #define EXCEPT_EBC_DEBUG 2 #define EXCEPT_EBC_BREAKPOINT 3 #define EXCEPT_EBC_OVERFLOW 4 -#define EXCEPT_EBC_INVALID_OPCODE 5 // opcode out of range +#define EXCEPT_EBC_INVALID_OPCODE 5 ///< opcode out of range #define EXCEPT_EBC_STACK_FAULT 6 #define EXCEPT_EBC_ALIGNMENT_CHECK 7 -#define EXCEPT_EBC_INSTRUCTION_ENCODING 8 // malformed instruction -#define EXCEPT_EBC_BAD_BREAK 9 // BREAK 0 or undefined BREAK -#define EXCEPT_EBC_STEP 10 // to support debug stepping -// -// For coding convenience, define the maximum valid EBC exception. -// +#define EXCEPT_EBC_INSTRUCTION_ENCODING 8 ///< malformed instruction +#define EXCEPT_EBC_BAD_BREAK 9 ///< BREAK 0 or undefined BREAK +#define EXCEPT_EBC_STEP 10 ///< to support debug stepping +/// +/// For coding convenience, define the maximum valid EBC exception. +/// #define MAX_EBC_EXCEPTION EXCEPT_EBC_STEP -// -// EBC processor context definition -// +/// +/// EBC processor context definition +/// typedef struct { UINT64 R0; UINT64 R1; @@ -499,9 +472,9 @@ typedef struct { UINT64 Ip; } EFI_SYSTEM_CONTEXT_EBC; -// -// Universal EFI_SYSTEM_CONTEXT definition -// +/// +/// Universal EFI_SYSTEM_CONTEXT definition +/// typedef union { EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc; EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32; @@ -516,13 +489,13 @@ typedef union { /** Registers and enables an exception callback function for the specified exception. - @param ExceptionType Exception types in EBC, IA-32, X64, or IPF + @param ExceptionType Exception types in EBC, IA-32, x64, or IPF @param SystemContext Exception content. **/ typedef VOID -(*EFI_EXCEPTION_CALLBACK) ( +(EFIAPI *EFI_EXCEPTION_CALLBACK)( IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext ); @@ -535,18 +508,18 @@ VOID **/ typedef VOID -(*EFI_PERIODIC_CALLBACK) ( +(EFIAPI *EFI_PERIODIC_CALLBACK)( IN OUT EFI_SYSTEM_CONTEXT SystemContext ); -// -// Machine type definition -// +/// +/// Machine type definition +/// typedef enum { - IsaIa32 = IMAGE_FILE_MACHINE_I386, // 0x014C - IsaX64 = IMAGE_FILE_MACHINE_X64, // 0x8664 - IsaIpf = IMAGE_FILE_MACHINE_IA64, // 0x0200 - IsaEbc = IMAGE_FILE_MACHINE_EBC // 0x0EBC + IsaIa32 = IMAGE_FILE_MACHINE_I386, ///< 0x014C + IsaX64 = IMAGE_FILE_MACHINE_X64, ///< 0x8664 + IsaIpf = IMAGE_FILE_MACHINE_IA64, ///< 0x0200 + IsaEbc = IMAGE_FILE_MACHINE_EBC ///< 0x0EBC } EFI_INSTRUCTION_SET_ARCHITECTURE; @@ -567,7 +540,7 @@ typedef enum { **/ typedef EFI_STATUS -(EFIAPI *EFI_GET_MAXIMUM_PROCESSOR_INDEX) ( +(EFIAPI *EFI_GET_MAXIMUM_PROCESSOR_INDEX)( IN EFI_DEBUG_SUPPORT_PROTOCOL *This, OUT UINTN *MaxProcessorIndex ); @@ -589,7 +562,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_REGISTER_PERIODIC_CALLBACK) ( +(EFIAPI *EFI_REGISTER_PERIODIC_CALLBACK)( IN EFI_DEBUG_SUPPORT_PROTOCOL *This, IN UINTN ProcessorIndex, IN EFI_PERIODIC_CALLBACK PeriodicCallback @@ -600,7 +573,7 @@ EFI_STATUS @param This A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance. @param ProcessorIndex Specifies which processor the callback function applies to. - @param PeriodicCallback A pointer to a function of type EXCEPTION_CALLBACK that is called + @param ExceptionCallback A pointer to a function of type EXCEPTION_CALLBACK that is called when the processor exception specified by ExceptionType occurs. @param ExceptionType Specifies which processor exception to hook. @@ -613,7 +586,7 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_REGISTER_EXCEPTION_CALLBACK) ( +(EFIAPI *EFI_REGISTER_EXCEPTION_CALLBACK)( IN EFI_DEBUG_SUPPORT_PROTOCOL *This, IN UINTN ProcessorIndex, IN EFI_EXCEPTION_CALLBACK ExceptionCallback, @@ -635,17 +608,22 @@ EFI_STATUS **/ typedef EFI_STATUS -(EFIAPI *EFI_INVALIDATE_INSTRUCTION_CACHE) ( +(EFIAPI *EFI_INVALIDATE_INSTRUCTION_CACHE)( IN EFI_DEBUG_SUPPORT_PROTOCOL *This, IN UINTN ProcessorIndex, IN VOID *Start, IN UINT64 Length ); -// -// DebugSupport protocol definition -// +/// +/// This protocol provides the services to allow the debug agent to register +/// callback functions that are called either periodically or when specific +/// processor exceptions occur. +/// struct _EFI_DEBUG_SUPPORT_PROTOCOL { + /// + /// Declares the processor architecture for this instance of the EFI Debug Support protocol. + /// EFI_INSTRUCTION_SET_ARCHITECTURE Isa; EFI_GET_MAXIMUM_PROCESSOR_INDEX GetMaximumProcessorIndex; EFI_REGISTER_PERIODIC_CALLBACK RegisterPeriodicCallback;