arm64

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

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

type BootPlan struct {
	EntryGPA      uint64
	StackTopGPA   uint64
	DeviceTreeGPA uint64
}

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

func (p ImageProbe) ExtractImage(reader io.ReaderAt, size int64) ([]byte, error)

ExtractImage returns the full Image payload, performing decompression when required. For raw Images the returned slice is the byte-for-byte kernel file.

type InterruptSpec

type InterruptSpec struct {
	Type  uint32
	Num   uint32
	Flags uint32
}

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 (*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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL