Allow pointers or integers for Hurl.*map_range()

This commit is contained in:
Josh Holtrop 2023-06-09 23:38:52 -04:00
parent 222a1efea4
commit 7aa28da1ef

View File

@ -253,7 +253,7 @@ struct Hurl
map(cast(ulong)virtual, cast(ulong)physical, flags);
}
public static void map_range(size_t virtual, size_t physical, size_t length, ulong flags)
public static void map_range(ulong virtual, ulong physical, size_t length, ulong flags)
{
size_t end = virtual + length;
while (virtual < end)
@ -264,7 +264,12 @@ struct Hurl
}
}
public static void identity_map_range(size_t address, size_t length, ulong flags)
public static void map_range(T, U)(T virtual, U physical, size_t length, ulong flags)
{
map_range(cast(ulong)virtual, cast(ulong)physical, length, flags);
}
public static void identity_map_range(ulong address, size_t length, ulong flags)
{
size_t end = address + length;
for (size_t page = address & 0xFFFF_FFFF_FFFF_F000u; page < end; page += PAGE_SIZE)
@ -273,6 +278,11 @@ struct Hurl
}
}
public static void identity_map_range(T)(T address, size_t length, ulong flags)
{
identity_map_range(cast(ulong)address, length, flags);
}
public static void debug_lookup(void * address)
{
Klog.writefln("Debugging page table lookup of 0x%x", address);