summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Include/Protocol/EbcSimpleDebugger.h
blob: bb257826b17d7fdb1928f428cd27eee70e6ae57d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/** @file
  EBC Simple Debugger protocol for debug EBC code.

Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>

SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#ifndef _EBC_SIMPLE_DEBUGGER_PROTOCOL_H_
#define _EBC_SIMPLE_DEBUGGER_PROTOCOL_H_

#include <Protocol/DebugSupport.h>
#include <Protocol/EbcVmTest.h>

#define EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL_GUID \
  { \
    0x2a72d11e, 0x7376, 0x40f6, { 0x9c, 0x68, 0x23, 0xfa, 0x2f, 0xe3, 0x63, 0xf1 } \
  }

//
// Defines for a simple EBC debugger interface
//
typedef struct _EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL;

/**
  Trig Exception on EBC VM.

  @param[in] This           A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure.
  @param[in] VmPtr          A pointer to a VM context.
  @param[in] ExceptionType  Exception to be trigged.

  @retval EFI_UNSUPPORTED       No support for it.
  @retval EFI_SUCCESS           Exception is trigged.

**/
typedef
EFI_STATUS
(EFIAPI *EBC_DEBUGGER_SIGNAL_EXCEPTION) (
  IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL           *This,
  IN VM_CONTEXT                                 *VmPtr,
  IN EFI_EXCEPTION_TYPE                         ExceptionType
  );

/**
  Given a pointer to a new VM context, debug one or more instructions.

  @param[in] This           A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure.
  @param[in] VmPtr          A pointer to a VM context.

  @retval EFI_UNSUPPORTED       No support for it.
  @retval EFI_SUCCESS           Debug one or more instructions.

**/
typedef
VOID
(EFIAPI *EBC_DEBUGGER_DEBUG) (
  IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL           *This,
  IN VM_CONTEXT                                 *VmPtr
  );

/**
  Given a pointer to a new VM context, dump one or more instructions.

  @param[in] This           A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure.
  @param[in] VmPtr          A pointer to a VM context.
  @param[in] DasmString     Dump string buffer.
  @param[in] DasmStringSize Dump string size.

  @retval EFI_UNSUPPORTED       No support for it.
  @retval EFI_SUCCESS           Dump one or more instructions.

**/
typedef
UINT32
(EFIAPI *EBC_DEBUGGER_DASM) (
  IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL           *This,
  IN VM_CONTEXT                                 *VmPtr,
  IN UINT16                                     *DasmString OPTIONAL,
  IN UINT32                                     DasmStringSize
  );

/**
  This interface allows you to configure the EBC debug support
  driver. For example, turn on or off saving and printing of
  delta VM even if called. Or to even disable the entire interface,
  in which case all functions become no-ops.

  @param[in] This           A pointer to the EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL structure.
  @param[in] ConfigId       ID to be configured.
  @param[in] ConfigValue    Value to be set.

  @retval EFI_UNSUPPORTED       No support for it.
  @retval EFI_SUCCESS           Configure EBC debug.

**/
typedef
EFI_STATUS
(EFIAPI *EBC_DEBUGGER_CONFIGURE) (
  IN EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL           *This,
  IN UINT32                                     ConfigId,
  IN UINTN                                      ConfigValue
  );

//
// Prototype for the actual EBC debug support protocol interface
//
struct _EFI_EBC_SIMPLE_DEBUGGER_PROTOCOL {
  EBC_DEBUGGER_DEBUG            Debugger;
  EBC_DEBUGGER_SIGNAL_EXCEPTION SignalException;
  EBC_DEBUGGER_DASM             Dasm;
  EBC_DEBUGGER_CONFIGURE        Configure;
};

extern EFI_GUID gEfiEbcSimpleDebuggerProtocolGuid;

#endif