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
AgeCommit message (Collapse)Author
2017-11-26Fix code analysis warnings and typoSatoshi Tanda
This change fixes warnings seen with code analysis on VS2017 and typo. Also, excludes a .VC.db file.
2017-11-07Fix UEFI issues -- SimpleVisor now works on UEFI MP systems.Alex Ionescu
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.
2017-03-25Fix bug on unload when no hypervisor loaded. CPUID still returns valid data ↵Alex Ionescu
when leaf is invalid! To address this, return a magic value in RCX so we can be sure that RAX:RBX are trustworthy and contain VP_DATA.
2016-10-30Fix memory leak in ShvVpLoadCallbackSaar Amar
2016-10-27Fix memory leak in ShvVpLoadCallbackSaar Amar
2016-10-25Update shvvp.cSaar Amar
Fix memory leak in ShvVpLoadCallback. There is a flow (when ShvVpInitialize is failed) that the per-processor data is not freed before the goto Failure and return. Of-course, we can't free it in the Failure, since we need to distinguish between different flows of failures (fail to allocate, fail to initialize, hypervisor not present) So just keep freeing it anytime we fail for some reason (just as when our hypervisor is not present on line 275). Thanks :)
2016-09-03Last fixes. Now builds/works in UEFI with a shared code base.ionescu007
2016-09-03Support VMWARE/non-EPT sytems. More portability support with non-NT systems. ↵ionescu007
Refactoring. Reject NULL/LDT selectors when building VMCS. Support systems without 1GB HugePage EPT support (such as Vmware) by simply not enabling EPT for the. Refactor header files and some definitions again to support non-NT. Deallocation routines on some platform need to have a size. Refactor alloc and free so this is easy to maintain portably. Make ShvVmxLaunchOnVpreturn a status code instead of VOID, so we can actually know if launch failed instead of just relying on CPUID (which, if the hypervisor was already loaded, misidentified that a second load failed, and instead assumed success). Refactor the launch/off-on-failure code into a ShvVmxLaunch routine. Fix some comments to reflect the new portability layer/refactoring. Factor out OS-specific load/unload logic (ShvOsPrepareProcessor/ShvOsUnprepareProcessor) Fix ShvUtilConvertGdtEntry to reject selectors with the TI bit set, or NULL selectors, and correctly mark them as unusable.
2016-08-30More portability.ionescu007
Fix the last few stragglers.
2016-08-30Fix sign extension bug.ionescu007
2016-08-30A few more OS layer separations. Fix unload bug when SimpleVisor is not present.ionescu007
If SimpleVisor got unloaded, __cpuidex might not return valid data in EAX:EBX. Handle this case.
2016-08-29Move to what should be much more portable types. Fix straggler NT-specific APIs.ionescu007
SimpleVisor no longer builds with NT headers -- instead, ntint.h provides the necessary NT"isms" and compiler definitions. Create a bridge header (shv_x.h) between the OS layer and SimpleVisor layer. ShvOs.c builds with the NT Headers, and don't use ntint.h, importing only shv_x.h
2016-08-29Separate Hypervisor Core from OS Layer. Don't touch IRQL in Hypervisor. ↵ionescu007
Separate Load vs Unload callback. Misc. portability fixes. Create a layer of OS-specific functions to handle the various requirements around memory allocation, context save/restore, entrypoint/unloadpoint, and multi-CPU execution and topology information. SimpleVisor no longer uses NT-specific functions (some structures and types still remain). Additionally, the hypervisor should not know that "NT" is running underneath, so it has no business touching the IRQL. As we won't call Windows functions, and as interrupts are disabled, this doesn't 'change' anything and is correct. Don't use the same callback for load and unload. We can make unload its own callback now, as we've separated out the DPC-specific logic. This makes the load callback cleaner as well. Remove NT_ASSERTS which don't work anyway, and use portable definitions/types when possible (more to do here). Return the failed CPU and status in all cases during load. Sometimes this wasn't done before.
2016-08-29Remove debug printionescu007
2016-08-29When unloading the hypervisor on each core, returnt he VP Data structureionescu007
This allows us to now free the data for each processor, by returning its pointer through the CPUID interface.
2016-08-29Death to global data!ionescu007
Each routine knew exactly how to get its VP Data except the post-launch-guest-resumer. We now run it on the hypervisor stack (which shouldn't matter -- because it uses no stack variables other than the home space), which means it can essentially "containing record" its VP data based on it.
2016-08-29Uee nice define.ionescu007
2016-08-29Continue WIP VP data cleanup.ionescu007
We no longer need the VmxEnabled flag and confusing logic around it.
2016-08-29WIP Cleaner way to launch.ionescu007
2016-08-29Fix race condition and support >64 LP. Don't free data on unload.ionescu007
Freeing the data on unload seems to cause a hang. WIP investigation. The old way we OR'ed the InitMask was both prone to racing and causing incorrect failure codes, as well as was limited by 64 processors.
2016-08-29WIPionescu007
2016-08-29WIP Cleanup VP Dataionescu007
2016-08-29Use per-processor data. Track per-processor initialization state.ionescu007
Each processor now allocates its own node-local memory, instead of relying on a single global array on an arbitrary node. This should help performance on NUMA system. Additionally, each processor now checks its own VMX status, and reports back its unique VMX initialization, isntead of assuming all CPUs initialized or all failed. A mask is used to report which CPUs did not initialize, and a failure status can now be returned.
2016-08-28Get rid of global data -- all data is now per-processorionescu007
The MSR Bitmap and EPML4/EPDPTEs were allocated globally, with each LP's VMCS pointing to the same physical address. Make things simpler and more efficient (especially if we take advantage of NUMA) by giving each LP/VMCS its own MSR Bitmap and EPT structures. The intent here is not to de-synchronize this data, as we have no exits which would cause either of these structures to change and require synchronization.
2016-08-28Fix SimpleVisor to work on VMWare, stop using KeSaveStateForHibernate and ↵ionescu007
misc. cleanups SimpleVisor was previously using the presence of *ANY* hypervisor as a sign that it is already loaded. This breaks if the loaded hypervisor actually supports nesting and/or isn't SimpleVisor. As such, always try to enable SimpleVisor -- ShvVmxProbe will fail if we can't, and detect SimpleVisor explicitly using the Hyper-V Detection Interface (used by all hypervisors these days). Second, stop using KeSaveStateForHibernate. While it saved us the need for two more assembly instructions (str/sldt), it appears to have bugs around handling of DebugControl, on top of the other bugs we already had to work around. Instead, just use compiler instrincs to grab the required state, which is faster anyway. Move Intel VT-x specific structures into vmx.h instead of shv.h
2016-03-17Final round of cleanupsionescu007
2016-03-17First round of cleanupionescu007
Begin refactoring and commenting efforts.