diff options
author | ionescu007 <aionescu+git@gmail.com> | 2016-09-03 19:05:42 +0300 |
---|---|---|
committer | ionescu007 <aionescu+git@gmail.com> | 2016-09-03 19:05:42 +0300 |
commit | f5dd1af02f22e2caf564dea4705bce2d42167061 (patch) | |
tree | 0ed56e8c5919731fb3dfa70b6d7a922bbcfb4995 | |
parent | dfd4909816fc06841cffc86d1c2170e5cd68bfbd (diff) |
Last fixes. Now builds/works in UEFI with a shared code base.
-rw-r--r-- | ntint.h | 2 | ||||
-rw-r--r-- | shv.h | 2 | ||||
-rw-r--r-- | shv.vcxproj | 2 | ||||
-rw-r--r-- | shvvmx.c | 8 | ||||
-rw-r--r-- | shvvp.c | 12 |
5 files changed, 17 insertions, 9 deletions
@@ -21,6 +21,8 @@ Environment: --*/ #pragma once +#pragma warning(disable:4201) +#pragma warning(disable:4214) #define VOID void #define DECLSPEC_ALIGN(x) __declspec(align(x)) @@ -128,7 +128,7 @@ ShvOsUnprepareProcessor ( _In_ PSHV_VP_DATA VpData ); -VOID +INT32 ShvOsPrepareProcessor ( _In_ PSHV_VP_DATA VpData ); diff --git a/shv.vcxproj b/shv.vcxproj index 98bf27a..fd0e09c 100644 --- a/shv.vcxproj +++ b/shv.vcxproj @@ -70,7 +70,7 @@ </ItemGroup> <ItemGroup> <MASM Include="shvvmxhvx64.asm" /> - <MASM Include="shvx64.asm" /> + <MASM Include="shvosx64.asm" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> @@ -251,7 +251,7 @@ ShvVmxSetupVmcsForVp ( __vmx_vmwrite(VM_ENTRY_CONTROLS, ShvUtilAdjustMsr(VpData->MsrData[16], VM_ENTRY_IA32E_MODE)); - + // // Load the CS Segment (Ring 0 Code) // @@ -291,7 +291,7 @@ ShvVmxSetupVmcsForVp ( __vmx_vmwrite(GUEST_ES_AR_BYTES, vmxGdtEntry.AccessRights); __vmx_vmwrite(GUEST_ES_BASE, vmxGdtEntry.Base); __vmx_vmwrite(HOST_ES_SELECTOR, context->SegEs & ~RPL_MASK); - + // // Load the FS Segment (Ring 3 Compatibility-Mode TEB) // @@ -302,7 +302,7 @@ ShvVmxSetupVmcsForVp ( __vmx_vmwrite(GUEST_FS_BASE, vmxGdtEntry.Base); __vmx_vmwrite(HOST_FS_BASE, vmxGdtEntry.Base); __vmx_vmwrite(HOST_FS_SELECTOR, context->SegFs & ~RPL_MASK); - + // // Load the GS Segment (Ring 3 Data if in Compatibility-Mode, MSR-based in Long Mode) // @@ -324,7 +324,7 @@ ShvVmxSetupVmcsForVp ( __vmx_vmwrite(GUEST_TR_BASE, vmxGdtEntry.Base); __vmx_vmwrite(HOST_TR_BASE, vmxGdtEntry.Base); __vmx_vmwrite(HOST_TR_SELECTOR, state->Tr & ~RPL_MASK); - + // // Load the Local Descriptor Table (Ring 0 LDT on Redstone) // @@ -114,10 +114,16 @@ ShvVpInitialize ( _In_ PSHV_VP_DATA Data ) { + INT32 status; + // // Prepare any OS-specific CPU data // - ShvOsPrepareProcessor(Data); + status = ShvOsPrepareProcessor(Data); + if (status != SHV_STATUS_SUCCESS) + { + return status; + } // Read the special control registers for this processor // Note: KeSaveStateForHibernate(&Data->HostState) can be used as a Windows @@ -140,11 +146,11 @@ ShvVpInitialize ( // If the AC bit is not set in EFLAGS, it means that we have not yet // launched the VM. Attempt to initialize VMX on this processor. // - return ShvVmxLaunchOnVp(Data); + status = ShvVmxLaunchOnVp(Data); } // - // IF we got here, the hypervisor is running :-) + // If we got here, the hypervisor is running :-) // return SHV_STATUS_SUCCESS; } |