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