diff --git a/src/scheme/memory.rs b/src/scheme/memory.rs index 0cd3553348f1b95be65009cd0db78ae6b9a23b69..07d30a5a9f8742fbd0ecf078cdffeb56c479e60e 100644 --- a/src/scheme/memory.rs +++ b/src/scheme/memory.rs @@ -178,6 +178,14 @@ impl Scheme for MemoryScheme { fn funmap3(&self, flags: usize, address: usize, size: usize) -> Result<usize> { let flags = u8::try_from(flags).ok().and_then(Flags::from_bits).expect("MemoryScheme::funmap3: bits contained bad flags"); + // OH NO!! The `funmap` system call will unmap the grant by default, but + // we haven't necessarily created a grant with fmap, we may very well + // just have given the pointer of a physical region! + // + // This will fail!! Is this "abuse" of fmap bad? Do we keep the phys* + // functions instead? If no, how do we fix this? Do we make each kernel + // scheme responsible for clearing up the grants themselves? + if flags.contains(Flags::MODE_PHYSICAL) { driver::inner_physfree(address, size) } else if flags.contains(Flags::MODE_PHYSMAP) {