Documentation
¶
Index ¶
Constants ¶
const ( // PointerShift is equal to log2(unsafe.Sizeof(uintptr)). The pointer // size for this architecture is defined as (1 << PointerShift). PointerShift = uintptr(3) // PageShift is equal to log2(PageSize). This constant is used when // we need to convert a physical address to a page number (shift right by PageShift) // and vice-versa. PageShift = uintptr(12) // PageSize defines the system's page size in bytes. PageSize = uintptr(1 << PageShift) )
const ( // InvalidFrame is returned by page allocators when // they fail to reserve the requested frame. InvalidFrame = Frame(math.MaxUint64) )
Variables ¶
This section is empty.
Functions ¶
func SetFrameAllocator ¶
func SetFrameAllocator(allocFn FrameAllocatorFn)
SetFrameAllocator registers a frame allocator function that will be used by the vmm code when new physical frames need to be allocated.
Types ¶
type Frame ¶
type Frame uintptr
Frame describes a physical memory page index.
func AllocFrame ¶
AllocFrame allocates a new physical frame using the currently active physical frame allocator.
func FrameFromAddress ¶
FrameFromAddress returns a Frame that corresponds to the given physical address. This function can handle both page-aligned and not aligned addresses. in the latter case, the input address will be rounded down to the frame that contains it.
type FrameAllocatorFn ¶
FrameAllocatorFn is a function that can allocate physical frames.
type Page ¶
type Page uintptr
Page describes a virtual memory page index.
func PageFromAddress ¶
PageFromAddress returns a Page that corresponds to the given virtual address. This function can handle both page-aligned and not aligned virtual addresses. in the latter case, the input address will be rounded down to the page that contains it.