1 #ifndef _KERN_PAGETABLE_H
2 #define _KERN_PAGETABLE_H
12 const bool is_process;
14 typedef Mem::PTEFlags Flags;
15 typedef System::Mem::Region Region;
16 typedef System::Mem::RegionWithOffset RegionWithOffset;
18 PageTable(bool process) : is_process(process)
26 // Region is virtual, offset is physical
27 virtual void map(RegionWithOffset region, Flags flags) = 0;
28 virtual void unmap(Region region) = 0;
30 // Sets the flags which are set in mask to their value in flags.
31 // Flags not set in mask are untouched.
33 virtual void set_flags(Region region, Flags flags, Flags mask) = 0;
35 // Returns the physical address and flags associated with a given
36 // virtual address. If flags.Valid is not set, then phys and all
37 // other flags are undefined. This function is mainly used for
38 // propagating stacked aspace PTEs.
40 virtual void get_mapping(u64 vaddr, u64 *phys, Flags *flags) = 0;
42 virtual void get_size(u64 *size) = 0;
44 // This is called when a PTE is replaced. It handles refcounting,
45 // dirty page queueing, and TLB invalidation. vaddr is only
46 // valid for process address spaces, so it doesn't need to be
47 // 64-bit (except on 64-bit hardware, of course). When it is
48 // known that only flags are changing, set no_release so that
49 // the page refcount is not decremented.
51 void kill_pte(ulong vaddr, u64 physaddr, bool dirty, bool valid,
52 bool no_release = false);