public static unsafe void SetExecutable(this IPageTable table, uint virtAddr, uint size) { if (!KConfig.UseKernelMemoryProtection) { return; } table.SetExecutable(virtAddr, size); }
public static unsafe void Map(this IPageTable table, Addr virtAddr, Addr physAddr, IPageFrameAllocator physAllocator, bool present = true, bool flush = false) { var page = physAllocator.GetPageByAddress(physAddr); var pAddr = physAllocator.GetAddress(page); while (true) { table.Map(virtAddr, pAddr, present, flush); page = physAllocator.NextCompoundPage(page); pAddr = physAllocator.GetAddress(page); if (page == null || pAddr == physAddr) { break; } virtAddr += 4096; } }
public static void UnMap(this IPageTable table, Addr virtAddr, USize length, bool flush = false) { if (KConfig.Log.MemoryMapping && length > 4096) { KernelMessage.WriteLine("UnMap: virt={0:X8}, length={2:X8}", virtAddr, length); } var pages = KMath.DivCeil(length, 4096); for (var i = 0; i < pages; i++) { table.MapVirtualAddressToPhysical(virtAddr, 0, false); virtAddr += 4096; } if (flush) { table.Flush(); } }
/// <summary> /// Sync specific mappings with another table. /// </summary> public static void MapCopy(this IPageTable table, IPageTable fromTable, Addr virtAddr, USize length, bool present = true, bool flush = false) { if (KConfig.Log.MemoryMapping && length > 4096) { KernelMessage.WriteLine("MapCopy: virt={0:X8}, length={1:X8}", virtAddr, length); } var pages = KMath.DivCeil(length, 4096); for (var i = 0; i < pages; i++) { var physAddr = fromTable.GetPhysicalAddressFromVirtual(virtAddr); table.MapVirtualAddressToPhysical(virtAddr, physAddr, present); virtAddr += 4096; } if (flush) { table.Flush(); } }
public static void UnMap(this IPageTable table, Addr virtAddr, bool flush = false) { UnMap(table, virtAddr, 4096, flush); }
public static void Map(this IPageTable table, Addr virtAddr, Addr physAddr, bool present = true, bool flush = false) { Map(table, virtAddr, physAddr, 4096, present, flush); }
public static Addr GetPageTablePhysAddr(this IPageTable table) { return(PageTable.KernelTable.GetPhysicalAddressFromVirtual(table.VirtAddr)); }
public static unsafe void SetExecutable(this IPageTable table, BootInfoMemoryType type) { var mm = BootInfo.GetMap(type); SetExecutable(table, mm->Start, mm->Size); }
/// <summary> /// Sync specific mappings with another table. /// The virtual and physical Addresses in both table will be the same. /// </summary> public static void MapCopy(this IPageTable table, IPageTable fromTable, KernelMemoryMap *mm, bool present = true, bool flush = false) { table.MapCopy(fromTable, mm->Start, mm->Size, present, flush); }
/// <summary> /// Sync specific mappings with another table. /// The virtual and physical Addresses in both table will be the same. /// </summary> public static void MapCopy(this IPageTable table, IPageTable fromTable, BootInfoMemoryType type, bool present = true, bool flush = false) { var mm = BootInfo.GetMap(type); table.MapCopy(fromTable, mm->Start, mm->Size, present, flush); }
public static void ConfigureType(PageTableType type) { KernelTable = CreateInstance(type); }