Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate a virtual address #31

Open
Wenzel opened this issue Nov 19, 2019 · 2 comments
Open

Translate a virtual address #31

Wenzel opened this issue Nov 19, 2019 · 2 comments

Comments

@Wenzel
Copy link
Owner

Wenzel commented Nov 19, 2019

Another goal is to translate a virtual address to a physical address.

This implies parsing the page tables.
Now either the hypervisor supports this already and can offer us an API, or we have to implement this ourselves.

Check from existing crates like x86_64 from rust-osdev if they can share page tables structures definition, and even the translation functions.

@Wenzel Wenzel changed the title read from a virtual address Translate a virtual addresss Nov 19, 2019
@Wenzel Wenzel changed the title Translate a virtual addresss Translate a virtual address Nov 19, 2019
@Wenzel
Copy link
Owner Author

Wenzel commented Dec 27, 2019

Documentation:

Also, it looks like this feature has already been implemented in kvmi-semantic crate:
https://github.com/kylerky/kvmi-rs/blob/master/kvmi-semantic/src/memory/address_space.rs#L210

cc @kylerky can you tell us more about the state virtual address translation in kvmi-semantic ?

@kylerky
Copy link

kylerky commented Dec 27, 2019

Currently, it supports translation for Intel CPUs operating in IA32e mode (or 64-bit mode). 32-bit mode and others are not supported. In theory, it can do translation for all of the valid mappings, i.e, 4K, 2M and 1G mappings. However, I only have a unit test for the 2M case.

By the way, it assumes that the page entry it get is valid as dictated by the Intel manual (Reserved bits are 0s and so on).

Reference: Intel Developer Manuals, Volume 3, 4.5 4-Level Paging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants