HomeFreeBSD

bhyveload: support guest rebooting from the loader

Description

bhyveload: support guest rebooting from the loader

userboot has a EXIT_REBOOT code that it uses when the 'reboot' loader
command is executed. Use that and longjmp back to reinit the VM
entirely with a reboot request. This fixes the 'reboot' option in the
loader menu to actually reboot rather than shutdown the VM.

The JMP_* constants are introduced to keep track of why we're doing a
longjmp, though they aren't currently used. We'll notably still do a
complete reload of the interpreter to give the rebooted VM that new
loader smell. It just seemed forward thinking to just keep track of the
different setjmp points.

While we're here, we don't actually need to keep the fd we passed to
fdlopen(3), so let's avoid leaking it.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D43300

Details

Provenance
kevansAuthored on Jan 5 2024, 6:21 AM
Reviewer
markj
Differential Revision
D43300: bhyveload: support guest rebooting from the loader
Parents
rGc067be72e835: bhyveload: limit rights on the dirfds we create
Branches
Unknown
Tags
Unknown