Documentation
¶
Index ¶
- func GetBootCmdLine() map[string]string
- func SetInfoPtr(ptr uintptr)
- func VisitElfSections(visitor ElfSectionVisitor)
- func VisitMemRegions(visitor MemRegionVisitor)
- type ElfSectionFlag
- type ElfSectionVisitor
- type FramebufferInfo
- type FramebufferRGBColorInfo
- type FramebufferType
- type MemRegionVisitor
- type MemoryEntryType
- type MemoryMapEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBootCmdLine ¶
GetBootCmdLine returns the command line key-value pairs passed to the kernel. This function must only be invoked after bootstrapping the memory allocator.
func SetInfoPtr ¶
func SetInfoPtr(ptr uintptr)
SetInfoPtr updates the internal multiboot information pointer to the given value. This function must be invoked before invoking any other function exported by this package.
func VisitElfSections ¶
func VisitElfSections(visitor ElfSectionVisitor)
VisitElfSections invokes visitor for each ELF entry that belongs to the loaded kernel image.
func VisitMemRegions ¶
func VisitMemRegions(visitor MemRegionVisitor)
VisitMemRegions will invoke the supplied visitor for each memory region that is defined by the multiboot info data that we received from the bootloader.
Types ¶
type ElfSectionFlag ¶
type ElfSectionFlag uint32
ElfSectionFlag defines an OR-able flag associated with an ElfSection.
const ( // ElfSectionWritable marks the section as writable. ElfSectionWritable ElfSectionFlag = 1 << iota // ElfSectionAllocated means that the section is allocated in memory // when the image is loaded (e.g .bss sections) ElfSectionAllocated // ElfSectionExecutable marks the section as executable. ElfSectionExecutable )
type ElfSectionVisitor ¶
type ElfSectionVisitor func(name string, flags ElfSectionFlag, address uintptr, size uint64)
ElfSectionVisitor defies a visitor function that gets invoked by VisitElfSections for rach ELF section that belongs to the loaded kernel image.
type FramebufferInfo ¶
type FramebufferInfo struct { // The framebuffer physical address. PhysAddr uint64 // Row pitch in bytes. Pitch uint32 // Width and height in pixels (or characters if Type = FramebufferTypeEGA) Width, Height uint32 // Bits per pixel (non EGA modes only). Bpp uint8 // Framebuffer type. Type FramebufferType // contains filtered or unexported fields }
FramebufferInfo provides information about the initialized framebuffer.
func GetFramebufferInfo ¶
func GetFramebufferInfo() *FramebufferInfo
GetFramebufferInfo returns information about the framebuffer initialized by the bootloader. This function returns nil if no framebuffer info is available.
func (*FramebufferInfo) RGBColorInfo ¶
func (i *FramebufferInfo) RGBColorInfo() *FramebufferRGBColorInfo
RGBColorInfo returns the FramebufferRGBColorInfo for a RGB framebuffer.
type FramebufferRGBColorInfo ¶
type FramebufferRGBColorInfo struct { // The position and width (in bits) of the red component. RedPosition uint8 RedMaskSize uint8 // The position and width (in bits) of the green component. GreenPosition uint8 GreenMaskSize uint8 // The position and width (in bits) of the blue component. BluePosition uint8 BlueMaskSize uint8 }
FramebufferRGBColorInfo describes the order and width of each color component for a 15-, 16-, 24- or 32-bit framebuffer.
type FramebufferType ¶
type FramebufferType uint8
FramebufferType defines the type of the initialized framebuffer.
const ( // FramebufferTypeIndexed specifies a 256-color palette. FramebufferTypeIndexed FramebufferType = iota // FramebufferTypeRGB specifies direct RGB mode. FramebufferTypeRGB // FramebufferTypeEGA specifies EGA text mode. FramebufferTypeEGA )
type MemRegionVisitor ¶
type MemRegionVisitor func(*MemoryMapEntry) bool
MemRegionVisitor defies a visitor function that gets invoked by VisitMemRegions for each memory region provided by the boot loader. The visitor must return true to continue or false to abort the scan.
type MemoryEntryType ¶
type MemoryEntryType uint32
MemoryEntryType defines the type of a MemoryMapEntry.
const ( // MemAvailable indicates that the memory region is available for use. MemAvailable MemoryEntryType = iota + 1 // MemReserved indicates that the memory region is not available for use. MemReserved // MemAcpiReclaimable indicates a memory region that holds ACPI info that // can be reused by the OS. MemAcpiReclaimable // MemNvs indicates memory that must be preserved when hibernating. MemNvs )
func (MemoryEntryType) String ¶
func (t MemoryEntryType) String() string
String implements fmt.Stringer for MemoryEntryType.
type MemoryMapEntry ¶
type MemoryMapEntry struct { // The physical address for this memory region. PhysAddress uint64 // The length of the memory region. Length uint64 // The type of this entry. Type MemoryEntryType }
MemoryMapEntry describes a memory region entry, namely its physical address, its length and its type.