]> git.proxmox.com Git - mirror_edk2.git/blame - EmbeddedPkg/GdbStub/GdbStubInternal.h
EmbeddedPkg: add missing EFIAPI calling convention specifiers
[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
7609c047 326EFIAPI\r
1e57a462 327SendSuccess (\r
328 VOID\r
329 );\r
330\r
331\r
332/**\r
333 Send empty packet to specify that particular command/functionality is not supported.\r
334 **/\r
335VOID\r
7609c047 336EFIAPI\r
1e57a462 337SendNotSupported (\r
338 VOID\r
339 );\r
340\r
3402aac7
RC
341/** ‘p n’\r
342 Reads the n-th register's value into an output buffer and sends it as a packet\r
1e57a462 343 @param SystemContext Register content at time of the exception\r
344 @param InBuffer This is the input buffer received from gdb server\r
345 **/\r
346VOID\r
347ReadNthRegister (\r
348 IN EFI_SYSTEM_CONTEXT SystemContext,\r
349 IN CHAR8 *InBuffer\r
350 );\r
351\r
352\r
3402aac7
RC
353/** ‘g’\r
354 Reads the general registers into an output buffer and sends it as a packet\r
1e57a462 355 @param SystemContext Register content at time of the exception\r
356 **/\r
357VOID\r
7609c047 358EFIAPI\r
3402aac7 359ReadGeneralRegisters (\r
1e57a462 360 IN EFI_SYSTEM_CONTEXT SystemContext\r
361 );\r
362\r
363\r
364/** ‘P n...=r...’\r
365 Writes the new value of n-th register received into the input buffer to the n-th register\r
366 @param SystemContext Register content at time of the exception\r
367 @param InBuffer This is the input buffer received from gdb server\r
368 **/\r
369VOID\r
7609c047 370EFIAPI\r
1e57a462 371WriteNthRegister (\r
372 IN EFI_SYSTEM_CONTEXT SystemContext,\r
373 IN CHAR8 *InBuffer\r
374 );\r
375\r
376\r
377/** ‘G XX...’\r
378 Writes the new values received into the input buffer to the general registers\r
379 @param SystemContext Register content at time of the exception\r
380 @param InBuffer Pointer to the input buffer received from gdb server\r
381 **/\r
382\r
383VOID\r
7609c047 384EFIAPI\r
1e57a462 385WriteGeneralRegisters (\r
386 IN EFI_SYSTEM_CONTEXT SystemContext,\r
387 IN CHAR8 *InBuffer\r
388 );\r
389\r
390\r
391/** ‘m addr,length ’\r
c6a72cd7 392 Find the Length of the area to read and the start address. Finally, pass them to\r
3402aac7 393 another function, TransferFromMemToOutBufAndSend, that will read from that memory space and\r
1e57a462 394 send it as a packet.\r
3402aac7 395\r
1e57a462 396 @param *PacketData Pointer to Payload data for the packet\r
397 **/\r
398VOID\r
7609c047 399EFIAPI\r
1e57a462 400ReadFromMemory (\r
401 IN CHAR8 *PacketData\r
402 );\r
403\r
404\r
405/** ‘M addr,length :XX...’\r
c6a72cd7 406 Find the Length of the area in bytes to write and the start address. Finally, pass them to\r
1e57a462 407 another function, TransferFromInBufToMem, that will write to that memory space the info in\r
408 the input buffer.\r
3402aac7 409\r
1e57a462 410 @param PacketData Pointer to Payload data for the packet\r
411 **/\r
412VOID\r
7609c047 413EFIAPI\r
1e57a462 414WriteToMemory (\r
415 IN CHAR8 *PacketData\r
416 );\r
417\r
418\r
3402aac7
RC
419/** ‘c [addr ]’\r
420 Continue. addr is Address to resume. If addr is omitted, resume at current\r
1e57a462 421 Address.\r
3402aac7
RC
422\r
423 @param SystemContext Register content at time of the exception\r
1e57a462 424 @param *PacketData Pointer to PacketData\r
425 **/\r
426\r
427VOID\r
7609c047 428EFIAPI\r
1e57a462 429ContinueAtAddress (\r
430 IN EFI_SYSTEM_CONTEXT SystemContext,\r
431 IN CHAR8 *PacketData\r
432 );\r
433\r
434\r
435/** ‘s [addr ]’\r
3402aac7 436 Single step. addr is the Address at which to resume. If addr is omitted, resume\r
1e57a462 437 at same Address.\r
3402aac7 438\r
1e57a462 439 @param SystemContext Register content at time of the exception\r
440 @param PacketData Pointer to Payload data for the packet\r
441 **/\r
442VOID\r
7609c047 443EFIAPI\r
1e57a462 444SingleStep (\r
445 IN EFI_SYSTEM_CONTEXT SystemContext,\r
446 IN CHAR8 *PacketData\r
447 );\r
448\r
3402aac7 449/**\r
1e57a462 450 Insert Single Step in the SystemContext\r
3402aac7 451\r
1e57a462 452 @param SystemContext Register content at time of the exception\r
453 **/\r
454VOID\r
455AddSingleStep (\r
456 IN EFI_SYSTEM_CONTEXT SystemContext\r
457 );\r
3402aac7
RC
458\r
459/**\r
1e57a462 460 Remove Single Step in the SystemContext\r
3402aac7 461\r
1e57a462 462 @param SystemContext Register content at time of the exception\r
463 **/\r
464VOID\r
465RemoveSingleStep (\r
466 IN EFI_SYSTEM_CONTEXT SystemContext\r
467 );\r
3402aac7
RC
468\r
469\r
1e57a462 470/**\r
471 ‘Z1, [addr], [length]’\r
472 ‘Z2, [addr], [length]’\r
473 ‘Z3, [addr], [length]’\r
474 ‘Z4, [addr], [length]’\r
475\r
476 Insert hardware breakpoint/watchpoint at address addr of size length\r
477\r
478 @param SystemContext Register content at time of the exception\r
479 @param *PacketData Pointer to the Payload data for the packet\r
480\r
481**/\r
482VOID\r
483EFIAPI\r
484InsertBreakPoint(\r
485 IN EFI_SYSTEM_CONTEXT SystemContext,\r
486 IN CHAR8 *PacketData\r
487 );\r
488\r
489\r
490/**\r
491 ‘z1, [addr], [length]’\r
492 ‘z2, [addr], [length]’\r
493 ‘z3, [addr], [length]’\r
494 ‘z4, [addr], [length]’\r
495\r
496 Remove hardware breakpoint/watchpoint at address addr of size length\r
497\r
498 @param SystemContext Register content at time of the exception\r
499 @param *PacketData Pointer to the Payload data for the packet\r
500\r
501**/\r
502VOID\r
503EFIAPI\r
504RemoveBreakPoint(\r
505 IN EFI_SYSTEM_CONTEXT SystemContext,\r
506 IN CHAR8 *PacketData\r
507 );\r
508\r
509\r
510/**\r
c6a72cd7 511 Exception Handler for GDB. It will be called for all exceptions\r
1e57a462 512 registered via the gExceptionType[] array.\r
3402aac7 513\r
1e57a462 514 @param ExceptionType Exception that is being processed\r
3402aac7
RC
515 @param SystemContext Register content at time of the exception\r
516\r
1e57a462 517 **/\r
518VOID\r
519EFIAPI\r
3402aac7
RC
520GdbExceptionHandler (\r
521 IN EFI_EXCEPTION_TYPE ExceptionType,\r
522 IN OUT EFI_SYSTEM_CONTEXT SystemContext\r
1e57a462 523 );\r
524\r
525\r
526/**\r
3402aac7 527 Periodic callback for GDB. This function is used to catch a ctrl-c or other\r
1e57a462 528 break in type command from GDB.\r
3402aac7 529\r
1e57a462 530 @param SystemContext Register content at time of the call\r
3402aac7 531\r
1e57a462 532 **/\r
533VOID\r
534EFIAPI\r
3402aac7
RC
535GdbPeriodicCallBack (\r
536 IN OUT EFI_SYSTEM_CONTEXT SystemContext\r
1e57a462 537 );\r
538\r
539\r
540/**\r
c6a72cd7 541 Make two serial consoles: 1) StdIn and StdOut via GDB. 2) StdErr via GDB.\r
3402aac7 542\r
1e57a462 543 These console show up on the remote system running GDB\r
544\r
545**/\r
546\r
547VOID\r
548GdbInitializeSerialConsole (\r
549 VOID\r
550 );\r
551\r
552\r
553/**\r
554 Send a GDB Remote Serial Protocol Packet\r
3402aac7
RC
555\r
556 $PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',\r
c6a72cd7 557 the packet terminating character '#' and the two digit checksum.\r
3402aac7
RC
558\r
559 If an ack '+' is not sent resend the packet, but timeout eventually so we don't end up\r
c6a72cd7 560 in an infinite loop. This is so if you unplug the debugger code just keeps running\r
1e57a462 561\r
3402aac7
RC
562 @param PacketData Payload data for the packet\r
563\r
1e57a462 564 @retval Number of bytes of packet data sent.\r
565\r
566**/\r
567UINTN\r
568SendPacket (\r
569 IN CHAR8 *PacketData\r
570 );\r
3402aac7 571\r
1e57a462 572\r
573/**\r
574 Receive a GDB Remote Serial Protocol Packet\r
3402aac7
RC
575\r
576 $PacketData#checksum PacketData is passed in and this function adds the packet prefix '$',\r
c6a72cd7 577 the packet terminating character '#' and the two digit checksum.\r
3402aac7 578\r
4f0624e8 579 If host re-starts sending a packet without ending the previous packet, only the last valid packet is processed.\r
1e57a462 580 (In other words, if received packet is '$12345$12345$123456#checksum', only '$123456#checksum' will be processed.)\r
3402aac7 581\r
1e57a462 582 If an ack '+' is not sent resend the packet\r
3402aac7
RC
583\r
584 @param PacketData Payload data for the packet\r
585\r
1e57a462 586 @retval Number of bytes of packet data received.\r
587\r
588 **/\r
589UINTN\r
590ReceivePacket (\r
591 OUT CHAR8 *PacketData,\r
592 IN UINTN PacketDataSize\r
593 );\r
3402aac7 594\r
1e57a462 595\r
596/**\r
3402aac7 597 Read data from a FileDescriptor. On success number of bytes read is returned. Zero indicates\r
1e57a462 598 the end of a file. On error -1 is returned. If count is zero, GdbRead returns zero.\r
599\r
600 @param FileDescriptor Device to talk to.\r
601 @param Buffer Buffer to hold Count bytes that were read\r
3402aac7 602 @param Count Number of bytes to transfer.\r
1e57a462 603\r
604 @retval -1 Error\r
605 @retval {other} Number of bytes read.\r
606\r
607**/\r
608INTN\r
609GdbRead (\r
610 IN INTN FileDescriptor,\r
611 OUT VOID *Buffer,\r
612 IN UINTN Count\r
613 );\r
3402aac7 614\r
1e57a462 615\r
616/**\r
3402aac7
RC
617 Write data to a FileDescriptor. On success number of bytes written is returned. Zero indicates\r
618 nothing was written. On error -1 is returned.\r
1e57a462 619\r
620 @param FileDescriptor Device to talk to.\r
621 @param Buffer Buffer to hold Count bytes that are to be written\r
3402aac7 622 @param Count Number of bytes to transfer.\r
1e57a462 623\r
624 @retval -1 Error\r
625 @retval {other} Number of bytes written.\r
626\r
627**/\r
628INTN\r
629GdbWrite (\r
630 IN INTN FileDescriptor,\r
631 OUT CONST VOID *Buffer,\r
632 IN UINTN Count\r
633 );\r
634\r
3402aac7 635UINTN *\r
1e57a462 636FindPointerToRegister (\r
637 IN EFI_SYSTEM_CONTEXT SystemContext,\r
3402aac7 638 IN UINTN RegNumber\r
1e57a462 639 );\r
640\r
3402aac7 641CHAR8 *\r
1e57a462 642BasicReadRegister (\r
643 IN EFI_SYSTEM_CONTEXT SystemContext,\r
644 IN UINTN RegNumber,\r
645 IN CHAR8 *OutBufPtr\r
646 );\r
647\r
648VOID\r
649TransferFromInBufToMem (\r
650 IN UINTN Length,\r
651 IN UINT8 *Address,\r
652 IN CHAR8 *NewData\r
653 );\r
654\r
655VOID\r
656TransferFromMemToOutBufAndSend (\r
657 IN UINTN Length,\r
658 IN UINT8 *Address\r
659 );\r
660\r
661CHAR8 *\r
662BasicWriteRegister (\r
663 IN EFI_SYSTEM_CONTEXT SystemContext,\r
664 IN UINTN RegNumber,\r
665 IN CHAR8 *InBufPtr\r
666 );\r
667\r
3402aac7 668VOID\r
1e57a462 669PrintReg (\r
670 EFI_SYSTEM_CONTEXT SystemContext\r
671 );\r
672\r
673UINTN\r
674ParseBreakpointPacket (\r
675 IN CHAR8 *PacketData,\r
676 OUT UINTN *Type,\r
677 OUT UINTN *Address,\r
678 OUT UINTN *Length\r
679 );\r
680\r
681UINTN\r
682GetBreakpointDataAddress (\r
683 IN EFI_SYSTEM_CONTEXT SystemContext,\r
3402aac7 684 IN UINTN BreakpointNumber\r
1e57a462 685 );\r
686\r
687UINTN\r
688GetBreakpointDetected (\r
689 IN EFI_SYSTEM_CONTEXT SystemContext\r
690 );\r
691\r
692BREAK_TYPE\r
693GetBreakpointType (\r
694 IN EFI_SYSTEM_CONTEXT SystemContext,\r
3402aac7 695 IN UINTN BreakpointNumber\r
1e57a462 696 );\r
697\r
698UINTN\r
699ConvertLengthData (\r
700 IN UINTN Length\r
701 );\r
702\r
703EFI_STATUS\r
704FindNextFreeDebugRegister (\r
705 IN EFI_SYSTEM_CONTEXT SystemContext,\r
706 OUT UINTN *Register\r
707 );\r
708\r
709EFI_STATUS\r
710EnableDebugRegister (\r
711 IN EFI_SYSTEM_CONTEXT SystemContext,\r
712 IN UINTN Register,\r
713 IN UINTN Address,\r
714 IN UINTN Length,\r
715 IN UINTN Type\r
716 );\r
717\r
718EFI_STATUS\r
719FindMatchingDebugRegister (\r
720 IN EFI_SYSTEM_CONTEXT SystemContext,\r
721 IN UINTN Address,\r
722 IN UINTN Length,\r
723 IN UINTN Type,\r
724 OUT UINTN *Register\r
725 );\r
726\r
727EFI_STATUS\r
728DisableDebugRegister (\r
729 IN EFI_SYSTEM_CONTEXT SystemContext,\r
730 IN UINTN Register\r
731 );\r
732\r
733VOID\r
734InitializeProcessor (\r
735 VOID\r
736 );\r
737\r
738BOOLEAN\r
739ValidateAddress (\r
740 IN VOID *Address\r
741 );\r
742\r
743BOOLEAN\r
744ValidateException (\r
3402aac7
RC
745 IN EFI_EXCEPTION_TYPE ExceptionType,\r
746 IN OUT EFI_SYSTEM_CONTEXT SystemContext\r
1e57a462 747 );\r
748\r
749#endif\r