-
Notifications
You must be signed in to change notification settings - Fork 157
loader: update the page table builder to be no_std #2062
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
base: main
Are you sure you want to change the base?
Conversation
|
@chris-oo pushed a new version without the big trait and generics, where we just allocate space up front LMK if it's looking good in principle, let me know, it will need to be fixed up for ARM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getting closer
|
hey Chris could you kick off a CI run for me? I recall there are build issues on arm, but I'm not seeing them when I build for aarch64 locally |
572441d to
d6b2c23
Compare
vm/loader/page_table/src/x64.rs
Outdated
| } | ||
|
|
||
| /// Build a set of X64 page tables identity mapping the given region. `size` must be less than 512GB. | ||
| /// Map all pages as read only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit period at end of sentance. Does this also map them all as executable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah pages are always mapped as executable, toggling the write bit doesn't change that
should NX be togglable? there is no use case as of right now
vm/loader/page_table/src/x64.rs
Outdated
| /// linkage_gpa represents the GPA at which the linked PML4E should be linked. | ||
| pub fn build<'a>( | ||
| self, | ||
| page_table: &mut [PageTable], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually a build fn doesn't take any arguments other than self, in this case I would probably prefer we move the buffers to the base new call, since we can check and enforce the size there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
doing this required restructuring the PageTableBuilder struct, otherwise we were going to have issues with the borrow checker
d6b2c23 to
7b1445e
Compare
Discussed w/ @chris-oo, this PR updates the page table builder in the loader to be no_std, and to accept a generic buffer for its working memory
The goal is to prepare the library to be used within the openhcl_boot shim, which is a no_std environment. The generic buffer change allows the loader code to continue using a vectors for its working memory, whereas the boot shim will be providing its working buffer as ArrayVec stashed in the global section