This commit is contained in:
Maurice Heumann 2022-12-24 09:28:47 +01:00
parent 531305e104
commit e379103e0f
3 changed files with 10 additions and 11 deletions

View File

@ -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(&current_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(&current_hint.page[0], aligned_destination, PAGE_SIZE);
current_length -= data_to_write;
current_destination += data_to_write;

View File

@ -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())
{

View File

@ -317,7 +317,7 @@ namespace utils
return reinterpret_cast<U*>(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;