wbenny / hvpp

hvpp is a lightweight Intel x64/VT-x hypervisor written in C++ focused primarily on virtualization of already running operating system
MIT License
1.12k stars 221 forks source link

What version of SDK and WDK was used for compilation? #46

Open ryuj-h opened 3 years ago

ryuj-h commented 3 years ago

VS2017 SDK -10.0.17763.0 WDK - Windows 10, version 1809

Compile- tons of error

Can anyone tell me the development environment?

warchiefmarkus commented 3 years ago

I use VS 2019 (latest updates), WDK - Win10 (latest), have 4 errors (with non initialized members in constexpr) and missed types (const unsigned short [18]" в "PWCH"). I disable warning levels and set C++ standart to latest possible ( 17+). So Im also interested in build details and builded release in repository please.

warchiefmarkus commented 3 years ago

I built it , but need look aon project from home to remember :) i found some snippet for constexpr replace , its visual studio 2019 last version problem related with constexpr.

b1tg commented 3 years ago

@warchiefmarkus, the constexpr issue was fixed in Visual Studio 2019 version 16.10.0 . How did you solved the missed types (const unsigned short [18]" в "PWCH") issue?

warchiefmarkus commented 3 years ago

@warchiefmarkus, the constexpr issue was fixed in Visual Studio 2019 version 16.10.0 . How did you solved the missed types (const unsigned short [18]" в "PWCH") issue?

Just casting

b1tg commented 3 years ago

@warchiefmarkus, the constexpr issue was fixed in Visual Studio 2019 version 16.10.0 . How did you solved the missed types (const unsigned short [18]" в "PWCH") issue?

Just casting

thanks :)

ansnapx commented 3 years ago
  1. VS2017 with Win8.1 SDK and WinSDK 10.0.17763.0
  2. WDK 10.0.17763.1
  3. /WX-

If you get some error in vmexit_c_wrapper.cpp and the vmexit_passthrough.cpp. please modify it as follow:

  1. vmexit_passthrough.cpp static const uint8_t skip_prefixes(const uint8_t first, const uint8_t* last) noexcept { // // Return the first byte of the opcode that is not a prefix. // return std::find_if(first, last, [&](uint8_t byte){
    // // List of prefix types that should be skipped, LOCK is not included as it'd #UD. // static constexpr uint8_t skip_table[] = { 0xF2, 0xF3, 0x2E, 0x36, 0x3E, 0x26, 0x64, 0x65, 0x2E, 0x3E, 0x66, 0x67 }; return std::find(std::begin(skip_table), std::end(skip_table), byte) == std::end(skip_table); }); // TODO add the ); }

  2. vmexit_c_wrapper.cpp auto vmexit_c_wrapper_handler::setup(vcpu_t& vp) noexcept -> error_code_t { if (setupcallback) { // // C-handler has been defined - call that routine. //

    //auto context = passthrough_context{ // .passthrough_routine = passthrough_fn_t(&vmexit_c_wrapper_handler::handle_passthroughsetup), // .context = context, // .handler_instance = this, // .handler_method = nullptr, // .vcpu = &vp, //};

    passthrough_context context; context.passthrough_routine = passthrough_fn_t(&vmexit_c_wrapper_handler::handle_passthroughsetup); context.context = context; context.handler_instance = this; context.handler_method = nullptr; context.vcpu = &vp;

    return (error_code_t)setupcallback(&vp, &context); } else { // // C-handler has not been defined - call the pass-through handler. //

    return base_type::setup(vp); } }

void vmexit_c_wrapper_handler::teardown(vcpu_t& vp) noexcept { if (teardowncallback) { // // C-handler has been defined - call that routine. //

//auto context = passthrough_context{
//  .passthrough_routine = passthrough_fn_t(&vmexit_c_wrapper_handler::handle_passthrough_teardown),
//  .context             = context_,
//  .handler_instance    = this,
//  .handler_method      = nullptr,
//  .vcpu                = &vp,
//};

passthrough_context context;
context.passthrough_routine = passthrough_fn_t(&vmexit_c_wrapper_handler::handle_passthrough_teardown);
context.context = context_;
context.handler_instance = this;
context.handler_method = nullptr;
context.vcpu = &vp;

teardown_callback_(&vp, &context);

} else { // // C-handler has not been defined - call the pass-through handler. //

base_type::teardown(vp);

} }

void vmexit_c_wrapper_handler::terminate(vcpu_t& vp) noexcept { if (terminatecallback) { // // C-handler has been defined - call that routine. //

//auto context = passthrough_context{
//  .passthrough_routine = passthrough_fn_t(&vmexit_c_wrapper_handler::handle_passthrough_terminate),
//  .context             = context_,
//  .handler_instance    = this,
//  .handler_method      = nullptr,
//  .vcpu                = &vp,
//};

passthrough_context context;
context.passthrough_routine = passthrough_fn_t(&vmexit_c_wrapper_handler::handle_passthrough_terminate);
context.context = context_;
context.handler_instance = this;
context.handler_method = nullptr;
context.vcpu = &vp;

terminate_callback_(&vp, &context);

} else { // // C-handler has not been defined - call the pass-through handler. //

base_type::terminate(vp);

} }

void vmexit_c_wrapper_handler::handle(vcpu_t& vp) noexcept { const auto exit_reason = vp.exit_reason(); const auto exit_reason_index = static_cast(exit_reason);

const auto cpphandler = handlers[exit_reason_index]; const auto c_handler = chandlers[exit_reason_index];

if (c_handler) { // // C-handler has been defined - call that routine. //

//auto context = passthrough_context{
//  .passthrough_routine = passthrough_fn_t(&vmexit_c_wrapper_handler::handle_passthrough_handler),
//  .context             = context_,
//  .handler_instance    = this,
//  .handler_method      = cpp_handler,
//  .vcpu                = &vp,
//};

passthrough_context context;
context.passthrough_routine = passthrough_fn_t(&vmexit_c_wrapper_handler::handle_passthrough_handler);
context.context = context_;
context.handler_instance = this;
context.handler_method = nullptr;
context.vcpu = &vp;

c_handler(&vp, &context);

} else { // // C-handler has not been defined - call the pass-through handler. //

(this->*cpp_handler)(vp);

} }

noW , YOU can build it success.

warchiefmarkus commented 3 years ago

As far as I know, in a recent release, Visual Studio has fixed the constexpr issue

manurautela commented 3 years ago

3. /WX-

@ansnapx Instead of /WX- using /IGNORE:warning[,warning] would be better option. Mentioned in issue #45 . This would disable specific linker warning instead of all.

https://docs.microsoft.com/en-us/cpp/build/reference/ignore-ignore-specific-warnings?view=msvc-160

@warchiefmarkus On 16.10.4 at least the issue is still present.