Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BootOptions ¶
type BootOptions struct {
Cmdline string
Initrd []byte
InitrdGPA uint64
DeviceTreeGPA uint64
StackTopGPA uint64
NumCPUs int
UART *UARTConfig
GIC *GICConfig
DeviceTreeNodes []fdt.Node
}
BootOptions describes how the ARM64 kernel should be placed into guest RAM.
type BootPlan ¶
BootPlan captures the derived addresses needed to enter the kernel.
func (*BootPlan) ConfigureVCPU ¶
func (p *BootPlan) ConfigureVCPU(vcpu hv.VirtualCPU) error
ConfigureVCPU programs the first vCPU for entry into the Linux kernel.
type GICConfig ¶
type GICConfig struct {
Version GICVersion
DistributorBase uint64
DistributorSize uint64
RedistributorBase uint64
RedistributorSize uint64
CpuInterfaceBase uint64
CpuInterfaceSize uint64
ItsBase uint64
ItsSize uint64
MaintenanceInterrupt InterruptSpec
}
func DefaultGICConfig ¶
func DefaultGICConfig() GICConfig
DefaultGICConfig returns the standard tinyrange GIC description.
type GICVersion ¶
type GICVersion int
const ( GICVersionUnknown GICVersion = iota GICVersion2 GICVersion3 )
type ImageProbe ¶
type ImageProbe struct {
Header KernelHeader
NeedsDecompression bool
CompressedOffset int64
}
ImageProbe reports metadata gleaned from the kernel image without modifying guest memory.
func ProbeKernelImage ¶
func ProbeKernelImage(reader io.ReaderAt, size int64) (*ImageProbe, error)
ProbeKernelImage inspects the supplied kernel image, parses its header, and determines if the payload needs to be decompressed before it can be used as an ARM64 Image.
func (ImageProbe) ExtractImage ¶
ExtractImage returns the full Image payload, performing decompression when required. For raw Images the returned slice is the byte-for-byte kernel file.
func (ImageProbe) ExtractImageCached ¶ added in v0.0.2
func (p ImageProbe) ExtractImageCached(reader io.ReaderAt, size int64, cacheDir string) ([]byte, error)
ExtractImageCached returns the full Image payload, using a cache directory to avoid repeated decompression. For raw Images, no caching is performed. If cacheDir is empty, falls back to ExtractImage (no caching).
type InterruptSpec ¶
type KernelHeader ¶
type KernelHeader struct {
Code0 uint32
Code1 uint32
TextOffset uint64
ImageSize uint64
Flags uint64
Res2 uint64
Res3 uint64
Res4 uint64
Magic uint32
Res5 uint32
}
KernelHeader describes the 64-byte header placed at the beginning of every decompressed ARM64 Image.
func (KernelHeader) EntryPoint ¶
func (h KernelHeader) EntryPoint(base uint64) (uint64, error)
EntryPoint returns the address that the CPU should jump to relative to the provided 2 MiB aligned base address.
type KernelImage ¶
type KernelImage struct {
Header KernelHeader
// contains filtered or unexported fields
}
KernelImage represents a fully parsed ARM64 Linux kernel image.
func LoadKernel ¶
func LoadKernel(reader io.ReaderAt, size int64) (*KernelImage, error)
LoadKernel parses the supplied ARM64 Image (optionally compressed) and returns an in-memory representation ready for placement into guest RAM.
func LoadKernelWithCache ¶ added in v0.0.2
LoadKernelWithCache parses the supplied ARM64 Image with optional caching of decompressed kernels. If cacheDir is empty, no caching is performed.
func (*KernelImage) Payload ¶
func (k *KernelImage) Payload() []byte
Payload returns the raw Image bytes as they should appear in guest RAM.
func (*KernelImage) Prepare ¶
func (k *KernelImage) Prepare(vm hv.VirtualMachine, opts BootOptions) (*BootPlan, error)
Prepare loads the kernel payload and supporting blobs into guest RAM and derives the state required to enter the kernel.
type UARTConfig ¶
type UARTConfig struct {
Base uint64
Size uint64
ClockHz uint32
RegShift uint32
BaudRate uint32
Interrupt InterruptSpec
}
UARTConfig describes an optional ns16550-compatible console.