diff --git a/src/driver/ept.cpp b/src/driver/ept.cpp index 5954257..fdd5c3d 100644 --- a/src/driver/ept.cpp +++ b/src/driver/ept.cpp @@ -596,19 +596,18 @@ namespace vmx const auto page_remaining = PAGE_SIZE - page_offset; const auto data_to_write = min(page_remaining, current_length); - ept_translation_hint current_hint{}; - - current_hint.virtual_base_address = aligned_destination; - current_hint.physical_base_address = memory::get_physical_address(aligned_destination); - - if (!current_hint.physical_base_address) + const auto physical_base_address = memory::get_physical_address(aligned_destination); + if (!physical_base_address) { throw std::runtime_error("Failed to resolve physical address"); } - memcpy(¤t_hint.page[0], aligned_destination, PAGE_SIZE); + auto& current_hint = hints.emplace_back(); - hints.push_back(current_hint); + current_hint.virtual_base_address = aligned_destination; + current_hint.physical_base_address = physical_base_address; + + memcpy(¤t_hint.page[0], aligned_destination, PAGE_SIZE); current_length -= data_to_write; current_destination += data_to_write; diff --git a/src/driver/irp.cpp b/src/driver/irp.cpp index 1227648..0c4571f 100644 --- a/src/driver/irp.cpp +++ b/src/driver/irp.cpp @@ -82,8 +82,8 @@ namespace } memcpy(buffer.get(), request.source_data, request.source_data_size); - auto translation_hints = generate_translation_hints(request.process_id, request.target_address, - request.source_data_size); + const auto translation_hints = generate_translation_hints(request.process_id, request.target_address, + request.source_data_size); if (translation_hints.empty()) { diff --git a/src/driver/list.hpp b/src/driver/list.hpp index 9f31b02..5f2573a 100644 --- a/src/driver/list.hpp +++ b/src/driver/list.hpp @@ -317,7 +317,7 @@ namespace utils return reinterpret_cast(ptr); } - void allocate_entry(void*& list_base, void* entry_base) + void allocate_entry(void*& list_base, void*& entry_base) { list_base = nullptr; entry_base = nullptr;