NAME

App::FuguVM::Arch - the architecture table of the supported guests

SYNOPSIS

use App::FuguVM::Arch;

my $arch = App::FuguVM::Arch->new('amd64')
    or die "unknown architecture\n";

my @cmd = ($arch->qemu_binary, '-M', $arch->machine);
my $accel = $arch->accelerator($^O, $host_machine, $kvm);

DESCRIPTION

The module holds the architecture table and nothing else. Each entry maps one OpenBSD architecture name, amd64 or arm64, to the QEMU binary, the machine type, the TCG CPU model, the host machine names, and the firmware paths. The QEMU spellings, x86_64 and aarch64, stay inside the table.

The module uses core Perl only, and it loads no other module of the distribution.

METHODS

new

App::FuguVM::Arch->new($name)

Return the architecture object for amd64 or arm64. Return undef for every other name. The comparison is case sensitive, so AMD64 is an unknown value.

names

App::FuguVM::Arch->names

Return the supported names, sorted. A diagnostic names them, so the message and the table cannot disagree.

name, qemu_binary, machine, tcg_cpu

name is the OpenBSD name of the architecture. qemu_binary is the QEMU binary name. machine is the -M machine string. tcg_cpu is the -cpu model for software emulation.

firmware_paths, firmware_glob

firmware_paths is the ordered list of absolute firmware code paths. firmware_glob is one glob pattern for the versioned Homebrew paths.

firmware_vars_path

Return the variable-store template beside a firmware code file. Return undef when the architecture boots the code file with -bios alone. The x86 code files are split flash images, and -bios cannot load them. Each amd64 code file therefore pairs with the template in its directory, and both boot as pflash devices.

accelerator

$arch->accelerator($os, $host_machine, $kvm)

Return kvm, hvf or tcg for one host. QEMU cannot accelerate a guest whose instruction set is not the host's, so a host machine of an other architecture always gives tcg. The caller gives $^O, the uname machine, and whether /dev/kvm is writable. The method calls no syscall, so a test proves every branch on any host.

SEE ALSO

App::FuguVM::Config, App::FuguVM::Guest, fuguvm(1)

AUTHOR

Dick Olsson <hi@senzilla.io>