mm

package
v0.0.0-...-1a7aca4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
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)
)
View Source
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

func AllocFrame() (Frame, *kernel.Error)

AllocFrame allocates a new physical frame using the currently active physical frame allocator.

func FrameFromAddress

func FrameFromAddress(physAddr uintptr) Frame

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.

func (Frame) Address

func (f Frame) Address() uintptr

Address returns a pointer to the physical memory address pointed to by this Frame.

func (Frame) Valid

func (f Frame) Valid() bool

Valid returns true if this is a valid frame.

type FrameAllocatorFn

type FrameAllocatorFn func() (Frame, *kernel.Error)

FrameAllocatorFn is a function that can allocate physical frames.

type Page

type Page uintptr

Page describes a virtual memory page index.

func PageFromAddress

func PageFromAddress(virtAddr uintptr) Page

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.

func (Page) Address

func (f Page) Address() uintptr

Address returns a pointer to the virtual memory address pointed to by this Page.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL