Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Refactor pa_from_va to handle guest to host address translation #35

Merged
merged 2 commits into from
Jul 31, 2024
Merged

Conversation

memN0ps
Copy link
Owner

@memN0ps memN0ps commented Jul 31, 2024

This commit refactors the pa_from_va function to improve clarity and ensure proper handling of guest to host address translation using EPT (Extended Page Table). The function would crash if translate_guest_pa_to_host_pa is used due to pre-allocated page tables in the hook_manager that are not passed to this function (not required regardless due to 1:1 mapping).

Changes:

  • Translate guest virtual address (VA) to guest physical address (PA) using guest's CR3.
  • Translate guest PA to host PA using EPT, even in a 1:1 mapping scenario, for demonstration purposes and to accommodate potential future changes to Paging/EPT.
  • Add detailed comments explaining potential issues and the reasoning behind the translation steps.

This function is used in many places across the hypervisor for reading guest memory.

- This translation is not required in a 1:1 mapping but is done for demonstration purposes and in case changes are made to the Paging/EPT.
@memN0ps memN0ps merged commit 58c5fb6 into main Jul 31, 2024
1 check passed
@memN0ps memN0ps deleted the dev branch August 1, 2024 00:59
@memN0ps memN0ps restored the dev branch August 4, 2024 01:23
@memN0ps memN0ps deleted the dev branch August 4, 2024 01:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant