mirror of
https://github.com/momo5502/hypervisor.git
synced 2025-04-19 13:42:55 +00:00
Fix bug
This commit is contained in:
parent
531305e104
commit
e379103e0f
@ -596,19 +596,18 @@ namespace vmx
|
|||||||
const auto page_remaining = PAGE_SIZE - page_offset;
|
const auto page_remaining = PAGE_SIZE - page_offset;
|
||||||
const auto data_to_write = min(page_remaining, current_length);
|
const auto data_to_write = min(page_remaining, current_length);
|
||||||
|
|
||||||
ept_translation_hint current_hint{};
|
const auto physical_base_address = memory::get_physical_address(aligned_destination);
|
||||||
|
if (!physical_base_address)
|
||||||
current_hint.virtual_base_address = aligned_destination;
|
|
||||||
current_hint.physical_base_address = memory::get_physical_address(aligned_destination);
|
|
||||||
|
|
||||||
if (!current_hint.physical_base_address)
|
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Failed to resolve physical 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_length -= data_to_write;
|
||||||
current_destination += data_to_write;
|
current_destination += data_to_write;
|
||||||
|
@ -82,7 +82,7 @@ namespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
memcpy(buffer.get(), request.source_data, request.source_data_size);
|
memcpy(buffer.get(), request.source_data, request.source_data_size);
|
||||||
auto translation_hints = generate_translation_hints(request.process_id, request.target_address,
|
const auto translation_hints = generate_translation_hints(request.process_id, request.target_address,
|
||||||
request.source_data_size);
|
request.source_data_size);
|
||||||
|
|
||||||
if (translation_hints.empty())
|
if (translation_hints.empty())
|
||||||
|
@ -317,7 +317,7 @@ namespace utils
|
|||||||
return reinterpret_cast<U*>(ptr);
|
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;
|
list_base = nullptr;
|
||||||
entry_base = nullptr;
|
entry_base = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user