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

[Draft] Pagetable with no function overriding for adopting stable rust #349

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

zpzigi754
Copy link
Collaborator

@zpzigi754 zpzigi754 commented Jul 15, 2024

The purpose of this change is removing function overriding (specialization feature) in the page table implementation which prevents us from using a stable rust. Level trait bound in struct PageTable, which is the main place for function overriding, has been removed.

This PR is just for the reference; it is not aimed to be merged, because it is not the final form of page table I have in mind.

[before]

pub struct PageTable<A, L, E, const N: usize> {
     entries: [E; N],
     level: PhantomData<L>,
     address: PhantomData<A>,
}

[after]

pub struct PageTable<A, E, const N: usize> {
     entries: [E; N],
     address: PhantomData<A>,
 }

@zpzigi754 zpzigi754 force-pushed the pgtable-no-level-reference branch from a052623 to 391a3f7 Compare July 15, 2024 06:13
- Pass build errors with is_root
- Pass root level in macros

Signed-off-by: Changho Choi <[email protected]>
Signed-off-by: Changho Choi <[email protected]>
@zpzigi754 zpzigi754 force-pushed the pgtable-no-level-reference branch from 391a3f7 to 8cb70b8 Compare July 15, 2024 06:37
@zpzigi754 zpzigi754 changed the title Pagetable with no function overriding for adopting stable rust [Draft] Pagetable with no function overriding for adopting stable rust Jul 15, 2024
@zpzigi754 zpzigi754 force-pushed the pgtable-no-level-reference branch from fbcc7c7 to 15917e9 Compare July 15, 2024 07:13
@bokdeuk-jeong
Copy link
Collaborator

I fully understand your motivation. However, level managment seems to be more of PageTable's role rather than Entry's.
Could you come up with another approach?

@jinbpark
Copy link
Collaborator

Should we look at how other Rust-based OS projects deal with page table management, in the context of 1) using a minimal number of unsafe keyword, 2) using stable rust as much as possible? That might help to some extent. (Also, I'm curious about how other people do this stuff)

@bokdeuk-jeong
Copy link
Collaborator

bokdeuk-jeong commented Jul 16, 2024

Our code is inspired by https://os.phil-opp.com/page-tables/.
With the same motivation behind your question, the projects that I have investigated thus far had simpler configurations, which are different from ours, like with a fixed root level and a predetermined number of root pages.

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.

3 participants