Add page_address()
This commit is contained in:
parent
2a832bfb8b
commit
22c9891c4f
@ -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));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user