X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FInclude%2FProtocol%2FDebugSupport.h;h=52c4042bacee3a457b53059e3a7d81332642a1da;hb=b88df76120d228a5d27f48577f629671682475eb;hp=c16cf4412032ef3cfd90a2160858c353da83194e;hpb=19bee90c32772dd225332193858d9c2fcd2930aa;p=mirror_edk2.git diff --git a/MdePkg/Include/Protocol/DebugSupport.h b/MdePkg/Include/Protocol/DebugSupport.h index c16cf44120..52c4042bac 100644 --- a/MdePkg/Include/Protocol/DebugSupport.h +++ b/MdePkg/Include/Protocol/DebugSupport.h @@ -1,45 +1,47 @@ /** @file - DebugSupport protocol and supporting definitions as defined in the UEFI2.0 + DebugSupport protocol and supporting definitions as defined in the UEFI2.4 specification. 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 - 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 - http://opensource.org/licenses/bsd-license.php +Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +This program and the accompanying materials are licensed and made available under +the terms and conditions of the BSD License that accompanies this distribution. +The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php. + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #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 @@ -58,13 +60,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; @@ -95,6 +94,9 @@ typedef struct { UINT8 Reserved11[14 * 16]; } EFI_FX_SAVE_STATE_IA32; +/// +/// IA-32 processor context definition. +/// typedef struct { UINT32 ExceptionData; EFI_FX_SAVE_STATE_IA32 FxSaveState; @@ -131,9 +133,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 @@ -152,12 +154,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; @@ -188,6 +188,9 @@ typedef struct { UINT8 Reserved11[14 * 16]; } EFI_FX_SAVE_STATE_X64; +/// +/// x64 processor context definition. +/// typedef struct { UINT64 ExceptionData; EFI_FX_SAVE_STATE_X64 FxSaveState; @@ -233,9 +236,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 @@ -278,13 +281,13 @@ 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 - // bits in UNAT and to insure F2 is 16 byte aligned.. + // bits in UNAT and to insure F2 is 16 byte aligned. // UINT64 Reserved; UINT64 R1; @@ -434,28 +437,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; @@ -470,14 +473,153 @@ typedef struct { UINT64 Ip; } EFI_SYSTEM_CONTEXT_EBC; -// -// Universal EFI_SYSTEM_CONTEXT definition -// + + +/// +/// ARM processor exception types. +/// +#define EXCEPT_ARM_RESET 0 +#define EXCEPT_ARM_UNDEFINED_INSTRUCTION 1 +#define EXCEPT_ARM_SOFTWARE_INTERRUPT 2 +#define EXCEPT_ARM_PREFETCH_ABORT 3 +#define EXCEPT_ARM_DATA_ABORT 4 +#define EXCEPT_ARM_RESERVED 5 +#define EXCEPT_ARM_IRQ 6 +#define EXCEPT_ARM_FIQ 7 + +/// +/// For coding convenience, define the maximum valid ARM exception. +/// +#define MAX_ARM_EXCEPTION EXCEPT_ARM_FIQ + +/// +/// ARM processor context definition. +/// +typedef struct { + UINT32 R0; + UINT32 R1; + UINT32 R2; + UINT32 R3; + UINT32 R4; + UINT32 R5; + UINT32 R6; + UINT32 R7; + UINT32 R8; + UINT32 R9; + UINT32 R10; + UINT32 R11; + UINT32 R12; + UINT32 SP; + UINT32 LR; + UINT32 PC; + UINT32 CPSR; + UINT32 DFSR; + UINT32 DFAR; + UINT32 IFSR; + UINT32 IFAR; +} EFI_SYSTEM_CONTEXT_ARM; + + +/// +/// AARCH64 processor exception types. +/// +#define EXCEPT_AARCH64_SYNCHRONOUS_EXCEPTIONS 0 +#define EXCEPT_AARCH64_IRQ 1 +#define EXCEPT_AARCH64_FIQ 2 +#define EXCEPT_AARCH64_SERROR 3 + +/// +/// For coding convenience, define the maximum valid ARM exception. +/// +#define MAX_AARCH64_EXCEPTION EXCEPT_AARCH64_SERROR + +typedef struct { + // General Purpose Registers + UINT64 X0; + UINT64 X1; + UINT64 X2; + UINT64 X3; + UINT64 X4; + UINT64 X5; + UINT64 X6; + UINT64 X7; + UINT64 X8; + UINT64 X9; + UINT64 X10; + UINT64 X11; + UINT64 X12; + UINT64 X13; + UINT64 X14; + UINT64 X15; + UINT64 X16; + UINT64 X17; + UINT64 X18; + UINT64 X19; + UINT64 X20; + UINT64 X21; + UINT64 X22; + UINT64 X23; + UINT64 X24; + UINT64 X25; + UINT64 X26; + UINT64 X27; + UINT64 X28; + UINT64 FP; // x29 - Frame pointer + UINT64 LR; // x30 - Link Register + UINT64 SP; // x31 - Stack pointer + + // FP/SIMD Registers + UINT64 V0[2]; + UINT64 V1[2]; + UINT64 V2[2]; + UINT64 V3[2]; + UINT64 V4[2]; + UINT64 V5[2]; + UINT64 V6[2]; + UINT64 V7[2]; + UINT64 V8[2]; + UINT64 V9[2]; + UINT64 V10[2]; + UINT64 V11[2]; + UINT64 V12[2]; + UINT64 V13[2]; + UINT64 V14[2]; + UINT64 V15[2]; + UINT64 V16[2]; + UINT64 V17[2]; + UINT64 V18[2]; + UINT64 V19[2]; + UINT64 V20[2]; + UINT64 V21[2]; + UINT64 V22[2]; + UINT64 V23[2]; + UINT64 V24[2]; + UINT64 V25[2]; + UINT64 V26[2]; + UINT64 V27[2]; + UINT64 V28[2]; + UINT64 V29[2]; + UINT64 V30[2]; + UINT64 V31[2]; + + UINT64 ELR; // Exception Link Register + UINT64 SPSR; // Saved Processor Status Register + UINT64 FPSR; // Floating Point Status Register + UINT64 ESR; // Exception syndrome register + UINT64 FAR; // Fault Address Register +} EFI_SYSTEM_CONTEXT_AARCH64; + + +/// +/// Universal EFI_SYSTEM_CONTEXT definition. +/// typedef union { EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc; EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32; EFI_SYSTEM_CONTEXT_X64 *SystemContextX64; EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf; + EFI_SYSTEM_CONTEXT_ARM *SystemContextArm; + EFI_SYSTEM_CONTEXT_AARCH64 *SystemContextAArch64; } EFI_SYSTEM_CONTEXT; // @@ -487,13 +629,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 ); @@ -506,18 +648,20 @@ 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 + IsaArm = IMAGE_FILE_MACHINE_ARMTHUMB_MIXED, ///< 0x01c2 + IsaAArch64 = IMAGE_FILE_MACHINE_ARM64 ///< 0xAA64 } EFI_INSTRUCTION_SET_ARCHITECTURE; @@ -571,7 +715,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,10 +757,15 @@ EFI_STATUS 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;