1 /** @file
2   EBC Simple Debugger protocol for debug EBC code.
3 
4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
5 
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions
8 of the BSD License which accompanies this distribution.  The
9 full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11 
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 
15 **/
16 
17 #ifndef _EBC_SIMPLE_DEBUGGER_PROTOCOL_H_
18 #define _EBC_SIMPLE_DEBUGGER_PROTOCOL_H_
19 
20 #include <Protocol/DebugSupport.h>
21 #include <Protocol/EbcVmTest.h>
22 
23 #define EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL_GUID \
24   { \
25     0x2a72d11e, 0x7376, 0x40f6, { 0x9c, 0x68, 0x23, 0xfa, 0x2f, 0xe3, 0x63, 0xf1 } \
26   }
27 
28 //
29 // Defines for a simple EBC debugger interface
30 //
31 typedef struct _EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL;
32 
33 /**
34   Trig Exception on EBC VM.
35 
36   @param[in] This           A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure.
37   @param[in] VmPtr          A pointer to a VM context.
38   @param[in] ExceptionType  Exception to be trigged.
39 
40   @retval EFI_UNSUPPORTED       No support for it.
41   @retval EFI_SUCCESS           Exception is trigged.
42 
43 **/
44 typedef
45 EFI_STATUS
46 (EFIAPI *EBC_DEBUGGER_SIGNAL_EXCEPTION) (
47   IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL           *This,
48   IN VM_CONTEXT                                 *VmPtr,
49   IN EFI_EXCEPTION_TYPE                         ExceptionType
50   );
51 
52 /**
53   Given a pointer to a new VM context, debug one or more instructions.
54 
55   @param[in] This           A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure.
56   @param[in] VmPtr          A pointer to a VM context.
57 
58   @retval EFI_UNSUPPORTED       No support for it.
59   @retval EFI_SUCCESS           Debug one or more instructions.
60 
61 **/
62 typedef
63 VOID
64 (EFIAPI *EBC_DEBUGGER_DEBUG) (
65   IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL           *This,
66   IN VM_CONTEXT                                 *VmPtr
67   );
68 
69 /**
70   Given a pointer to a new VM context, dump one or more instructions.
71 
72   @param[in] This           A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure.
73   @param[in] VmPtr          A pointer to a VM context.
74   @param[in] DasmString     Dump string buffer.
75   @param[in] DasmStringSize Dump string size.
76 
77   @retval EFI_UNSUPPORTED       No support for it.
78   @retval EFI_SUCCESS           Dump one or more instructions.
79 
80 **/
81 typedef
82 UINT32
83 (EFIAPI *EBC_DEBUGGER_DASM) (
84   IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL           *This,
85   IN VM_CONTEXT                                 *VmPtr,
86   IN UINT16                                     *DasmString OPTIONAL,
87   IN UINT32                                     DasmStringSize
88   );
89 
90 /**
91   This interface allows you to configure the EBC debug support
92   driver. For example, turn on or off saving and printing of
93   delta VM even if called. Or to even disable the entire interface,
94   in which case all functions become no-ops.
95 
96   @param[in] This           A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure.
97   @param[in] ConfigId       ID to be configured.
98   @param[in] ConfigValue    Value to be set.
99 
100   @retval EFI_UNSUPPORTED       No support for it.
101   @retval EFI_SUCCESS           Configure EBC debug.
102 
103 **/
104 typedef
105 EFI_STATUS
106 (EFIAPI *EBC_DEBUGGER_CONFIGURE) (
107   IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL           *This,
108   IN UINT32                                     ConfigId,
109   IN UINTN                                      ConfigValue
110   );
111 
112 //
113 // Prototype for the actual EBC debug support protocol interface
114 //
115 struct _EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL {
116   EBC_DEBUGGER_DEBUG            Debugger;
117   EBC_DEBUGGER_SIGNAL_EXCEPTION SignalException;
118   EBC_DEBUGGER_DASM             Dasm;
119   EBC_DEBUGGER_CONFIGURE        Configure;
120 };
121 
122 extern EFI_GUID gEfiEbcSimpleDebuggerProtocolGuid;
123 
124 #endif
125