diff --git a/src/hulk/pagetable.d b/src/hulk/pagetable.d index 81468fe..61ed22f 100644 --- a/src/hulk/pagetable.d +++ b/src/hulk/pagetable.d @@ -183,3 +183,11 @@ struct PageTable } } static assert(PageTable.sizeof == 4096u); + +/** + * Get the base address of the page containing the given address. + */ +T page_address(T)(T address) +{ + return cast(T)(cast(ulong)address & ~(PAGE_SIZE - 1u)); +}