public static void AcpiOsUnmapMemory(void *LogicalAddress, uint Length) { // Align address down so we can get the offset uint down = Paging.AlignDown((uint)LogicalAddress); uint offset = (uint)LogicalAddress - down; // Length in rounded pagesize uint len = Paging.AlignUp(Length + offset); Paging.UnMapKeepPhysical((void *)down, (int)len); }
public static void *AcpiOsMapMemory(ulong PhysicalAddress, uint Length) { // Align address down so we can get the offset uint down = Paging.AlignDown((uint)PhysicalAddress); uint offset = (uint)PhysicalAddress - down; // Length in rounded pagesize uint len = Paging.AlignUp(Length + offset); // Map void *mapped = Paging.MapToVirtual(Paging.CurrentDirectory, (int)down, (int)len, Paging.PageFlags.Present | Paging.PageFlags.Writable); return((void *)((uint)mapped + offset)); }