feat(kernel): implement generation-based capability revocation with proofs and tests
This commit is contained in:
@@ -58,6 +58,10 @@ impl MemoryRegion {
|
||||
pub fn generation(&self) -> &Generation {
|
||||
&self.generation
|
||||
}
|
||||
|
||||
pub fn revoke(&mut self) {
|
||||
self.generation = self.generation.next();
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RegionTable {
|
||||
@@ -82,6 +86,10 @@ impl RegionTable {
|
||||
self.regions.get(id.raw() as usize).and_then(|s| s.as_ref())
|
||||
}
|
||||
|
||||
pub fn get_mut(&mut self, id: RegionId) -> Option<&mut MemoryRegion> {
|
||||
self.regions.get_mut(id.raw() as usize).and_then(|s| s.as_mut())
|
||||
}
|
||||
|
||||
pub fn remove(&mut self, id: RegionId) -> Option<MemoryRegion> {
|
||||
self.regions.get_mut(id.raw() as usize).and_then(|s| s.take())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user