Documentation
¶
Index ¶
Constants ¶
const ( RangeRAM RangeType = "System RAM" RangeDefault = "Default" RangeNVACPI = "ACPI Non-volatile Storage" RangeACPI = "ACPI Tables" RangeNVS = "Reserved" )
Variables ¶
var ErrNotEnoughSpace = errors.New("not enough space")
Functions ¶
func FileLoad ¶
FileLoad loads the given kernel as the new kernel with the given ramfs and cmdline.
The kexec_file_load(2) syscall is x86-64 bit only.
Types ¶
type ErrKexec ¶ added in v0.4.0
ErrKexec is the error type returned kexec. It describes entry point, flags, errno and kernel layout.
type Memory ¶ added in v0.4.0
type Memory struct {
Phys []TypedAddressRange
Segments []Segment
}
Memory provides routines to work with physical memory ranges.
func (*Memory) AddKexecSegment ¶ added in v0.4.0
AddKexecSegment adds d to a new kexec segment
func (Memory) FindSpace ¶ added in v0.4.0
FindSpace returns pointer to the physical memory, where array of size sz can be stored during next AddKexecSegment call.
func (*Memory) LoadElfSegments ¶ added in v0.4.0
LoadElfSegments loads loadable ELF segments.
func (*Memory) ParseMemoryMap ¶ added in v0.4.0
ParseMemoryMap reads firmware provided memory map from /sys/firmware/memmap.
type Range ¶ added in v0.4.0
type Range struct {
// Start is the inclusive start of the range.
Start uintptr
// Size is the size of the range.
// Start+Size is the exclusive end of the range.
Size uint
}
Range represents a contiguous uintptr interval [Start, Start+Size).
func (Range) IsSupersetOf ¶ added in v0.4.0
IsSupersetOf returns true if r2 in r.
type RangeType ¶ added in v0.4.0
type RangeType string
RangeType defines type of a TypedAddressRange based on the Linux kernel string provided by firmware memory map.
type Segment ¶ added in v0.4.0
type Segment struct {
// Buf is a buffer in user space.
Buf Range
// Phys is a physical address of kernel.
Phys Range
}
Segment defines kernel memory layout.
func AlignPhys ¶ added in v0.4.0
AlignPhys fixes s to the kexec_load preconditions.
s's physical addresses must be multiples of the page size.
E.g. if page size is 0x1000:
Segment {
Buf: {Start: 0x1011, Size: 0x1022}
Phys: {Start: 0x2011, Size: 0x1022}
}
has to become
Segment {
Buf: {Start: 0x1000, Size: 0x1033}
Phys: {Start: 0x2000, Size: 0x2000}
}
func NewSegment ¶ added in v0.4.0
NewSegment creates new Segment. Segments should be created using NewSegment method to prevent data pointed by Segment.Buf to be collected by garbage collector.
type TypedAddressRange ¶ added in v0.4.0
TypedAddressRange represents range of physical memory.