Add method to get TableKind from VirtualAddress

This commit is contained in:
Jeremy Soller
2021-05-03 21:29:36 -06:00
parent 5e47692b8d
commit c81c4de223
+9
View File
@@ -69,6 +69,15 @@ impl VirtualAddress {
pub fn add(self, offset: usize) -> Self {
Self(self.0 + offset)
}
#[inline(always)]
pub fn kind(&self) -> TableKind {
if (self.0 as isize) < 0 {
TableKind::Kernel
} else {
TableKind::User
}
}
}
#[derive(Clone, Copy, Debug)]