1
0
mirror of https://github.com/taigrr/gopher-os synced 2025-01-18 04:43:13 -08:00
gopher-os/kernel/mem/pmm/frame.go
2017-05-31 17:02:34 +01:00

28 lines
640 B
Go

// Package pmm contains code that manages physical memory frame allocations.
package pmm
import (
"math"
"github.com/achilleasa/gopher-os/kernel/mem"
)
// Frame describes a physical memory page index.
type Frame uintptr
const (
// InvalidFrame is returned by page allocators when
// they fail to reserve the requested frame.
InvalidFrame = Frame(math.MaxUint64)
)
// Valid returns true if this is a valid frame.
func (f Frame) Valid() bool {
return f != InvalidFrame
}
// Address returns a pointer to the physical memory address pointed to by this Frame.
func (f Frame) Address() uintptr {
return uintptr(f << mem.PageShift)
}