Skip to content

Conversation

@babayet2
Copy link
Contributor

@babayet2 babayet2 commented Oct 2, 2025

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

@babayet2 babayet2 requested review from a team as code owners October 2, 2025 06:49
@chris-oo chris-oo self-assigned this Oct 2, 2025
@babayet2
Copy link
Contributor Author

babayet2 commented Oct 9, 2025

@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

Copy link
Member

@chris-oo chris-oo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getting closer

@babayet2
Copy link
Contributor Author

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

}

/// Build a set of X64 page tables identity mapping the given region. `size` must be less than 512GB.
/// Map all pages as read only
Copy link
Member

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?

Copy link
Contributor Author

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

/// linkage_gpa represents the GPA at which the linked PML4E should be linked.
pub fn build<'a>(
self,
page_table: &mut [PageTable],
Copy link
Member

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.

Copy link
Contributor Author

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

@github-actions
Copy link

@github-actions
Copy link

@github-actions
Copy link

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

Successfully merging this pull request may close these issues.

2 participants