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

MapToError should give back the UnusedPhysFrame on PageAlreadyMapped #117

Closed
haraldh opened this issue Jan 22, 2020 · 1 comment · Fixed by #118
Closed

MapToError should give back the UnusedPhysFrame on PageAlreadyMapped #117

haraldh opened this issue Jan 22, 2020 · 1 comment · Fixed by #118

Comments

@haraldh
Copy link
Contributor

haraldh commented Jan 22, 2020

pub enum MapToError {
/// An additional frame was needed for the mapping process, but the frame allocator
/// returned `None`.
FrameAllocationFailed,
/// An upper level page table entry has the `HUGE_PAGE` flag set, which means that the
/// given page is part of an already mapped huge page.
ParentEntryHugePage,
/// The given page is already mapped to a physical frame.
PageAlreadyMapped,
}

should probably be

pub enum MapToError<S: PageSize> {
    /// An additional frame was needed for the mapping process, but the frame allocator
    /// returned `None`.
    FrameAllocationFailed,
    /// An upper level page table entry has the `HUGE_PAGE` flag set, which means that the
    /// given page is part of an already mapped huge page.
    ParentEntryHugePage,
    /// The given page is already mapped to a physical frame.
    PageAlreadyMapped(UnusedPhysFrame<S>),
}

and methods returning PageAlreadyMapped should give back the frame.

@phil-opp
Copy link
Member

Good idea! I would be happy to merge a PR for this.

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

Successfully merging a pull request may close this issue.

2 participants