using System; namespace VMdemo.Simulation { [Serializable] public readonly struct PageTableEntry { public PageTableEntry(ulong pfn, bool present, bool dirty = false) { Pfn = pfn; Present = present; Dirty = dirty; } public ulong Pfn { get; } public bool Present { get; } public bool Dirty { get; } public static PageTableEntry NotPresent => new PageTableEntry(0UL, false, false); public PageTableEntry MarkPresent(ulong pfn, bool dirty = false) { return new PageTableEntry(pfn, true, dirty); } public PageTableEntry MarkNotPresent() { return new PageTableEntry(Pfn, false, Dirty); } public override string ToString() { return $"PFN={Pfn}, Present={Present}, Dirty={Dirty}"; } } }