Skip to content

Commit

Permalink
SVSM/mm/pagetable: Implement Drop trait
Browse files Browse the repository at this point in the history
This makes page-tables allocatable on the heap.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
joergroedel committed Aug 25, 2023
1 parent 1ffedca commit a3a5614
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mm/pagetable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ pub struct PageTable {
root: PTPage,
}

impl Drop for PageTable {
fn drop(&mut self) {
self.free();
}
}

impl PageTable {
pub fn load(&self) {
write_cr3(self.cr3_value());
Expand Down

0 comments on commit a3a5614

Please sign in to comment.