1 from gdb import Type, Value, lookup_type
2 from . import KernelStruct
4 class PageStruct(KernelStruct):
5 def __init__(self, gdb_inferior: Value) -> None:
6 super().__init__(gdb_inferior, PageStruct)
7 self.ref = self._kstruct["refs"]
8 self.type = self._kstruct["type"]
9 self.flags = self._kstruct["flags"]
10 self.order = self._kstruct["order"]
11 self.pool = self._kstruct["pool"]
12 self.companion = self._kstruct["companion"]
14 def uninitialized(self):
15 return not (self.flags & 0b10)
18 return (not self.uninitialized()
19 and self.type == 0b1000
20 and self.ref == 0xf0f0f0f0)
23 return (not self.uninitialized()
24 and self.type != 0b1000
28 return self.companion == 0 and not self.uninitialized()
31 def get_type() -> Type:
32 return lookup_type("struct ppage").pointer()