SmmProfile.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /** @file
  2. SMM profile header file.
  3. Copyright (c) 2012 - 2019, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _SMM_PROFILE_H_
  7. #define _SMM_PROFILE_H_
  8. #include "SmmProfileInternal.h"
  9. //
  10. // External functions
  11. //
  12. /**
  13. Initialize processor environment for SMM profile.
  14. @param CpuIndex The index of the processor.
  15. **/
  16. VOID
  17. ActivateSmmProfile (
  18. IN UINTN CpuIndex
  19. );
  20. /**
  21. Initialize SMM profile in SMM CPU entry point.
  22. @param[in] Cr3 The base address of the page tables to use in SMM.
  23. **/
  24. VOID
  25. InitSmmProfile (
  26. UINT32 Cr3
  27. );
  28. /**
  29. Increase SMI number in each SMI entry.
  30. **/
  31. VOID
  32. SmmProfileRecordSmiNum (
  33. VOID
  34. );
  35. /**
  36. The Page fault handler to save SMM profile data.
  37. @param Rip The RIP when exception happens.
  38. @param ErrorCode The Error code of exception.
  39. **/
  40. VOID
  41. SmmProfilePFHandler (
  42. UINTN Rip,
  43. UINTN ErrorCode
  44. );
  45. /**
  46. Updates page table to make some memory ranges (like system memory) absent
  47. and make some memory ranges (like MMIO) present and execute disable. It also
  48. update 2MB-page to 4KB-page for some memory ranges.
  49. **/
  50. VOID
  51. SmmProfileStart (
  52. VOID
  53. );
  54. /**
  55. Page fault IDT handler for SMM Profile.
  56. **/
  57. VOID
  58. EFIAPI
  59. PageFaultIdtHandlerSmmProfile (
  60. VOID
  61. );
  62. /**
  63. Check if feature is supported by a processor.
  64. **/
  65. VOID
  66. CheckFeatureSupported (
  67. VOID
  68. );
  69. /**
  70. Update page table according to protected memory ranges and the 4KB-page mapped memory ranges.
  71. **/
  72. VOID
  73. InitPaging (
  74. VOID
  75. );
  76. /**
  77. Get CPU Index from APIC ID.
  78. **/
  79. UINTN
  80. GetCpuIndex (
  81. VOID
  82. );
  83. /**
  84. Handler for Page Fault triggered by Guard page.
  85. @param ErrorCode The Error code of exception.
  86. **/
  87. VOID
  88. GuardPagePFHandler (
  89. UINTN ErrorCode
  90. );
  91. //
  92. // The flag indicates if execute-disable is supported by processor.
  93. //
  94. extern BOOLEAN mXdSupported;
  95. //
  96. // The flag indicates if execute-disable is enabled on processor.
  97. //
  98. extern BOOLEAN mXdEnabled;
  99. //
  100. // The flag indicates if #DB will be setup in #PF handler.
  101. //
  102. extern BOOLEAN mSetupDebugTrap;
  103. #endif // _SMM_PROFILE_H_