Skip to content

Commit

Permalink
cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wbenny committed Oct 31, 2019
1 parent 58f9f6f commit e2e25b5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
5 changes: 1 addition & 4 deletions src/hvpp/hvpp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,7 @@
<ClCompile Include="hvpp\lib\mm\win32\paging_descriptor.cpp" />
<ClCompile Include="hvpp\lib\mm\win32\physical_memory_descriptor.cpp" />
<ClCompile Include="hvpp\vcpu.cpp" />
<ClCompile Include="hvpp\vmexit.cpp">
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)/$(RelativeDir)/%(Filename)%(Extension).obj</ObjectFileName>
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)/$(RelativeDir)/%(Filename)%(Extension).obj</ObjectFileName>
</ClCompile>
<ClCompile Include="hvpp\vmexit.cpp" />
<ClCompile Include="hvpp\vmexit\vmexit_c_wrapper.cpp" />
<ClCompile Include="hvpp\vmexit\vmexit_dbgbreak.cpp" />
<ClCompile Include="hvpp\vmexit\vmexit_passthrough.cpp" />
Expand Down
6 changes: 3 additions & 3 deletions src/hvpp/hvpp/hvpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ typedef PVOID PVCPU;
typedef PVOID PEPT;

//////////////////////////////////////////////////////////////////////////
// VM-exit pass-trough handler.
// VM-exit pass-through handler.
//////////////////////////////////////////////////////////////////////////

typedef VOID (NTAPI* PVMEXIT_PASSTROUGH_ROUTINE)(
Expand All @@ -833,13 +833,13 @@ typedef VOID (NTAPI* PVMEXIT_PASSTROUGH_ROUTINE)(

typedef struct _VMEXIT_PASSTHROUGH
{
PVMEXIT_PASSTROUGH_ROUTINE PasstroughRoutine;
PVMEXIT_PASSTROUGH_ROUTINE PassthroughRoutine;
PVOID Context;
// UCHAR Data[1];
} VMEXIT_PASSTHROUGH, *PVMEXIT_PASSTHROUGH;

#define HvppVmExitPassthrough(Passthrough) \
(((PVMEXIT_PASSTHROUGH)(Passthrough))->PasstroughRoutine(Passthrough));
(((PVMEXIT_PASSTHROUGH)(Passthrough))->PassthroughRoutine(Passthrough));

#define HvppVmContext(Passthrough) \
((PVMEXIT_PASSTHROUGH)(Passthrough)->Context)
Expand Down
6 changes: 5 additions & 1 deletion src/hvpp/hvpp/lib/assert.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#pragma once
#include "debugger.h"

#define hvpp_assert(expression) \
#if 1
# define hvpp_assert(expression) \
do \
{ \
if (!(expression)) { \
debugger::breakpoint(); \
} \
} while (0)
#else
# define hvpp_assert(expression)
#endif
7 changes: 4 additions & 3 deletions src/hvpp/hvpp/vcpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ vcpu_t::vcpu_t(vmexit_handler& handler) noexcept
//
// Fill out initial stack with garbage.
//
memset(stack_.data, 0xcc, sizeof(stack_));
memset(&stack_.data, 0xcc, sizeof(stack_));

//
// Reset CPU contexts.
Expand All @@ -90,6 +90,7 @@ vcpu_t::vcpu_t(vmexit_handler& handler) noexcept
constexpr intptr_t VCPU_CONTEXT_OFFSET = 0; // ..
constexpr intptr_t VCPU_LAUNCH_CONTEXT_OFFSET = 0; // ... connected by union {}
//

static_assert(VCPU_RSP + VCPU_OFFSET == offsetof(vcpu_t, stack_));
static_assert(VCPU_RSP + VCPU_CONTEXT_OFFSET == offsetof(vcpu_t, context_));
static_assert(VCPU_RSP + VCPU_LAUNCH_CONTEXT_OFFSET == offsetof(vcpu_t, launch_context_));
Expand Down Expand Up @@ -443,12 +444,12 @@ auto vcpu_t::guest_va_to_pa(va_t guest_va) noexcept -> pa_t
return translator_.va_to_pa(guest_va, ::detail::kernel_cr3(guest_cr3()));
}

auto vcpu_t::guest_read_memory(va_t guest_va, void* buffer, size_t size, bool ignore_errors /* = false*/) noexcept -> va_t
auto vcpu_t::guest_read_memory(va_t guest_va, void* buffer, size_t size, bool ignore_errors /* = false */) noexcept -> va_t
{
return translator_.read(guest_va, ::detail::kernel_cr3(guest_cr3()), buffer, size, ignore_errors);
}

auto vcpu_t::guest_write_memory(va_t guest_va, const void* buffer, size_t size, bool ignore_errors /* = false*/) noexcept -> va_t
auto vcpu_t::guest_write_memory(va_t guest_va, const void* buffer, size_t size, bool ignore_errors /* = false */) noexcept -> va_t
{
return translator_.write(guest_va, ::detail::kernel_cr3(guest_cr3()), buffer, size, ignore_errors);
}
Expand Down
2 changes: 1 addition & 1 deletion src/hvpp/hvpp/vmexit/vmexit_c_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void vmexit_c_wrapper_handler::handle_passthrough(passthrough_context* context)
{
//
// Fetch the handler instance, method and vcpu_t reference
// from the pass-trough context and call that method.
// from the pass-through context and call that method.
//

const auto handler_instance = context->handler_instance;
Expand Down

0 comments on commit e2e25b5

Please sign in to comment.