Formatting

This commit is contained in:
momo5502 2022-04-11 20:57:22 +02:00
parent 6f440c9c56
commit c7e29af2b5

View File

@ -250,12 +250,14 @@ void initialize_mtrr(vmx::launch_context& launch_context)
} }
} }
uint32_t mtrr_adjust_effective_memory_type( vmx::launch_context& launch_context, const uint64_t large_page_address, uint32_t candidate_memory_type) uint32_t mtrr_adjust_effective_memory_type(vmx::launch_context& launch_context, const uint64_t large_page_address,
uint32_t candidate_memory_type)
{ {
// //
// Loop each MTRR range // Loop each MTRR range
// //
for (const auto& mtrr_entry : launch_context.mtrr_data) { for (const auto& mtrr_entry : launch_context.mtrr_data)
{
// //
// Check if it's active // Check if it's active
// //
@ -331,9 +333,8 @@ void initialize_ept(vmx::state& vm_state)
for (auto j = 0; j < EPT_PDE_ENTRY_COUNT; j++) for (auto j = 0; j < EPT_PDE_ENTRY_COUNT; j++)
{ {
vm_state.epde[i][j].page_frame_number = (i * 512) + j; vm_state.epde[i][j].page_frame_number = (i * 512) + j;
vm_state.epde[i][j].memory_type = mtrr_adjust_effective_memory_type(vm_state.launch_context, vm_state.epde[i][j].memory_type = mtrr_adjust_effective_memory_type(
vm_state.epde[i][j].page_frame_number * _2MB, vm_state.launch_context, vm_state.epde[i][j].page_frame_number * _2MB, MEMORY_TYPE_WRITE_BACK);
MEMORY_TYPE_WRITE_BACK);
} }
} }
} }
@ -478,7 +479,8 @@ vmx::gdt_entry convert_gdt_entry(const uint64_t gdt_base, const uint16_t selecto
// //
// Read the GDT entry at the given selector, masking out the RPL bits. // Read the GDT entry at the given selector, masking out the RPL bits.
// //
const auto* gdt_entry = reinterpret_cast<segment_descriptor_64*>(gdt_base + static_cast<uint64_t>(selector.index) * 8); const auto* gdt_entry = reinterpret_cast<segment_descriptor_64*>(gdt_base + static_cast<uint64_t>(selector.index) *
8);
// //
// Write the selector directly // Write the selector directly
@ -582,7 +584,8 @@ void vmx_handle_cpuid(vmx::guest_context& guest_context)
// Otherwise, issue the CPUID to the logical processor based on the indexes // Otherwise, issue the CPUID to the logical processor based on the indexes
// on the VP's GPRs. // on the VP's GPRs.
// //
__cpuidex(cpu_info, static_cast<int32_t>(guest_context.vp_regs->Rax), static_cast<int32_t>(guest_context.vp_regs->Rcx)); __cpuidex(cpu_info, static_cast<int32_t>(guest_context.vp_regs->Rax),
static_cast<int32_t>(guest_context.vp_regs->Rcx));
// //
// Check if this was CPUID 1h, which is the features request. // Check if this was CPUID 1h, which is the features request.