Add Hurl.debug_lookup()
This commit is contained in:
parent
7d2b535df5
commit
4f98c469b7
@ -8,6 +8,7 @@ module hulk.hurl;
|
|||||||
import hos.cpu;
|
import hos.cpu;
|
||||||
import hulk.hippo;
|
import hulk.hippo;
|
||||||
import hos.memory;
|
import hos.memory;
|
||||||
|
import hulk.klog;
|
||||||
|
|
||||||
/** HULK virtual base address. */
|
/** HULK virtual base address. */
|
||||||
enum ulong HULK_VIRTUAL_BASE_ADDRESS = 0xFFFF_8000_0000_0000u;
|
enum ulong HULK_VIRTUAL_BASE_ADDRESS = 0xFFFF_8000_0000_0000u;
|
||||||
@ -34,6 +35,7 @@ struct Hurl
|
|||||||
private struct PageTableEntry
|
private struct PageTableEntry
|
||||||
{
|
{
|
||||||
private ulong m_entry;
|
private ulong m_entry;
|
||||||
|
alias m_entry this;
|
||||||
|
|
||||||
this(ulong address, ulong flags)
|
this(ulong address, ulong flags)
|
||||||
{
|
{
|
||||||
@ -130,4 +132,27 @@ struct Hurl
|
|||||||
map(address, address, flags);
|
map(address, address, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void debug_lookup(void * address)
|
||||||
|
{
|
||||||
|
klog.writefln("Debugging page table lookup of 0x%x", address);
|
||||||
|
PageTable * pt = m_pt_base;
|
||||||
|
for (size_t level = 0; level < 4u; level++)
|
||||||
|
{
|
||||||
|
PageTableEntry entry = (*pt)[address, level];
|
||||||
|
klog.writefln("Level %u, entry = 0x%x", level, entry);
|
||||||
|
if (entry.present)
|
||||||
|
{
|
||||||
|
pt = entry.follow();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ((entry & MAP_HUGE_PAGE) != 0u)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user