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 ¶
ErrKexec is the error type returned kexec. It describes entry point, flags, errno and kernel layout.
type Memory ¶
type Memory struct { Phys []TypedAddressRange Segments []Segment }
Memory provides routines to work with physical memory ranges.
func (*Memory) AddKexecSegment ¶
AddKexecSegment adds d to a new kexec segment
func (Memory) FindSpace ¶
FindSpace returns pointer to the physical memory, where array of size sz can be stored during next AddKexecSegment call.
func (*Memory) LoadElfSegments ¶
LoadElfSegments loads loadable ELF segments.
func (*Memory) ParseMemoryMap ¶
ParseMemoryMap reads firmware provided memory map from /sys/firmware/memmap.
type Range ¶
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 ¶
IsSupersetOf returns true if r2 in r.
type RangeType ¶
type RangeType string
RangeType defines type of a TypedAddressRange based on the Linux kernel string provided by firmware memory map.
type Segment ¶
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 ¶
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 ¶
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 ¶
TypedAddressRange represents range of physical memory.