diff --git a/HyperPlatform/HyperPlatform.ruleset b/HyperPlatform/HyperPlatform.ruleset
new file mode 100644
index 0000000..886101a
--- /dev/null
+++ b/HyperPlatform/HyperPlatform.ruleset
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/HyperPlatform/HyperPlatform.vcxproj b/HyperPlatform/HyperPlatform.vcxproj
index 39dd5cf..ef3c2cd 100644
--- a/HyperPlatform/HyperPlatform.vcxproj
+++ b/HyperPlatform/HyperPlatform.vcxproj
@@ -71,28 +71,29 @@
DbgengKernelDebugger
true
- AllRules.ruleset
+ HyperPlatform.ruleset
DbgengKernelDebugger
true
- AllRules.ruleset
+ HyperPlatform.ruleset
DbgengKernelDebugger
true
- AllRules.ruleset
+ HyperPlatform.ruleset
DbgengKernelDebugger
true
- AllRules.ruleset
+ HyperPlatform.ruleset
true
trace.h
true
+ false
@@ -109,6 +110,7 @@
true
trace.h
true
+ false
@@ -168,6 +170,9 @@
+
+
+
diff --git a/HyperPlatform/HyperPlatform.vcxproj.filters b/HyperPlatform/HyperPlatform.vcxproj.filters
index eff6a01..5de06e2 100644
--- a/HyperPlatform/HyperPlatform.vcxproj.filters
+++ b/HyperPlatform/HyperPlatform.vcxproj.filters
@@ -113,4 +113,7 @@
Source Files
+
+
+
\ No newline at end of file
diff --git a/HyperPlatform/ept.cpp b/HyperPlatform/ept.cpp
index 4328b3d..a6e857a 100644
--- a/HyperPlatform/ept.cpp
+++ b/HyperPlatform/ept.cpp
@@ -54,9 +54,11 @@ static const auto kEptpNumberOfPreallocatedEntries = 50;
// Architecture defined number of variable range MTRRs
static const auto kEptpNumOfMaxVariableRangeMtrrs = 255;
-// Architecture defined number of fixed range MTRRs (1 for 64k, 2 for 16k, 8
-// for 4k)
-static const auto kEptpNumOfFixedRangeMtrrs = 1 + 2 + 8;
+// Architecture defined number of fixed range MTRRs. 1 register for 64k, 2
+// registers for 16k, 8 registers for 4k, and each register has 8 ranges as per
+// "Fixed Range MTRRs" states.
+static const auto kEptpNumOfFixedRangeMtrrs =
+ (1 + 2 + 8) * RTL_NUMBER_OF_FIELD(Ia32MtrrFixedRangeMsr, fields.types);
// A size of array to store all possible MTRRs
static const auto kEptpMtrrEntriesSize =
@@ -105,11 +107,10 @@ _When_(ept_data == nullptr,
static void EptpDestructTables(_In_ EptCommonEntry *table,
_In_ ULONG table_level);
-_Must_inspect_result_
- _When_(ept_data == nullptr,
- __drv_allocatesMem(Mem)
- _IRQL_requires_max_(DISPATCH_LEVEL)) static EptCommonEntry
- *EptpAllocateEptEntry(_In_opt_ EptData *ept_data);
+_Must_inspect_result_ _When_(ept_data == nullptr,
+ __drv_allocatesMem(Mem) _IRQL_requires_max_(
+ DISPATCH_LEVEL)) static EptCommonEntry
+ *EptpAllocateEptEntry(_In_opt_ EptData *ept_data);
static EptCommonEntry *EptpAllocateEptEntryFromPreAllocated(
_In_ EptData *ept_data);
@@ -203,7 +204,8 @@ _Use_decl_annotations_ void EptInitializeMtrrEntries() {
Ia32MtrrCapabilitiesMsr mtrr_capabilities = {
UtilReadMsr64(Msr::kIa32MtrrCap)};
HYPERPLATFORM_LOG_DEBUG(
- "MTRR Default=%llu, VariableCount=%llu, FixedSupported=%llu, FixedEnabled=%llu",
+ "MTRR Default=%llu, VariableCount=%llu, FixedSupported=%llu, "
+ "FixedEnabled=%llu",
default_type.fields.default_mtemory_type,
mtrr_capabilities.fields.variable_range_count,
mtrr_capabilities.fields.fixed_range_supported,
diff --git a/HyperPlatform/perf_counter.h b/HyperPlatform/perf_counter.h
index 1cbd581..66e399c 100644
--- a/HyperPlatform/perf_counter.h
+++ b/HyperPlatform/perf_counter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2015-2017, Satoshi Tanda. All rights reserved.
+// Copyright (c) 2015-2018, Satoshi Tanda. All rights reserved.
// Use of this source code is governed by a MIT-style license that can be
// found in the LICENSE file.
@@ -247,7 +247,7 @@ class PerfCollector {
/// room to add a new entry.
ULONG GetPerfDataIndex(_In_ const char* key) {
if (!key) {
- return false;
+ return kInvalidDataIndex;
}
for (auto i = 0ul; i < kMaxNumberOfDataEntries; i++) {
diff --git a/HyperPlatform/vm.cpp b/HyperPlatform/vm.cpp
index b6dae53..df25fd2 100644
--- a/HyperPlatform/vm.cpp
+++ b/HyperPlatform/vm.cpp
@@ -802,8 +802,8 @@ _Use_decl_annotations_ static ULONG VmpGetSegmentAccessRight(
PAGED_CODE();
VmxRegmentDescriptorAccessRight access_right = {};
- const SegmentSelector ss = {segment_selector};
if (segment_selector) {
+ const SegmentSelector ss = {segment_selector};
auto native_access_right = AsmLoadAccessRightsByte(ss.all);
native_access_right >>= 8;
access_right.all = static_cast(native_access_right);
diff --git a/HyperPlatform/vmm.cpp b/HyperPlatform/vmm.cpp
index 6a8f1cd..54eb5a9 100644
--- a/HyperPlatform/vmm.cpp
+++ b/HyperPlatform/vmm.cpp
@@ -26,7 +26,7 @@ extern "C" {
//
// Whether VM-exit recording is enabled
-static const long kVmmpEnableRecordVmExit = false;
+static const bool kVmmpEnableRecordVmExit = false;
// How many events should be recorded per a processor
static const long kVmmpNumberOfRecords = 100;
@@ -968,7 +968,7 @@ _Use_decl_annotations_ static void VmmpHandleCrAccess(
// The MOV to CR3 does not modify the bit63 of CR3. Emulate this
// behavior.
- // See: MOV—Move to/from Control Registers
+ // See: MOV - Move to/from Control Registers
UtilVmWrite(VmcsField::kGuestCr3, (*register_used & ~(1ULL << 63)));
break;
}