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