aboutsummaryrefslogtreecommitdiff
path: root/EfiGuardDxe/VisualUefi.c
diff options
context:
space:
mode:
authorMattiwatti <mattiwatti@gmail.com>2019-03-25 20:56:43 +0100
committerMattiwatti <mattiwatti@gmail.com>2019-03-25 20:56:43 +0100
commit0be8f445b64ab36e086bd7e3a2913fdd147bd00f (patch)
tree50e94db7d2f159f621f17096162c97a5e471cfa4 /EfiGuardDxe/VisualUefi.c
Initial commitv1.0
Diffstat (limited to 'EfiGuardDxe/VisualUefi.c')
-rw-r--r--EfiGuardDxe/VisualUefi.c108
1 files changed, 108 insertions, 0 deletions
diff --git a/EfiGuardDxe/VisualUefi.c b/EfiGuardDxe/VisualUefi.c
new file mode 100644
index 0000000..ec02953
--- /dev/null
+++ b/EfiGuardDxe/VisualUefi.c
@@ -0,0 +1,108 @@
+//
+// This file adds some things that are needed by VisualUefi. It should not be included under [Sources] of EDK2 .inf files.
+//
+#ifdef VISUALUEFI
+
+#include <Uefi.h>
+#include <Protocol/DriverSupportedEfiVersion.h>
+#include <Protocol/EfiGuard.h>
+#include <Guid/Acpi.h>
+#include <Library/DebugLib.h>
+
+
+//
+// The following fields are automatically generated by the EDK2 build system, but VisualUefi expects them in the source code.
+//
+CONST UINT8 _gDriverUnloadImageCount = 1;
+CONST UINT32 _gUefiDriverRevision = 0x210;
+CONST UINT32 _gDxeRevision = 0x210;
+CHAR8 *gEfiCallerBaseName = "EfiGuardDxe";
+
+
+//
+// EfiGuard Bootkit Driver Protocol
+//
+EFI_GUID gEfiGuardDriverProtocolGuid = EFI_EFIGUARD_DRIVER_PROTOCOL_GUID;
+
+
+//
+// GUIDs
+//
+EFI_GUID gEfiDriverSupportedEfiVersionProtocolGuid = EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL_GUID;
+EFI_GUID gEfiAcpi20TableGuid = EFI_ACPI_20_TABLE_GUID;
+
+
+//
+// Placeholder definitions to make linking against BaseSynchronizationLib possible. See https://github.com/ionescu007/VisualUefi/issues/25
+// This is not a problem for us because we don't use spinlocks, only interlocked operations.
+//
+UINTN
+EFIAPI
+InternalGetSpinLockProperties(
+ VOID
+ )
+{
+ ASSERT(FALSE);
+ return (UINTN)-1;
+}
+
+UINT64
+EFIAPI
+GetPerformanceCounter(
+ VOID
+ )
+{
+ ASSERT(FALSE);
+ return (UINT64)-1;
+}
+
+UINT64
+EFIAPI
+GetPerformanceCounterProperties(
+ OUT UINT64 *StartValue OPTIONAL,
+ OUT UINT64 *EndValue OPTIONAL
+ )
+{
+ ASSERT(FALSE);
+ return (UINT64)-1;
+}
+
+
+//
+// Entry/unload handlers that VisualUefi expects with predefined names
+//
+extern
+EFI_STATUS
+EFIAPI
+EfiGuardInitialize(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+EFI_STATUS
+EFIAPI
+UefiMain(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ return EfiGuardInitialize(ImageHandle, SystemTable);
+}
+
+extern
+EFI_STATUS
+EFIAPI
+EfiGuardUnload(
+ IN EFI_HANDLE ImageHandle
+ );
+
+EFI_STATUS
+EFIAPI
+UefiUnload(
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ return EfiGuardUnload(ImageHandle);
+}
+
+#endif // VISUALUEFI