]> git.proxmox.com Git - mirror_edk2.git/blame - EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.h
EmbeddedPkg: Fix typos in comments
[mirror_edk2.git] / EmbeddedPkg / Library / GdbDebugAgent / GdbDebugAgent.h
CommitLineData
1e57a462 1/** @file\r
2 Private include file for GDB stub\r
3\r
4 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
5\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef __GCC_DEBUG_AGENT_INTERNAL__\r
17#define __GCC_DEBUG_AGENT_INTERNAL__\r
18\r
19#include <Uefi.h>\r
20#include <Library/BaseLib.h>\r
21#include <Library/BaseMemoryLib.h>\r
22#include <Library/MemoryAllocationLib.h>\r
23#include <Library/DebugLib.h>\r
24#include <Library/PcdLib.h>\r
25#include <Library/GdbSerialLib.h>\r
26#include <Library/PrintLib.h>\r
27#include <Library/CacheMaintenanceLib.h>\r
28#include <Library/DebugAgentTimerLib.h>\r
685f8c76 29#include <Library/DebugAgentLib.h>\r
1e57a462 30\r
31#include <IndustryStandard/PeImage.h>\r
32#include <Protocol/DebugSupport.h>\r
33\r
34extern CONST CHAR8 mHexToStr[];\r
35\r
36// maximum size of input and output buffers\r
3402aac7 37// This value came from the show remote command of the gdb we tested against\r
1e57a462 38#define MAX_BUF_SIZE 2000\r
39\r
40// maximum size of address buffer\r
41#define MAX_ADDR_SIZE 32\r
42\r
43// maximum size of register number buffer\r
44#define MAX_REG_NUM_BUF_SIZE 32\r
45\r
46// maximum size of length buffer\r
47#define MAX_LENGTH_SIZE 32\r
48\r
49// maximum size of T signal members\r
50#define MAX_T_SIGNAL_SIZE 64\r
51\r
52// the mask used to clear all the cache\r
53#define TF_BIT 0x00000100\r
54\r
55\r
56//\r
57// GDB Signal definitions - generic names for interrupts\r
58//\r
59#define GDB_SIGINT 2 // Interrupt process via ctrl-c\r
3402aac7 60#define GDB_SIGILL 4 // Illegal instruction\r
1e57a462 61#define GDB_SIGTRAP 5 // Trace Trap (Breakpoint and SingleStep)\r
62#define GDB_SIGEMT 7 // Emulator Trap\r
63#define GDB_SIGFPE 8 // Floating point exception\r
3402aac7 64#define GDB_SIGSEGV 11 // Setgment violation, page fault\r
1e57a462 65\r
66\r
67//\r
68// GDB File I/O Error values, zero means no error\r
69// Includes all general GDB Unix like error values\r
70//\r
71#define GDB_EBADMEMADDRBUFSIZE 11 // the buffer that stores memory Address to be read from/written to is not the right size\r
3402aac7 72#define GDB_EBADMEMLENGBUFSIZE 12 // the buffer that stores Length is not the right size\r
1e57a462 73#define GDB_EBADMEMLENGTH 13 // Length, the given number of bytes to read or write, is not the right size\r
3402aac7 74#define GDB_EBADMEMDATA 14 // one of the bytes or nibbles of the memory is leess than 0\r
1e57a462 75#define GDB_EBADMEMDATASIZE 15 // the memory data, 'XX..', is too short or too long\r
76#define GDB_EBADBUFSIZE 21 // the buffer created is not the correct size\r
77#define GDB_EINVALIDARG 31 // argument is invalid\r
78#define GDB_ENOSPACE 41 //\r
79#define GDB_EINVALIDBRKPOINTTYPE 51 // the breakpoint type is not recognized\r
80#define GDB_EINVALIDREGNUM 61 // given register number is not valid: either <0 or >=Number of Registers\r
81#define GDB_EUNKNOWN 255 // unknown\r
82\r
83\r
84//\r
85// These devices are open by GDB so we can just read and write to them\r
86//\r
87#define GDB_STDIN 0x00\r
88#define GDB_STDOUT 0x01\r
89#define GDB_STDERR 0x02\r
90\r
91//\r
92//Define Register size for different architectures\r
93//\r
3402aac7 94#if defined (MDE_CPU_IA32)\r
1e57a462 95#define REG_SIZE 32\r
96#elif defined (MDE_CPU_X64)\r
97#define REG_SIZE 64\r
98#elif defined (MDE_CPU_ARM)\r
99#define REG_SIZE 32\r
100#endif\r
101\r
102\r
103typedef struct {\r
104 EFI_EXCEPTION_TYPE Exception;\r
105 UINT8 SignalNo;\r
106} EFI_EXCEPTION_TYPE_ENTRY;\r
107\r
108\r
109#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)\r
110\r
111//\r
112// Byte packed structure for DR6\r
113// 32-bits on IA-32\r
114// 64-bits on X64. The upper 32-bits on X64 are reserved\r
115//\r
116typedef union {\r
117 struct {\r
118 UINT32 B0:1; // Breakpoint condition detected\r
119 UINT32 B1:1; // Breakpoint condition detected\r
120 UINT32 B2:1; // Breakpoint condition detected\r
121 UINT32 B3:1; // Breakpoint condition detected\r
3402aac7 122 UINT32 Reserved_1:9; // Reserved\r
1e57a462 123 UINT32 BD:1; // Debug register access detected\r
124 UINT32 BS:1; // Single step\r
125 UINT32 BT:1; // Task switch\r
126 UINT32 Reserved_2:16; // Reserved\r
127 } Bits;\r
128 UINTN UintN;\r
129} IA32_DR6;\r
130\r
131//\r
132// Byte packed structure for DR7\r
133// 32-bits on IA-32\r
134// 64-bits on X64. The upper 32-bits on X64 are reserved\r
135//\r
136typedef union {\r
137 struct {\r
138 UINT32 L0:1; // Local breakpoint enable\r
139 UINT32 G0:1; // Global breakpoint enable\r
140 UINT32 L1:1; // Local breakpoint enable\r
141 UINT32 G1:1; // Global breakpoint enable\r
142 UINT32 L2:1; // Local breakpoint enable\r
143 UINT32 G2:1; // Global breakpoint enable\r
144 UINT32 L3:1; // Local breakpoint enable\r
145 UINT32 G3:1; // Global breakpoint enable\r
146 UINT32 LE:1; // Local exact breakpoint enable\r
147 UINT32 GE:1; // Global exact breakpoint enable\r
148 UINT32 Reserved_1:3; // Reserved\r
149 UINT32 GD:1; // Global detect enable\r
150 UINT32 Reserved_2:2; // Reserved\r
151 UINT32 RW0:2; // Read/Write field\r
152 UINT32 LEN0:2; // Length field\r
153 UINT32 RW1:2; // Read/Write field\r
154 UINT32 LEN1:2; // Length field\r
155 UINT32 RW2:2; // Read/Write field\r
156 UINT32 LEN2:2; // Length field\r
157 UINT32 RW3:2; // Read/Write field\r
158 UINT32 LEN3:2; // Length field\r
159 } Bits;\r
160 UINTN UintN;\r
161} IA32_DR7;\r
162\r
163#endif /* if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64) */\r
164\r
165typedef enum {\r
166 InstructionExecution, //Hardware breakpoint\r
167 DataWrite, //watch\r
168 DataRead, //rwatch\r
169 DataReadWrite, //awatch\r
170 SoftwareBreakpoint, //Software breakpoint\r
171 NotSupported\r
172} BREAK_TYPE;\r
173\r
174//\r
175// Array of exception types that need to be hooked by the debugger\r
176//\r
177extern EFI_EXCEPTION_TYPE_ENTRY gExceptionType[];\r
178\r
179//\r
180// If the periodic callback is called while we are processing an F packet we need\r
181// to let the callback know to not read from the serail stream as it could steal\r
182// characters from the F reponse packet\r
183//\r
184extern BOOLEAN gProcessingFPacket;\r
185\r
186\r
187/**\r
188 Return the number of entries in the gExceptionType[]\r
3402aac7
RC
189\r
190 @retval UINTN, the number of entries in the gExceptionType[] array.\r
1e57a462 191 **/\r
192UINTN\r
193MaxEfiException (\r
194 VOID\r
195 );\r
196\r
197\r
198/**\r
3402aac7 199 Check to see if the ISA is supported.\r
1e57a462 200 ISA = Instruction Set Architecture\r
3402aac7 201\r
1e57a462 202 @retval TRUE if Isa is supported,\r
203 FALSE otherwise.\r
204 **/\r
205BOOLEAN\r
206CheckIsa (\r
207 IN EFI_INSTRUCTION_SET_ARCHITECTURE Isa\r
208 );\r
209\r
210\r
211/**\r
212 Send the T signal with the given exception type (in gdb order) and possibly with n:r pairs related to the watchpoints\r
3402aac7 213\r
1e57a462 214 @param SystemContext Register content at time of the exception\r
215 @param GdbExceptionType GDB exception type\r
216 **/\r
217\r
218VOID\r
219GdbSendTSignal (\r
220 IN EFI_SYSTEM_CONTEXT SystemContext,\r
91c38d4e 221 IN UINT8 GdbExceptionType\r
1e57a462 222 );\r
223\r
224\r
225/**\r
226 Translates the EFI mapping to GDB mapping\r
3402aac7 227\r
1e57a462 228 @param EFIExceptionType EFI Exception that is being processed\r
229 @retval UINTN that corresponds to EFIExceptionType's GDB exception type number\r
230 **/\r
231UINT8\r
3402aac7 232ConvertEFItoGDBtype (\r
1e57a462 233 IN EFI_EXCEPTION_TYPE EFIExceptionType\r
234 );\r
235\r
236\r
237/**\r
3402aac7 238 Empties the given buffer\r
1e57a462 239 @param *Buf pointer to the first element in buffer to be emptied\r
240 **/\r
241VOID\r
3402aac7 242EmptyBuffer (\r
1e57a462 243 IN CHAR8 *Buf\r
244 );\r
245\r
246\r
247/**\r
248 Converts an 8-bit Hex Char into a INTN.\r
3402aac7 249\r
1e57a462 250 @param Char - the hex character to be converted into UINTN\r
251 @retval a INTN, from 0 to 15, that corressponds to Char\r
252 -1 if Char is not a hex character\r
253 **/\r
254INTN\r
255HexCharToInt (\r
256 IN CHAR8 Char\r
257 );\r
258\r
259\r
260/** 'E NN'\r
261 Send an error with the given error number after converting to hex.\r
262 The error number is put into the buffer in hex. '255' is the biggest errno we can send.\r
263 ex: 162 will be sent as A2.\r
3402aac7 264\r
1e57a462 265 @param errno the error number that will be sent\r
266 **/\r
267VOID\r
268EFIAPI\r
269SendError (\r
270 IN UINT8 ErrorNum\r
271 );\r
272\r
273\r
274/**\r
275 Send 'OK' when the function is done executing successfully.\r
276 **/\r
277VOID\r
278SendSuccess (\r
279 VOID\r
280 );\r
281\r
282\r
283/**\r
284 Send empty packet to specify that particular command/functionality is not supported.\r
285 **/\r
286VOID\r
287SendNotSupported (\r
288 VOID\r
289 );\r
290\r
3402aac7
RC
291/** ‘p n’\r
292 Reads the n-th register's value into an output buffer and sends it as a packet\r
1e57a462 293 @param SystemContext Register content at time of the exception\r
294 @param InBuffer This is the input buffer received from gdb server\r
295 **/\r
296VOID\r
297ReadNthRegister (\r
298 IN EFI_SYSTEM_CONTEXT SystemContext,\r
299 IN CHAR8 *InBuffer\r
300 );\r
301\r
302\r
3402aac7
RC
303/** ‘g’\r
304 Reads the general registers into an output buffer and sends it as a packet\r
1e57a462 305 @param SystemContext Register content at time of the exception\r
306 **/\r
307VOID\r
3402aac7 308ReadGeneralRegisters (\r
1e57a462 309 IN EFI_SYSTEM_CONTEXT SystemContext\r
310 );\r
311\r
312\r
313/** ‘P n...=r...’\r
314 Writes the new value of n-th register received into the input buffer to the n-th register\r
315 @param SystemContext Register content at time of the exception\r
316 @param InBuffer This is the input buffer received from gdb server\r
317 **/\r
318VOID\r
319WriteNthRegister (\r
320 IN EFI_SYSTEM_CONTEXT SystemContext,\r
321 IN CHAR8 *InBuffer\r
322 );\r
323\r
324\r
325/** ‘G XX...’\r
326 Writes the new values received into the input buffer to the general registers\r
327 @param SystemContext Register content at time of the exception\r
328 @param InBuffer Pointer to the input buffer received from gdb server\r
329 **/\r
330\r
331VOID\r
332WriteGeneralRegisters (\r
333 IN EFI_SYSTEM_CONTEXT SystemContext,\r
334 IN CHAR8 *InBuffer\r
335 );\r
336\r
337\r
338/** ‘m addr,length ’\r
3402aac7
RC
339 Find the Length of the area to read and the start addres. Finally, pass them to\r
340 another function, TransferFromMemToOutBufAndSend, that will read from that memory space and\r
1e57a462 341 send it as a packet.\r
3402aac7 342\r
1e57a462 343 @param *PacketData Pointer to Payload data for the packet\r
344 **/\r
345VOID\r
346ReadFromMemory (\r
347 IN CHAR8 *PacketData\r
348 );\r
349\r
350\r
351/** ‘M addr,length :XX...’\r
3402aac7 352 Find the Length of the area in bytes to write and the start addres. Finally, pass them to\r
1e57a462 353 another function, TransferFromInBufToMem, that will write to that memory space the info in\r
354 the input buffer.\r
3402aac7 355\r
1e57a462 356 @param PacketData Pointer to Payload data for the packet\r
357 **/\r
358VOID\r
359WriteToMemory (\r
360 IN CHAR8 *PacketData\r
361 );\r
362\r
363\r
3402aac7
RC
364/** ‘c [addr ]’\r
365 Continue. addr is Address to resume. If addr is omitted, resume at current\r
1e57a462 366 Address.\r
3402aac7
RC
367\r
368 @param SystemContext Register content at time of the exception\r
1e57a462 369 @param *PacketData Pointer to PacketData\r
370 **/\r
371\r
372VOID\r
373ContinueAtAddress (\r
374 IN EFI_SYSTEM_CONTEXT SystemContext,\r
375 IN CHAR8 *PacketData\r
376 );\r
377\r
378\r
379/** ‘s [addr ]’\r
3402aac7 380 Single step. addr is the Address at which to resume. If addr is omitted, resume\r
1e57a462 381 at same Address.\r
3402aac7 382\r
1e57a462 383 @param SystemContext Register content at time of the exception\r
384 @param PacketData Pointer to Payload data for the packet\r
385 **/\r
386VOID\r
387SingleStep (\r
388 IN EFI_SYSTEM_CONTEXT SystemContext,\r
389 IN CHAR8 *PacketData\r
390 );\r
391\r
3402aac7 392/**\r
1e57a462 393 Insert Single Step in the SystemContext\r
3402aac7 394\r
1e57a462 395 @param SystemContext Register content at time of the exception\r
396 **/\r
397VOID\r
398AddSingleStep (\r
399 IN EFI_SYSTEM_CONTEXT SystemContext\r
400 );\r
3402aac7
RC
401\r
402/**\r
1e57a462 403 Remove Single Step in the SystemContext\r
3402aac7 404\r
1e57a462 405 @param SystemContext Register content at time of the exception\r
406 **/\r
407VOID\r
408RemoveSingleStep (\r
409 IN EFI_SYSTEM_CONTEXT SystemContext\r
410 );\r
3402aac7
RC
411\r
412\r
1e57a462 413/**\r
414 ‘Z1, [addr], [length]’\r
415 ‘Z2, [addr], [length]’\r
416 ‘Z3, [addr], [length]’\r
417 ‘Z4, [addr], [length]’\r
418\r
419 Insert hardware breakpoint/watchpoint at address addr of size length\r
420\r
421 @param SystemContext Register content at time of the exception\r
422 @param *PacketData Pointer to the Payload data for the packet\r
423\r
424**/\r
425VOID\r
426EFIAPI\r
427InsertBreakPoint(\r
428 IN EFI_SYSTEM_CONTEXT SystemContext,\r
429 IN CHAR8 *PacketData\r
430 );\r
431\r
432\r
433/**\r
434 ‘z1, [addr], [length]’\r
435 ‘z2, [addr], [length]’\r
436 ‘z3, [addr], [length]’\r
437 ‘z4, [addr], [length]’\r
438\r
439 Remove hardware breakpoint/watchpoint at address addr of size length\r
440\r
441 @param SystemContext Register content at time of the exception\r
442 @param *PacketData Pointer to the Payload data for the packet\r
443\r
444**/\r
445VOID\r
446EFIAPI\r
447RemoveBreakPoint(\r
448 IN EFI_SYSTEM_CONTEXT SystemContext,\r
449 IN CHAR8 *PacketData\r
450 );\r
451\r
452\r
453/**\r
454 Exception Hanldler for GDB. It will be called for all exceptions\r
455 registered via the gExceptionType[] array.\r
3402aac7 456\r
1e57a462 457 @param ExceptionType Exception that is being processed\r
3402aac7
RC
458 @param SystemContext Register content at time of the exception\r
459\r
1e57a462 460 **/\r
461VOID\r
462EFIAPI\r
3402aac7
RC
463GdbExceptionHandler (\r
464 IN EFI_EXCEPTION_TYPE ExceptionType,\r
465 IN OUT EFI_SYSTEM_CONTEXT SystemContext\r
1e57a462 466 );\r
467\r
468\r
469/**\r
3402aac7 470 Periodic callback for GDB. This function is used to catch a ctrl-c or other\r
1e57a462 471 break in type command from GDB.\r
3402aac7 472\r
1e57a462 473 @param SystemContext Register content at time of the call\r
3402aac7 474\r
1e57a462 475 **/\r
476VOID\r
477EFIAPI\r
3402aac7
RC
478GdbPeriodicCallBack (\r
479 IN OUT EFI_SYSTEM_CONTEXT SystemContext\r
1e57a462 480 );\r
481\r
482\r
483/**\r
484 Make two serail consoles: 1) StdIn and StdOut via GDB. 2) StdErr via GDB.\r
3402aac7 485\r
1e57a462 486 These console show up on the remote system running GDB\r
487\r
488**/\r
489\r
490VOID\r
491GdbInitializeSerialConsole (\r
492 VOID\r
493 );\r
494\r
495\r
496/**\r
497 Send a GDB Remote Serial Protocol Packet\r
3402aac7
RC
498\r
499 $PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',\r
1e57a462 500 the packet teminating character '#' and the two digit checksum.\r
3402aac7
RC
501\r
502 If an ack '+' is not sent resend the packet, but timeout eventually so we don't end up\r
1e57a462 503 in an infinit loop. This is so if you unplug the debugger code just keeps running\r
504\r
3402aac7
RC
505 @param PacketData Payload data for the packet\r
506\r
1e57a462 507 @retval Number of bytes of packet data sent.\r
508\r
509**/\r
510UINTN\r
511SendPacket (\r
512 IN CHAR8 *PacketData\r
513 );\r
3402aac7 514\r
1e57a462 515\r
516/**\r
517 Receive a GDB Remote Serial Protocol Packet\r
3402aac7
RC
518\r
519 $PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',\r
1e57a462 520 the packet teminating character '#' and the two digit checksum.\r
3402aac7 521\r
4f0624e8 522 If host re-starts sending a packet without ending the previous packet, only the last valid packet is processed.\r
1e57a462 523 (In other words, if received packet is '$12345$12345$123456#checksum', only '$123456#checksum' will be processed.)\r
3402aac7 524\r
1e57a462 525 If an ack '+' is not sent resend the packet\r
3402aac7
RC
526\r
527 @param PacketData Payload data for the packet\r
528\r
1e57a462 529 @retval Number of bytes of packet data received.\r
530\r
531 **/\r
532UINTN\r
533ReceivePacket (\r
534 OUT CHAR8 *PacketData,\r
535 IN UINTN PacketDataSize\r
536 );\r
3402aac7 537\r
1e57a462 538\r
539/**\r
3402aac7 540 Read data from a FileDescriptor. On success number of bytes read is returned. Zero indicates\r
1e57a462 541 the end of a file. On error -1 is returned. If count is zero, GdbRead returns zero.\r
542\r
543 @param FileDescriptor Device to talk to.\r
544 @param Buffer Buffer to hold Count bytes that were read\r
3402aac7 545 @param Count Number of bytes to transfer.\r
1e57a462 546\r
547 @retval -1 Error\r
548 @retval {other} Number of bytes read.\r
549\r
550**/\r
551INTN\r
552GdbRead (\r
553 IN INTN FileDescriptor,\r
554 OUT VOID *Buffer,\r
555 IN UINTN Count\r
556 );\r
3402aac7 557\r
1e57a462 558\r
559/**\r
3402aac7
RC
560 Write data to a FileDescriptor. On success number of bytes written is returned. Zero indicates\r
561 nothing was written. On error -1 is returned.\r
1e57a462 562\r
563 @param FileDescriptor Device to talk to.\r
564 @param Buffer Buffer to hold Count bytes that are to be written\r
3402aac7 565 @param Count Number of bytes to transfer.\r
1e57a462 566\r
567 @retval -1 Error\r
568 @retval {other} Number of bytes written.\r
569\r
570**/\r
571INTN\r
572GdbWrite (\r
573 IN INTN FileDescriptor,\r
574 OUT CONST VOID *Buffer,\r
575 IN UINTN Count\r
576 );\r
577\r
3402aac7 578UINTN *\r
1e57a462 579FindPointerToRegister (\r
580 IN EFI_SYSTEM_CONTEXT SystemContext,\r
3402aac7 581 IN UINTN RegNumber\r
1e57a462 582 );\r
583\r
3402aac7 584CHAR8 *\r
1e57a462 585BasicReadRegister (\r
586 IN EFI_SYSTEM_CONTEXT SystemContext,\r
587 IN UINTN RegNumber,\r
588 IN CHAR8 *OutBufPtr\r
589 );\r
590\r
591VOID\r
592TransferFromInBufToMem (\r
593 IN UINTN Length,\r
594 IN UINT8 *Address,\r
595 IN CHAR8 *NewData\r
596 );\r
597\r
598VOID\r
599TransferFromMemToOutBufAndSend (\r
600 IN UINTN Length,\r
601 IN UINT8 *Address\r
602 );\r
603\r
604CHAR8 *\r
605BasicWriteRegister (\r
606 IN EFI_SYSTEM_CONTEXT SystemContext,\r
607 IN UINTN RegNumber,\r
608 IN CHAR8 *InBufPtr\r
609 );\r
610\r
3402aac7 611VOID\r
1e57a462 612PrintReg (\r
613 EFI_SYSTEM_CONTEXT SystemContext\r
614 );\r
615\r
616UINTN\r
617ParseBreakpointPacket (\r
618 IN CHAR8 *PacketData,\r
619 OUT UINTN *Type,\r
620 OUT UINTN *Address,\r
621 OUT UINTN *Length\r
622 );\r
623\r
624UINTN\r
625GetBreakpointDataAddress (\r
626 IN EFI_SYSTEM_CONTEXT SystemContext,\r
3402aac7 627 IN UINTN BreakpointNumber\r
1e57a462 628 );\r
629\r
630UINTN\r
631GetBreakpointDetected (\r
632 IN EFI_SYSTEM_CONTEXT SystemContext\r
633 );\r
634\r
635BREAK_TYPE\r
636GetBreakpointType (\r
637 IN EFI_SYSTEM_CONTEXT SystemContext,\r
3402aac7 638 IN UINTN BreakpointNumber\r
1e57a462 639 );\r
640\r
641UINTN\r
642ConvertLengthData (\r
643 IN UINTN Length\r
644 );\r
645\r
646EFI_STATUS\r
647FindNextFreeDebugRegister (\r
648 IN EFI_SYSTEM_CONTEXT SystemContext,\r
649 OUT UINTN *Register\r
650 );\r
651\r
652EFI_STATUS\r
653EnableDebugRegister (\r
654 IN EFI_SYSTEM_CONTEXT SystemContext,\r
655 IN UINTN Register,\r
656 IN UINTN Address,\r
657 IN UINTN Length,\r
658 IN UINTN Type\r
659 );\r
660\r
661EFI_STATUS\r
662FindMatchingDebugRegister (\r
663 IN EFI_SYSTEM_CONTEXT SystemContext,\r
664 IN UINTN Address,\r
665 IN UINTN Length,\r
666 IN UINTN Type,\r
667 OUT UINTN *Register\r
668 );\r
669\r
670EFI_STATUS\r
671DisableDebugRegister (\r
672 IN EFI_SYSTEM_CONTEXT SystemContext,\r
673 IN UINTN Register\r
674 );\r
675\r
676VOID\r
677InitializeProcessor (\r
678 VOID\r
679 );\r
680\r
681/**\r
682 Send the T signal with the given exception type (in gdb order) and possibly with n:r pairs related to the watchpoints\r
3402aac7 683\r
1e57a462 684 @param SystemContext Register content at time of the exception\r
685 @param GdbExceptionType GDB exception type\r
686 **/\r
687VOID\r
688ProcessorSendTSignal (\r
689 IN EFI_SYSTEM_CONTEXT SystemContext,\r
690 IN UINT8 GdbExceptionType,\r
691 IN OUT CHAR8 *TSignalPtr,\r
692 IN UINTN SizeOfBuffer\r
693 );\r
694\r
969eba7b 695/**\r
696 Check to see if this exception is related to ctrl-c handling.\r
3402aac7 697\r
969eba7b 698 @param ExceptionType Exception that is being processed\r
3402aac7 699 @param SystemContext Register content at time of the exception\r
969eba7b 700\r
701 @return TRUE This was a ctrl-c check that did not find a ctrl-c\r
702 @return FALSE This was not a ctrl-c check or some one hit ctrl-c\r
703 **/\r
704BOOLEAN\r
3402aac7
RC
705ProcessorControlC (\r
706 IN EFI_EXCEPTION_TYPE ExceptionType,\r
707 IN OUT EFI_SYSTEM_CONTEXT SystemContext\r
1e57a462 708 );\r
709\r
710\r
969eba7b 711/**\r
712 Initialize debug agent.\r
713\r
714 This function is used to set up debug enviroment. It may enable interrupts.\r
715\r
716 @param[in] InitFlag Init flag is used to decide initialize process.\r
717 @param[in] Context Context needed according to InitFlag, it was optional.\r
718\r
719**/\r
720VOID\r
721EFIAPI\r
722DebugAgentHookExceptions (\r
723 IN UINT32 InitFlag,\r
724 IN VOID *Context OPTIONAL\r
725 );\r
1e57a462 726\r
727\r
728#endif\r