You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DebugSupport.h 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. /** @file
  2. DebugSupport protocol and supporting definitions as defined in the UEFI2.0
  3. specification.
  4. The DebugSupport protocol is used by source level debuggers to abstract the
  5. processor and handle context save and restore operations.
  6. Copyright (c) 2006 - 2008, Intel Corporation
  7. All rights reserved. This program and the accompanying materials
  8. are licensed and made available under the terms and conditions of the BSD License
  9. which accompanies this distribution. The full text of the license may be found at
  10. http://opensource.org/licenses/bsd-license.php
  11. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  12. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  13. **/
  14. #ifndef __DEBUG_SUPPORT_H__
  15. #define __DEBUG_SUPPORT_H__
  16. #include <gpxe/efi/ProcessorBind.h>
  17. #include <gpxe/efi/IndustryStandard/PeImage.h>
  18. typedef struct _EFI_DEBUG_SUPPORT_PROTOCOL EFI_DEBUG_SUPPORT_PROTOCOL;
  19. ///
  20. /// Debug Support protocol {2755590C-6F3C-42FA-9EA4-A3BA543CDA25}
  21. ///
  22. #define EFI_DEBUG_SUPPORT_PROTOCOL_GUID \
  23. { \
  24. 0x2755590C, 0x6F3C, 0x42FA, {0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 } \
  25. }
  26. ///
  27. /// Debug Support definitions
  28. ///
  29. typedef INTN EFI_EXCEPTION_TYPE;
  30. //
  31. // IA-32 processor exception types
  32. //
  33. #define EXCEPT_IA32_DIVIDE_ERROR 0
  34. #define EXCEPT_IA32_DEBUG 1
  35. #define EXCEPT_IA32_NMI 2
  36. #define EXCEPT_IA32_BREAKPOINT 3
  37. #define EXCEPT_IA32_OVERFLOW 4
  38. #define EXCEPT_IA32_BOUND 5
  39. #define EXCEPT_IA32_INVALID_OPCODE 6
  40. #define EXCEPT_IA32_DOUBLE_FAULT 8
  41. #define EXCEPT_IA32_INVALID_TSS 10
  42. #define EXCEPT_IA32_SEG_NOT_PRESENT 11
  43. #define EXCEPT_IA32_STACK_FAULT 12
  44. #define EXCEPT_IA32_GP_FAULT 13
  45. #define EXCEPT_IA32_PAGE_FAULT 14
  46. #define EXCEPT_IA32_FP_ERROR 16
  47. #define EXCEPT_IA32_ALIGNMENT_CHECK 17
  48. #define EXCEPT_IA32_MACHINE_CHECK 18
  49. #define EXCEPT_IA32_SIMD 19
  50. ///
  51. /// IA-32 processor context definition
  52. ///
  53. ///
  54. /// FXSAVE_STATE
  55. /// FP / MMX / XMM registers (see fxrstor instruction definition)
  56. ///
  57. typedef struct {
  58. UINT16 Fcw;
  59. UINT16 Fsw;
  60. UINT16 Ftw;
  61. UINT16 Opcode;
  62. UINT32 Eip;
  63. UINT16 Cs;
  64. UINT16 Reserved1;
  65. UINT32 DataOffset;
  66. UINT16 Ds;
  67. UINT8 Reserved2[10];
  68. UINT8 St0Mm0[10], Reserved3[6];
  69. UINT8 St1Mm1[10], Reserved4[6];
  70. UINT8 St2Mm2[10], Reserved5[6];
  71. UINT8 St3Mm3[10], Reserved6[6];
  72. UINT8 St4Mm4[10], Reserved7[6];
  73. UINT8 St5Mm5[10], Reserved8[6];
  74. UINT8 St6Mm6[10], Reserved9[6];
  75. UINT8 St7Mm7[10], Reserved10[6];
  76. UINT8 Xmm0[16];
  77. UINT8 Xmm1[16];
  78. UINT8 Xmm2[16];
  79. UINT8 Xmm3[16];
  80. UINT8 Xmm4[16];
  81. UINT8 Xmm5[16];
  82. UINT8 Xmm6[16];
  83. UINT8 Xmm7[16];
  84. UINT8 Reserved11[14 * 16];
  85. } EFI_FX_SAVE_STATE_IA32;
  86. typedef struct {
  87. UINT32 ExceptionData;
  88. EFI_FX_SAVE_STATE_IA32 FxSaveState;
  89. UINT32 Dr0;
  90. UINT32 Dr1;
  91. UINT32 Dr2;
  92. UINT32 Dr3;
  93. UINT32 Dr6;
  94. UINT32 Dr7;
  95. UINT32 Cr0;
  96. UINT32 Cr1; /* Reserved */
  97. UINT32 Cr2;
  98. UINT32 Cr3;
  99. UINT32 Cr4;
  100. UINT32 Eflags;
  101. UINT32 Ldtr;
  102. UINT32 Tr;
  103. UINT32 Gdtr[2];
  104. UINT32 Idtr[2];
  105. UINT32 Eip;
  106. UINT32 Gs;
  107. UINT32 Fs;
  108. UINT32 Es;
  109. UINT32 Ds;
  110. UINT32 Cs;
  111. UINT32 Ss;
  112. UINT32 Edi;
  113. UINT32 Esi;
  114. UINT32 Ebp;
  115. UINT32 Esp;
  116. UINT32 Ebx;
  117. UINT32 Edx;
  118. UINT32 Ecx;
  119. UINT32 Eax;
  120. } EFI_SYSTEM_CONTEXT_IA32;
  121. //
  122. // X64 processor exception types
  123. //
  124. #define EXCEPT_X64_DIVIDE_ERROR 0
  125. #define EXCEPT_X64_DEBUG 1
  126. #define EXCEPT_X64_NMI 2
  127. #define EXCEPT_X64_BREAKPOINT 3
  128. #define EXCEPT_X64_OVERFLOW 4
  129. #define EXCEPT_X64_BOUND 5
  130. #define EXCEPT_X64_INVALID_OPCODE 6
  131. #define EXCEPT_X64_DOUBLE_FAULT 8
  132. #define EXCEPT_X64_INVALID_TSS 10
  133. #define EXCEPT_X64_SEG_NOT_PRESENT 11
  134. #define EXCEPT_X64_STACK_FAULT 12
  135. #define EXCEPT_X64_GP_FAULT 13
  136. #define EXCEPT_X64_PAGE_FAULT 14
  137. #define EXCEPT_X64_FP_ERROR 16
  138. #define EXCEPT_X64_ALIGNMENT_CHECK 17
  139. #define EXCEPT_X64_MACHINE_CHECK 18
  140. #define EXCEPT_X64_SIMD 19
  141. ///
  142. /// X64 processor context definition
  143. ///
  144. /// FXSAVE_STATE
  145. /// FP / MMX / XMM registers (see fxrstor instruction definition)
  146. ///
  147. typedef struct {
  148. UINT16 Fcw;
  149. UINT16 Fsw;
  150. UINT16 Ftw;
  151. UINT16 Opcode;
  152. UINT64 Rip;
  153. UINT64 DataOffset;
  154. UINT8 Reserved1[8];
  155. UINT8 St0Mm0[10], Reserved2[6];
  156. UINT8 St1Mm1[10], Reserved3[6];
  157. UINT8 St2Mm2[10], Reserved4[6];
  158. UINT8 St3Mm3[10], Reserved5[6];
  159. UINT8 St4Mm4[10], Reserved6[6];
  160. UINT8 St5Mm5[10], Reserved7[6];
  161. UINT8 St6Mm6[10], Reserved8[6];
  162. UINT8 St7Mm7[10], Reserved9[6];
  163. UINT8 Xmm0[16];
  164. UINT8 Xmm1[16];
  165. UINT8 Xmm2[16];
  166. UINT8 Xmm3[16];
  167. UINT8 Xmm4[16];
  168. UINT8 Xmm5[16];
  169. UINT8 Xmm6[16];
  170. UINT8 Xmm7[16];
  171. //
  172. // NOTE: UEFI 2.0 spec definition as follows.
  173. //
  174. UINT8 Reserved11[14 * 16];
  175. } EFI_FX_SAVE_STATE_X64;
  176. typedef struct {
  177. UINT64 ExceptionData;
  178. EFI_FX_SAVE_STATE_X64 FxSaveState;
  179. UINT64 Dr0;
  180. UINT64 Dr1;
  181. UINT64 Dr2;
  182. UINT64 Dr3;
  183. UINT64 Dr6;
  184. UINT64 Dr7;
  185. UINT64 Cr0;
  186. UINT64 Cr1; /* Reserved */
  187. UINT64 Cr2;
  188. UINT64 Cr3;
  189. UINT64 Cr4;
  190. UINT64 Cr8;
  191. UINT64 Rflags;
  192. UINT64 Ldtr;
  193. UINT64 Tr;
  194. UINT64 Gdtr[2];
  195. UINT64 Idtr[2];
  196. UINT64 Rip;
  197. UINT64 Gs;
  198. UINT64 Fs;
  199. UINT64 Es;
  200. UINT64 Ds;
  201. UINT64 Cs;
  202. UINT64 Ss;
  203. UINT64 Rdi;
  204. UINT64 Rsi;
  205. UINT64 Rbp;
  206. UINT64 Rsp;
  207. UINT64 Rbx;
  208. UINT64 Rdx;
  209. UINT64 Rcx;
  210. UINT64 Rax;
  211. UINT64 R8;
  212. UINT64 R9;
  213. UINT64 R10;
  214. UINT64 R11;
  215. UINT64 R12;
  216. UINT64 R13;
  217. UINT64 R14;
  218. UINT64 R15;
  219. } EFI_SYSTEM_CONTEXT_X64;
  220. //
  221. // IPF processor exception types
  222. //
  223. #define EXCEPT_IPF_VHTP_TRANSLATION 0
  224. #define EXCEPT_IPF_INSTRUCTION_TLB 1
  225. #define EXCEPT_IPF_DATA_TLB 2
  226. #define EXCEPT_IPF_ALT_INSTRUCTION_TLB 3
  227. #define EXCEPT_IPF_ALT_DATA_TLB 4
  228. #define EXCEPT_IPF_DATA_NESTED_TLB 5
  229. #define EXCEPT_IPF_INSTRUCTION_KEY_MISSED 6
  230. #define EXCEPT_IPF_DATA_KEY_MISSED 7
  231. #define EXCEPT_IPF_DIRTY_BIT 8
  232. #define EXCEPT_IPF_INSTRUCTION_ACCESS_BIT 9
  233. #define EXCEPT_IPF_DATA_ACCESS_BIT 10
  234. #define EXCEPT_IPF_BREAKPOINT 11
  235. #define EXCEPT_IPF_EXTERNAL_INTERRUPT 12
  236. //
  237. // 13 - 19 reserved
  238. //
  239. #define EXCEPT_IPF_PAGE_NOT_PRESENT 20
  240. #define EXCEPT_IPF_KEY_PERMISSION 21
  241. #define EXCEPT_IPF_INSTRUCTION_ACCESS_RIGHTS 22
  242. #define EXCEPT_IPF_DATA_ACCESS_RIGHTS 23
  243. #define EXCEPT_IPF_GENERAL_EXCEPTION 24
  244. #define EXCEPT_IPF_DISABLED_FP_REGISTER 25
  245. #define EXCEPT_IPF_NAT_CONSUMPTION 26
  246. #define EXCEPT_IPF_SPECULATION 27
  247. //
  248. // 28 reserved
  249. //
  250. #define EXCEPT_IPF_DEBUG 29
  251. #define EXCEPT_IPF_UNALIGNED_REFERENCE 30
  252. #define EXCEPT_IPF_UNSUPPORTED_DATA_REFERENCE 31
  253. #define EXCEPT_IPF_FP_FAULT 32
  254. #define EXCEPT_IPF_FP_TRAP 33
  255. #define EXCEPT_IPF_LOWER_PRIVILEGE_TRANSFER_TRAP 34
  256. #define EXCEPT_IPF_TAKEN_BRANCH 35
  257. #define EXCEPT_IPF_SINGLE_STEP 36
  258. //
  259. // 37 - 44 reserved
  260. //
  261. #define EXCEPT_IPF_IA32_EXCEPTION 45
  262. #define EXCEPT_IPF_IA32_INTERCEPT 46
  263. #define EXCEPT_IPF_IA32_INTERRUPT 47
  264. ///
  265. /// IPF processor context definition
  266. ///
  267. typedef struct {
  268. //
  269. // The first reserved field is necessary to preserve alignment for the correct
  270. // bits in UNAT and to insure F2 is 16 byte aligned..
  271. //
  272. UINT64 Reserved;
  273. UINT64 R1;
  274. UINT64 R2;
  275. UINT64 R3;
  276. UINT64 R4;
  277. UINT64 R5;
  278. UINT64 R6;
  279. UINT64 R7;
  280. UINT64 R8;
  281. UINT64 R9;
  282. UINT64 R10;
  283. UINT64 R11;
  284. UINT64 R12;
  285. UINT64 R13;
  286. UINT64 R14;
  287. UINT64 R15;
  288. UINT64 R16;
  289. UINT64 R17;
  290. UINT64 R18;
  291. UINT64 R19;
  292. UINT64 R20;
  293. UINT64 R21;
  294. UINT64 R22;
  295. UINT64 R23;
  296. UINT64 R24;
  297. UINT64 R25;
  298. UINT64 R26;
  299. UINT64 R27;
  300. UINT64 R28;
  301. UINT64 R29;
  302. UINT64 R30;
  303. UINT64 R31;
  304. UINT64 F2[2];
  305. UINT64 F3[2];
  306. UINT64 F4[2];
  307. UINT64 F5[2];
  308. UINT64 F6[2];
  309. UINT64 F7[2];
  310. UINT64 F8[2];
  311. UINT64 F9[2];
  312. UINT64 F10[2];
  313. UINT64 F11[2];
  314. UINT64 F12[2];
  315. UINT64 F13[2];
  316. UINT64 F14[2];
  317. UINT64 F15[2];
  318. UINT64 F16[2];
  319. UINT64 F17[2];
  320. UINT64 F18[2];
  321. UINT64 F19[2];
  322. UINT64 F20[2];
  323. UINT64 F21[2];
  324. UINT64 F22[2];
  325. UINT64 F23[2];
  326. UINT64 F24[2];
  327. UINT64 F25[2];
  328. UINT64 F26[2];
  329. UINT64 F27[2];
  330. UINT64 F28[2];
  331. UINT64 F29[2];
  332. UINT64 F30[2];
  333. UINT64 F31[2];
  334. UINT64 Pr;
  335. UINT64 B0;
  336. UINT64 B1;
  337. UINT64 B2;
  338. UINT64 B3;
  339. UINT64 B4;
  340. UINT64 B5;
  341. UINT64 B6;
  342. UINT64 B7;
  343. //
  344. // application registers
  345. //
  346. UINT64 ArRsc;
  347. UINT64 ArBsp;
  348. UINT64 ArBspstore;
  349. UINT64 ArRnat;
  350. UINT64 ArFcr;
  351. UINT64 ArEflag;
  352. UINT64 ArCsd;
  353. UINT64 ArSsd;
  354. UINT64 ArCflg;
  355. UINT64 ArFsr;
  356. UINT64 ArFir;
  357. UINT64 ArFdr;
  358. UINT64 ArCcv;
  359. UINT64 ArUnat;
  360. UINT64 ArFpsr;
  361. UINT64 ArPfs;
  362. UINT64 ArLc;
  363. UINT64 ArEc;
  364. //
  365. // control registers
  366. //
  367. UINT64 CrDcr;
  368. UINT64 CrItm;
  369. UINT64 CrIva;
  370. UINT64 CrPta;
  371. UINT64 CrIpsr;
  372. UINT64 CrIsr;
  373. UINT64 CrIip;
  374. UINT64 CrIfa;
  375. UINT64 CrItir;
  376. UINT64 CrIipa;
  377. UINT64 CrIfs;
  378. UINT64 CrIim;
  379. UINT64 CrIha;
  380. //
  381. // debug registers
  382. //
  383. UINT64 Dbr0;
  384. UINT64 Dbr1;
  385. UINT64 Dbr2;
  386. UINT64 Dbr3;
  387. UINT64 Dbr4;
  388. UINT64 Dbr5;
  389. UINT64 Dbr6;
  390. UINT64 Dbr7;
  391. UINT64 Ibr0;
  392. UINT64 Ibr1;
  393. UINT64 Ibr2;
  394. UINT64 Ibr3;
  395. UINT64 Ibr4;
  396. UINT64 Ibr5;
  397. UINT64 Ibr6;
  398. UINT64 Ibr7;
  399. //
  400. // virtual registers - nat bits for R1-R31
  401. //
  402. UINT64 IntNat;
  403. } EFI_SYSTEM_CONTEXT_IPF;
  404. //
  405. // EBC processor exception types
  406. //
  407. #define EXCEPT_EBC_UNDEFINED 0
  408. #define EXCEPT_EBC_DIVIDE_ERROR 1
  409. #define EXCEPT_EBC_DEBUG 2
  410. #define EXCEPT_EBC_BREAKPOINT 3
  411. #define EXCEPT_EBC_OVERFLOW 4
  412. #define EXCEPT_EBC_INVALID_OPCODE 5 // opcode out of range
  413. #define EXCEPT_EBC_STACK_FAULT 6
  414. #define EXCEPT_EBC_ALIGNMENT_CHECK 7
  415. #define EXCEPT_EBC_INSTRUCTION_ENCODING 8 // malformed instruction
  416. #define EXCEPT_EBC_BAD_BREAK 9 // BREAK 0 or undefined BREAK
  417. #define EXCEPT_EBC_STEP 10 // to support debug stepping
  418. ///
  419. /// For coding convenience, define the maximum valid EBC exception.
  420. ///
  421. #define MAX_EBC_EXCEPTION EXCEPT_EBC_STEP
  422. ///
  423. /// EBC processor context definition
  424. ///
  425. typedef struct {
  426. UINT64 R0;
  427. UINT64 R1;
  428. UINT64 R2;
  429. UINT64 R3;
  430. UINT64 R4;
  431. UINT64 R5;
  432. UINT64 R6;
  433. UINT64 R7;
  434. UINT64 Flags;
  435. UINT64 ControlFlags;
  436. UINT64 Ip;
  437. } EFI_SYSTEM_CONTEXT_EBC;
  438. ///
  439. /// Universal EFI_SYSTEM_CONTEXT definition
  440. ///
  441. typedef union {
  442. EFI_SYSTEM_CONTEXT_EBC *SystemContextEbc;
  443. EFI_SYSTEM_CONTEXT_IA32 *SystemContextIa32;
  444. EFI_SYSTEM_CONTEXT_X64 *SystemContextX64;
  445. EFI_SYSTEM_CONTEXT_IPF *SystemContextIpf;
  446. } EFI_SYSTEM_CONTEXT;
  447. //
  448. // DebugSupport callback function prototypes
  449. //
  450. /**
  451. Registers and enables an exception callback function for the specified exception.
  452. @param ExceptionType Exception types in EBC, IA-32, X64, or IPF
  453. @param SystemContext Exception content.
  454. **/
  455. typedef
  456. VOID
  457. (*EFI_EXCEPTION_CALLBACK)(
  458. IN EFI_EXCEPTION_TYPE ExceptionType,
  459. IN OUT EFI_SYSTEM_CONTEXT SystemContext
  460. );
  461. /**
  462. Registers and enables the on-target debug agent's periodic entry point.
  463. @param SystemContext Exception content.
  464. **/
  465. typedef
  466. VOID
  467. (*EFI_PERIODIC_CALLBACK)(
  468. IN OUT EFI_SYSTEM_CONTEXT SystemContext
  469. );
  470. ///
  471. /// Machine type definition
  472. ///
  473. typedef enum {
  474. IsaIa32 = IMAGE_FILE_MACHINE_I386, ///< 0x014C
  475. IsaX64 = IMAGE_FILE_MACHINE_X64, ///< 0x8664
  476. IsaIpf = IMAGE_FILE_MACHINE_IA64, ///< 0x0200
  477. IsaEbc = IMAGE_FILE_MACHINE_EBC ///< 0x0EBC
  478. } EFI_INSTRUCTION_SET_ARCHITECTURE;
  479. //
  480. // DebugSupport member function definitions
  481. //
  482. /**
  483. Returns the maximum value that may be used for the ProcessorIndex parameter in
  484. RegisterPeriodicCallback() and RegisterExceptionCallback().
  485. @param This A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance.
  486. @param MaxProcessorIndex Pointer to a caller-allocated UINTN in which the maximum supported
  487. processor index is returned.
  488. @retval EFI_SUCCESS The function completed successfully.
  489. **/
  490. typedef
  491. EFI_STATUS
  492. (EFIAPI *EFI_GET_MAXIMUM_PROCESSOR_INDEX)(
  493. IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
  494. OUT UINTN *MaxProcessorIndex
  495. );
  496. /**
  497. Registers a function to be called back periodically in interrupt context.
  498. @param This A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance.
  499. @param ProcessorIndex Specifies which processor the callback function applies to.
  500. @param PeriodicCallback A pointer to a function of type PERIODIC_CALLBACK that is the main
  501. periodic entry point of the debug agent.
  502. @retval EFI_SUCCESS The function completed successfully.
  503. @retval EFI_ALREADY_STARTED Non-NULL PeriodicCallback parameter when a callback
  504. function was previously registered.
  505. @retval EFI_OUT_OF_RESOURCES System has insufficient memory resources to register new callback
  506. function.
  507. **/
  508. typedef
  509. EFI_STATUS
  510. (EFIAPI *EFI_REGISTER_PERIODIC_CALLBACK)(
  511. IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
  512. IN UINTN ProcessorIndex,
  513. IN EFI_PERIODIC_CALLBACK PeriodicCallback
  514. );
  515. /**
  516. Registers a function to be called when a given processor exception occurs.
  517. @param This A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance.
  518. @param ProcessorIndex Specifies which processor the callback function applies to.
  519. @param PeriodicCallback A pointer to a function of type EXCEPTION_CALLBACK that is called
  520. when the processor exception specified by ExceptionType occurs.
  521. @param ExceptionType Specifies which processor exception to hook.
  522. @retval EFI_SUCCESS The function completed successfully.
  523. @retval EFI_ALREADY_STARTED Non-NULL PeriodicCallback parameter when a callback
  524. function was previously registered.
  525. @retval EFI_OUT_OF_RESOURCES System has insufficient memory resources to register new callback
  526. function.
  527. **/
  528. typedef
  529. EFI_STATUS
  530. (EFIAPI *EFI_REGISTER_EXCEPTION_CALLBACK)(
  531. IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
  532. IN UINTN ProcessorIndex,
  533. IN EFI_EXCEPTION_CALLBACK ExceptionCallback,
  534. IN EFI_EXCEPTION_TYPE ExceptionType
  535. );
  536. /**
  537. Invalidates processor instruction cache for a memory range. Subsequent execution in this range
  538. causes a fresh memory fetch to retrieve code to be executed.
  539. @param This A pointer to the EFI_DEBUG_SUPPORT_PROTOCOL instance.
  540. @param ProcessorIndex Specifies which processor's instruction cache is to be invalidated.
  541. @param Start Specifies the physical base of the memory range to be invalidated.
  542. @param Length Specifies the minimum number of bytes in the processor's instruction
  543. cache to invalidate.
  544. @retval EFI_SUCCESS The function completed successfully.
  545. **/
  546. typedef
  547. EFI_STATUS
  548. (EFIAPI *EFI_INVALIDATE_INSTRUCTION_CACHE)(
  549. IN EFI_DEBUG_SUPPORT_PROTOCOL *This,
  550. IN UINTN ProcessorIndex,
  551. IN VOID *Start,
  552. IN UINT64 Length
  553. );
  554. ///
  555. /// This protocol provides the services to allow the debug agent to register
  556. /// callback functions that are called either periodically or when specific
  557. /// processor exceptions occur.
  558. ///
  559. struct _EFI_DEBUG_SUPPORT_PROTOCOL {
  560. ///
  561. /// Declares the processor architecture for this instance of the EFI Debug Support protocol.
  562. ///
  563. EFI_INSTRUCTION_SET_ARCHITECTURE Isa;
  564. EFI_GET_MAXIMUM_PROCESSOR_INDEX GetMaximumProcessorIndex;
  565. EFI_REGISTER_PERIODIC_CALLBACK RegisterPeriodicCallback;
  566. EFI_REGISTER_EXCEPTION_CALLBACK RegisterExceptionCallback;
  567. EFI_INVALIDATE_INSTRUCTION_CACHE InvalidateInstructionCache;
  568. };
  569. extern EFI_GUID gEfiDebugSupportProtocolGuid;
  570. #endif