Support version 4 of the userboot structure by implementing the

vm_set_register() and vm_set_desc() callbacks.
This commit is contained in:
Marcel Moolenaar 2016-02-26 16:12:20 +00:00
parent 7133fe0f33
commit 48f337b82c

View File

@ -542,6 +542,21 @@ cb_getenv(void *arg, int num)
return (NULL);
}
static int
cb_vm_set_register(void *arg, int vcpu, int reg, uint64_t val)
{
return (vm_set_register(ctx, vcpu, reg, val));
}
static int
cb_vm_set_desc(void *arg, int vcpu, int reg, uint64_t base, u_int limit,
u_int access)
{
return (vm_set_desc(ctx, vcpu, reg, base, limit, access));
}
static struct loader_callbacks cb = {
.getc = cb_getc,
.putc = cb_putc,
@ -571,6 +586,10 @@ static struct loader_callbacks cb = {
.getmem = cb_getmem,
.getenv = cb_getenv,
/* Version 4 additions */
.vm_set_register = cb_vm_set_register,
.vm_set_desc = cb_vm_set_desc,
};
static int
@ -765,7 +784,7 @@ main(int argc, char** argv)
addenv("smbios.bios.vendor=BHYVE");
addenv("boot_serial=1");
func(&cb, NULL, USERBOOT_VERSION_3, ndisks);
func(&cb, NULL, USERBOOT_VERSION_4, ndisks);
free(loader);
return (0);