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

How to create an instance of MapperFlush? #295

Closed
toku-sa-n opened this issue Aug 15, 2021 · 3 comments · Fixed by #296
Closed

How to create an instance of MapperFlush? #295

toku-sa-n opened this issue Aug 15, 2021 · 3 comments · Fixed by #296

Comments

@toku-sa-n
Copy link
Member

I was trying to implement Mapper for my process struct and noticed that MapperFlush::new is a private method. Is there a way to create an instance of it?

toku-sa-n added a commit to toku-sa-n/x86_64 that referenced this issue Aug 15, 2021
It looks like there is no way to create an instance of these types.

Fixes: rust-osdev#295
@josephlr
Copy link
Contributor

From the MapperFlushAll docs:

This type is returned from a function that made the change to ensure that the TLB flush is not forgotten.

Basically, you are not supposed to be able to create this type. It is returned from functions like: Mapper::set_flags_p4_entry forcing the user to explicitly do something with the MapperFlush object.

See this example for how the type is used.

@toku-sa-n
Copy link
Member Author

Then, is it not supposed to implement Mapper manually? Implementing it needs to create an instance of MapperFlush and MapperFlushAll.

@josephlr
Copy link
Contributor

@toku-sa-n whoops my bad, I misread your initial comment. Yes I believe external implementations of mapper should be supported, so we do need to add the constructors for this to be possible.

Good catch.

toku-sa-n added a commit to toku-sa-n/x86_64 that referenced this issue Aug 29, 2021
It looks like there is no way to create an instance of these types.

Fixes: rust-osdev#295
toku-sa-n added a commit to toku-sa-n/x86_64 that referenced this issue Aug 29, 2021
It looks like there is no way to create an instance of these types.

Fixes: rust-osdev#295
toku-sa-n added a commit to toku-sa-n/x86_64 that referenced this issue Aug 29, 2021
It looks like there is no way to create an instance of these types.

Fixes: rust-osdev#295
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 a pull request may close this issue.

2 participants