Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ionescu007/SimpleVisor.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ionescu <aionescu@gmail.com>2017-11-07 07:22:52 +0300
committerAlex Ionescu <aionescu@gmail.com>2017-11-07 07:22:52 +0300
commita2aafc35b86f8e17080f66d3137998359cfaea38 (patch)
tree6492abac19d102af5a67d091d2ba996eeb481185
parent23f7da3a3cd78a54c51cb53a8246e8e553cac6c7 (diff)
Fix UEFI issues -- SimpleVisor now works on UEFI MP systems.
1) On failures after vmxon, but before vmxlaunch, make sure to vmxoff. 2) On failure to initialize hypervisor, don't return SHV_STATUS_SUCCESS ultimately. This was going to get caught later by the hypervisor CPUID bit not being present, but this helps debugging. 3) Hypervisor should be an EFI driver (and runtime driver actually somee day), not EFI application 4) Fix ShvOsFreeContiguousAlignedMemory to use pages, not bytes.
-rw-r--r--shvvmx.c4
-rw-r--r--shvvp.c4
-rw-r--r--uefi/shvos.c7
-rw-r--r--uefi/uefi.props4
4 files changed, 13 insertions, 6 deletions
diff --git a/shvvmx.c b/shvvmx.c
index 4afd298..7030453 100644
--- a/shvvmx.c
+++ b/shvvmx.c
@@ -257,12 +257,13 @@ ShvVmxEnterRootModeOnVp (
{
return FALSE;
}
-
+
//
// Clear the state of the VMCS, setting it to Inactive
//
if (__vmx_vmclear(&VpData->VmcsPhysicalAddress))
{
+ __vmx_off();
return FALSE;
}
@@ -271,6 +272,7 @@ ShvVmxEnterRootModeOnVp (
//
if (__vmx_vmptrld(&VpData->VmcsPhysicalAddress))
{
+ __vmx_off();
return FALSE;
}
diff --git a/shvvp.c b/shvvp.c
index cb822b6..75334c5 100644
--- a/shvvp.c
+++ b/shvvp.c
@@ -152,7 +152,7 @@ ShvVpInitialize (
//
// If we got here, the hypervisor is running :-)
//
- return SHV_STATUS_SUCCESS;
+ return status;
}
VOID
@@ -229,7 +229,7 @@ ShvVpLoadCallback (
INT32 status;
vpData = NULL;
-
+
//
// Detect if the hardware appears to support VMX root mode to start.
// No attempts are made to enable this if it is lacking or disabled.
diff --git a/uefi/shvos.c b/uefi/shvos.c
index 85a3713..57732bf 100644
--- a/uefi/shvos.c
+++ b/uefi/shvos.c
@@ -58,6 +58,11 @@ Environment:
extern CONST UINT32 _gUefiDriverRevision = 0;
//
+// We support unload
+//
+const UINT8 _gDriverUnloadImageCount = 1;
+
+//
// Our name
//
CHAR8 *gEfiCallerBaseName = "SimpleVisor";
@@ -257,7 +262,7 @@ ShvOsFreeContiguousAlignedMemory (
//
// Free the memory
//
- FreeAlignedPages(BaseAddress, Size);
+ FreeAlignedPages(BaseAddress, EFI_SIZE_TO_PAGES(Size));
}
VOID*
diff --git a/uefi/uefi.props b/uefi/uefi.props
index 2841656..065df75 100644
--- a/uefi/uefi.props
+++ b/uefi/uefi.props
@@ -31,9 +31,9 @@
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
- <AdditionalDependencies>UefiHiiLib.lib;UefiHiiServicesLib.lib;UefiSortLib.lib;UefiShellLib.lib;GlueLib.lib;BaseLib.lib;BaseDebugPrintErrorLevelLib.lib;BasePrintLib.lib;UefiLib.lib;UefiBootServicesTableLib.lib;UefiRuntimeServicesTableLib.lib;UefiDevicePathLibDevicePathProtocol.lib;UefiDebugLibConOut.lib;UefiMemoryLib.lib;UefiMemoryAllocationLib.lib;BaseSynchronizationLib.lib;UefiFileHandleLib.lib;UefiApplicationEntryPoint.lib</AdditionalDependencies>
+ <AdditionalDependencies>UefiHiiLib.lib;UefiHiiServicesLib.lib;UefiSortLib.lib;UefiShellLib.lib;GlueLib.lib;BaseLib.lib;BaseDebugPrintErrorLevelLib.lib;BasePrintLib.lib;UefiLib.lib;UefiBootServicesTableLib.lib;UefiRuntimeServicesTableLib.lib;UefiDevicePathLibDevicePathProtocol.lib;UefiDebugLibConOut.lib;UefiMemoryLib.lib;UefiMemoryAllocationLib.lib;BaseSynchronizationLib.lib;UefiFileHandleLib.lib;UefiDriverEntryPoint.lib</AdditionalDependencies>
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
- <SubSystem>EFI Application</SubSystem>
+ <SubSystem>EFI Boot Service Driver</SubSystem>
<Driver>Driver</Driver>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding />