Skip to main content

pt_clone_level

Function pt_clone_level 

Source
pub unsafe fn pt_clone_level(
    pt_src: *mut Pagetable,
    pt_new: *mut Pagetable,
    lv: usize,
)
Expand description

THIS ONLY WORKS FOR 4K PAGES! Must not use this on kernel mappings, which use huge pages. on lv==1, it’s a “page” not a pagetable, hence do memcpy.

TODO: just because there is page mapping doesn’t mean you need to copy all the pages. Smarter: 1) COW, 2) copy by VMAs after rather than by raw pages.