diff options
author | Matthijs Lavrijsen <mattiwatti@gmail.com> | 2023-03-26 14:13:39 +0200 |
---|---|---|
committer | Matthijs Lavrijsen <mattiwatti@gmail.com> | 2023-03-26 15:11:22 +0200 |
commit | 4465715c2c3abbd554f2ee09360532bcf257d34a (patch) | |
tree | 2661684514dbcebc7f610afd2760744c142adf73 /EfiGuardDxe/util.h | |
parent | 30e8570f9a3585572f60867166ac74f8951bf804 (diff) |
Add CopyWpMem and SetWpMem routines
Additionally make SetServicePointer also clear and restore CR0.WP if needed
Diffstat (limited to 'EfiGuardDxe/util.h')
-rw-r--r-- | EfiGuardDxe/util.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/EfiGuardDxe/util.h b/EfiGuardDxe/util.h index d69fc89..89c13e6 100644 --- a/EfiGuardDxe/util.h +++ b/EfiGuardDxe/util.h @@ -6,6 +6,9 @@ #include <Zydis/Formatter.h> #endif +#define CR0_WP ((UINTN)0x10000) // CR0.WP + + // // Stalls CPU for N milliseconds // @@ -48,6 +51,28 @@ PrintKernelPatchInfo( ); // +// Wrapper for CopyMem() that disables write protection prior to copying if needed. +// +VOID* +EFIAPI +CopyWpMem( + OUT VOID *Destination, + IN CONST VOID *Source, + IN UINTN Length + ); + +// +// Wrapper for SetMem() that disables write protection prior to copying if needed. +// +VOID* +EFIAPI +SetWpMem( + OUT VOID *Destination, + IN UINTN Length, + IN UINT8 Value + ); + +// // Case-insensitive string comparison. // INTN |