2 * Copyright (c) 2011 NetApp, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <sys/cdefs.h>
30 __FBSDID("$FreeBSD$");
32 #include <sys/types.h>
33 #ifndef WITHOUT_CAPSICUM
34 #include <sys/capsicum.h>
39 #include <machine/atomic.h>
40 #include <machine/segments.h>
42 #ifndef WITHOUT_CAPSICUM
43 #include <capsicum_helpers.h>
55 #include <pthread_np.h>
59 #include <machine/vmm.h>
60 #ifndef WITHOUT_CAPSICUM
61 #include <machine/vmm_dev.h>
78 #include "smbiostbl.h"
80 #include "spinup_ap.h"
83 #define GUEST_NIO_PORT 0x488 /* guest upcalls via i/o port */
85 #define MB (1024UL * 1024)
86 #define GB (1024UL * MB)
88 typedef int (*vmexit_handler_t)(struct vmctx *, struct vm_exit *, int *vcpu);
89 extern int vmexit_task_switch(struct vmctx *, struct vm_exit *, int *vcpu);
96 static int guest_vmexit_on_hlt, guest_vmexit_on_pause;
97 static int virtio_msix = 1;
98 static int x2apic_mode = 0; /* default is xAPIC */
101 static int strictmsr = 1;
105 static char *progname;
106 static const int BSP = 0;
108 static cpuset_t cpumask;
110 static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip);
112 static struct vm_exit vmexit[VM_MAXCPU];
115 uint64_t vmexit_bogus;
116 uint64_t vmexit_reqidle;
118 uint64_t vmexit_pause;
119 uint64_t vmexit_mtrap;
120 uint64_t vmexit_inst_emul;
121 uint64_t cpu_switch_rotate;
122 uint64_t cpu_switch_direct;
127 struct vmctx *mt_ctx;
129 } mt_vmm_info[VM_MAXCPU];
131 static cpuset_t *vcpumap[VM_MAXCPU] = { NULL };
138 "Usage: %s [-abehuwxACHPSWY] [-c vcpus] [-g <gdb port>] [-l <lpc>]\n"
139 " %*s [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] <vm>\n"
140 " -a: local apic is in xAPIC mode (deprecated)\n"
141 " -A: create ACPI tables\n"
142 " -c: # cpus (default 1)\n"
143 " -C: include guest memory in core file\n"
144 " -e: exit on unhandled I/O access\n"
147 " -H: vmexit from the guest on hlt\n"
148 " -l: LPC device configuration\n"
149 " -m: memory size in MB\n"
150 " -p: pin 'vcpu' to 'hostcpu'\n"
151 " -P: vmexit from the guest on pause\n"
152 " -s: <slot,driver,configinfo> PCI slot config\n"
153 " -S: guest memory cannot be swapped\n"
154 " -u: RTC keeps UTC time\n"
156 " -w: ignore unimplemented MSRs\n"
157 " -W: force virtio to use single-vector MSI\n"
158 " -x: local apic is in x2APIC mode\n"
159 " -Y: disable MPtable generation\n",
160 progname, (int)strlen(progname), "");
166 pincpu_parse(const char *opt)
170 if (sscanf(opt, "%d:%d", &vcpu, &pcpu) != 2) {
171 fprintf(stderr, "invalid format: %s\n", opt);
175 if (vcpu < 0 || vcpu >= VM_MAXCPU) {
176 fprintf(stderr, "vcpu '%d' outside valid range from 0 to %d\n",
177 vcpu, VM_MAXCPU - 1);
181 if (pcpu < 0 || pcpu >= CPU_SETSIZE) {
182 fprintf(stderr, "hostcpu '%d' outside valid range from "
183 "0 to %d\n", pcpu, CPU_SETSIZE - 1);
187 if (vcpumap[vcpu] == NULL) {
188 if ((vcpumap[vcpu] = malloc(sizeof(cpuset_t))) == NULL) {
192 CPU_ZERO(vcpumap[vcpu]);
194 CPU_SET(pcpu, vcpumap[vcpu]);
199 vm_inject_fault(void *arg, int vcpu, int vector, int errcode_valid,
203 int error, restart_instruction;
206 restart_instruction = 1;
208 error = vm_inject_exception(ctx, vcpu, vector, errcode_valid, errcode,
209 restart_instruction);
214 paddr_guest2host(struct vmctx *ctx, uintptr_t gaddr, size_t len)
217 return (vm_map_gpa(ctx, gaddr, len));
221 fbsdrun_vmexit_on_pause(void)
224 return (guest_vmexit_on_pause);
228 fbsdrun_vmexit_on_hlt(void)
231 return (guest_vmexit_on_hlt);
235 fbsdrun_virtio_msix(void)
238 return (virtio_msix);
242 fbsdrun_start_thread(void *param)
244 char tname[MAXCOMLEN + 1];
245 struct mt_vmm_info *mtp;
251 snprintf(tname, sizeof(tname), "vcpu %d", vcpu);
252 pthread_set_name_np(mtp->mt_thr, tname);
254 vm_loop(mtp->mt_ctx, vcpu, vmexit[vcpu].rip);
262 fbsdrun_addcpu(struct vmctx *ctx, int fromcpu, int newcpu, uint64_t rip)
266 assert(fromcpu == BSP);
269 * The 'newcpu' must be activated in the context of 'fromcpu'. If
270 * vm_activate_cpu() is delayed until newcpu's pthread starts running
271 * then vmm.ko is out-of-sync with bhyve and this can create a race
274 error = vm_activate_cpu(ctx, newcpu);
276 err(EX_OSERR, "could not activate CPU %d", newcpu);
278 CPU_SET_ATOMIC(newcpu, &cpumask);
281 * Set up the vmexit struct to allow execution to start
284 vmexit[newcpu].rip = rip;
285 vmexit[newcpu].inst_length = 0;
287 mt_vmm_info[newcpu].mt_ctx = ctx;
288 mt_vmm_info[newcpu].mt_vcpu = newcpu;
290 error = pthread_create(&mt_vmm_info[newcpu].mt_thr, NULL,
291 fbsdrun_start_thread, &mt_vmm_info[newcpu]);
296 fbsdrun_deletecpu(struct vmctx *ctx, int vcpu)
299 if (!CPU_ISSET(vcpu, &cpumask)) {
300 fprintf(stderr, "Attempting to delete unknown cpu %d\n", vcpu);
304 CPU_CLR_ATOMIC(vcpu, &cpumask);
305 return (CPU_EMPTY(&cpumask));
309 vmexit_handle_notify(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu,
314 * put guest-driven debug here
317 return (VMEXIT_CONTINUE);
321 vmexit_inout(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu)
324 int bytes, port, in, out;
329 port = vme->u.inout.port;
330 bytes = vme->u.inout.bytes;
331 in = vme->u.inout.in;
334 /* Extra-special case of host notifications */
335 if (out && port == GUEST_NIO_PORT) {
336 error = vmexit_handle_notify(ctx, vme, pvcpu, vme->u.inout.eax);
340 error = emulate_inout(ctx, vcpu, vme, strictio);
342 fprintf(stderr, "Unhandled %s%c 0x%04x at 0x%lx\n",
344 bytes == 1 ? 'b' : (bytes == 2 ? 'w' : 'l'),
346 return (VMEXIT_ABORT);
348 return (VMEXIT_CONTINUE);
353 vmexit_rdmsr(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu)
360 error = emulate_rdmsr(ctx, *pvcpu, vme->u.msr.code, &val);
362 fprintf(stderr, "rdmsr to register %#x on vcpu %d\n",
363 vme->u.msr.code, *pvcpu);
365 vm_inject_gp(ctx, *pvcpu);
366 return (VMEXIT_CONTINUE);
371 error = vm_set_register(ctx, *pvcpu, VM_REG_GUEST_RAX, eax);
375 error = vm_set_register(ctx, *pvcpu, VM_REG_GUEST_RDX, edx);
378 return (VMEXIT_CONTINUE);
382 vmexit_wrmsr(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu)
386 error = emulate_wrmsr(ctx, *pvcpu, vme->u.msr.code, vme->u.msr.wval);
388 fprintf(stderr, "wrmsr to register %#x(%#lx) on vcpu %d\n",
389 vme->u.msr.code, vme->u.msr.wval, *pvcpu);
391 vm_inject_gp(ctx, *pvcpu);
392 return (VMEXIT_CONTINUE);
395 return (VMEXIT_CONTINUE);
399 vmexit_spinup_ap(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu)
402 (void)spinup_ap(ctx, *pvcpu,
403 vme->u.spinup_ap.vcpu, vme->u.spinup_ap.rip);
405 return (VMEXIT_CONTINUE);
408 #define DEBUG_EPT_MISCONFIG
409 #ifdef DEBUG_EPT_MISCONFIG
410 #define EXIT_REASON_EPT_MISCONFIG 49
411 #define VMCS_GUEST_PHYSICAL_ADDRESS 0x00002400
412 #define VMCS_IDENT(x) ((x) | 0x80000000)
414 static uint64_t ept_misconfig_gpa, ept_misconfig_pte[4];
415 static int ept_misconfig_ptenum;
419 vmexit_vmx(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
422 fprintf(stderr, "vm exit[%d]\n", *pvcpu);
423 fprintf(stderr, "\treason\t\tVMX\n");
424 fprintf(stderr, "\trip\t\t0x%016lx\n", vmexit->rip);
425 fprintf(stderr, "\tinst_length\t%d\n", vmexit->inst_length);
426 fprintf(stderr, "\tstatus\t\t%d\n", vmexit->u.vmx.status);
427 fprintf(stderr, "\texit_reason\t%u\n", vmexit->u.vmx.exit_reason);
428 fprintf(stderr, "\tqualification\t0x%016lx\n",
429 vmexit->u.vmx.exit_qualification);
430 fprintf(stderr, "\tinst_type\t\t%d\n", vmexit->u.vmx.inst_type);
431 fprintf(stderr, "\tinst_error\t\t%d\n", vmexit->u.vmx.inst_error);
432 #ifdef DEBUG_EPT_MISCONFIG
433 if (vmexit->u.vmx.exit_reason == EXIT_REASON_EPT_MISCONFIG) {
434 vm_get_register(ctx, *pvcpu,
435 VMCS_IDENT(VMCS_GUEST_PHYSICAL_ADDRESS),
437 vm_get_gpa_pmap(ctx, ept_misconfig_gpa, ept_misconfig_pte,
438 &ept_misconfig_ptenum);
439 fprintf(stderr, "\tEPT misconfiguration:\n");
440 fprintf(stderr, "\t\tGPA: %#lx\n", ept_misconfig_gpa);
441 fprintf(stderr, "\t\tPTE(%d): %#lx %#lx %#lx %#lx\n",
442 ept_misconfig_ptenum, ept_misconfig_pte[0],
443 ept_misconfig_pte[1], ept_misconfig_pte[2],
444 ept_misconfig_pte[3]);
446 #endif /* DEBUG_EPT_MISCONFIG */
447 return (VMEXIT_ABORT);
451 vmexit_svm(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
454 fprintf(stderr, "vm exit[%d]\n", *pvcpu);
455 fprintf(stderr, "\treason\t\tSVM\n");
456 fprintf(stderr, "\trip\t\t0x%016lx\n", vmexit->rip);
457 fprintf(stderr, "\tinst_length\t%d\n", vmexit->inst_length);
458 fprintf(stderr, "\texitcode\t%#lx\n", vmexit->u.svm.exitcode);
459 fprintf(stderr, "\texitinfo1\t%#lx\n", vmexit->u.svm.exitinfo1);
460 fprintf(stderr, "\texitinfo2\t%#lx\n", vmexit->u.svm.exitinfo2);
461 return (VMEXIT_ABORT);
465 vmexit_bogus(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
468 assert(vmexit->inst_length == 0);
470 stats.vmexit_bogus++;
472 return (VMEXIT_CONTINUE);
476 vmexit_reqidle(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
479 assert(vmexit->inst_length == 0);
481 stats.vmexit_reqidle++;
483 return (VMEXIT_CONTINUE);
487 vmexit_hlt(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
493 * Just continue execution with the next instruction. We use
494 * the HLT VM exit as a way to be friendly with the host
497 return (VMEXIT_CONTINUE);
501 vmexit_pause(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
504 stats.vmexit_pause++;
506 return (VMEXIT_CONTINUE);
510 vmexit_mtrap(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
513 assert(vmexit->inst_length == 0);
515 stats.vmexit_mtrap++;
517 return (VMEXIT_CONTINUE);
521 vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
526 stats.vmexit_inst_emul++;
528 vie = &vmexit->u.inst_emul.vie;
529 err = emulate_mem(ctx, *pvcpu, vmexit->u.inst_emul.gpa,
530 vie, &vmexit->u.inst_emul.paging);
534 fprintf(stderr, "Unhandled memory access to 0x%lx\n",
535 vmexit->u.inst_emul.gpa);
538 fprintf(stderr, "Failed to emulate instruction [");
539 for (i = 0; i < vie->num_valid; i++) {
540 fprintf(stderr, "0x%02x%s", vie->inst[i],
541 i != (vie->num_valid - 1) ? " " : "");
543 fprintf(stderr, "] at 0x%lx\n", vmexit->rip);
544 return (VMEXIT_ABORT);
547 return (VMEXIT_CONTINUE);
550 static pthread_mutex_t resetcpu_mtx = PTHREAD_MUTEX_INITIALIZER;
551 static pthread_cond_t resetcpu_cond = PTHREAD_COND_INITIALIZER;
554 vmexit_suspend(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
556 enum vm_suspend_how how;
558 how = vmexit->u.suspended.how;
560 fbsdrun_deletecpu(ctx, *pvcpu);
563 pthread_mutex_lock(&resetcpu_mtx);
564 pthread_cond_signal(&resetcpu_cond);
565 pthread_mutex_unlock(&resetcpu_mtx);
569 pthread_mutex_lock(&resetcpu_mtx);
570 while (!CPU_EMPTY(&cpumask)) {
571 pthread_cond_wait(&resetcpu_cond, &resetcpu_mtx);
573 pthread_mutex_unlock(&resetcpu_mtx);
576 case VM_SUSPEND_RESET:
578 case VM_SUSPEND_POWEROFF:
580 case VM_SUSPEND_HALT:
582 case VM_SUSPEND_TRIPLEFAULT:
585 fprintf(stderr, "vmexit_suspend: invalid reason %d\n", how);
588 return (0); /* NOTREACHED */
591 static vmexit_handler_t handler[VM_EXITCODE_MAX] = {
592 [VM_EXITCODE_INOUT] = vmexit_inout,
593 [VM_EXITCODE_INOUT_STR] = vmexit_inout,
594 [VM_EXITCODE_VMX] = vmexit_vmx,
595 [VM_EXITCODE_SVM] = vmexit_svm,
596 [VM_EXITCODE_BOGUS] = vmexit_bogus,
597 [VM_EXITCODE_REQIDLE] = vmexit_reqidle,
598 [VM_EXITCODE_RDMSR] = vmexit_rdmsr,
599 [VM_EXITCODE_WRMSR] = vmexit_wrmsr,
600 [VM_EXITCODE_MTRAP] = vmexit_mtrap,
601 [VM_EXITCODE_INST_EMUL] = vmexit_inst_emul,
602 [VM_EXITCODE_SPINUP_AP] = vmexit_spinup_ap,
603 [VM_EXITCODE_SUSPENDED] = vmexit_suspend,
604 [VM_EXITCODE_TASK_SWITCH] = vmexit_task_switch,
608 vm_loop(struct vmctx *ctx, int vcpu, uint64_t startrip)
611 enum vm_exitcode exitcode;
612 cpuset_t active_cpus;
614 if (vcpumap[vcpu] != NULL) {
615 error = pthread_setaffinity_np(pthread_self(),
616 sizeof(cpuset_t), vcpumap[vcpu]);
620 error = vm_active_cpus(ctx, &active_cpus);
621 assert(CPU_ISSET(vcpu, &active_cpus));
623 error = vm_set_register(ctx, vcpu, VM_REG_GUEST_RIP, startrip);
627 error = vm_run(ctx, vcpu, &vmexit[vcpu]);
631 exitcode = vmexit[vcpu].exitcode;
632 if (exitcode >= VM_EXITCODE_MAX || handler[exitcode] == NULL) {
633 fprintf(stderr, "vm_loop: unexpected exitcode 0x%x\n",
638 rc = (*handler[exitcode])(ctx, &vmexit[vcpu], &vcpu);
641 case VMEXIT_CONTINUE:
649 fprintf(stderr, "vm_run error %d, errno %d\n", error, errno);
653 num_vcpus_allowed(struct vmctx *ctx)
657 error = vm_get_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, &tmp);
660 * The guest is allowed to spinup more than one processor only if the
661 * UNRESTRICTED_GUEST capability is available.
670 fbsdrun_set_capabilities(struct vmctx *ctx, int cpu)
674 if (fbsdrun_vmexit_on_hlt()) {
675 err = vm_get_capability(ctx, cpu, VM_CAP_HALT_EXIT, &tmp);
677 fprintf(stderr, "VM exit on HLT not supported\n");
680 vm_set_capability(ctx, cpu, VM_CAP_HALT_EXIT, 1);
682 handler[VM_EXITCODE_HLT] = vmexit_hlt;
685 if (fbsdrun_vmexit_on_pause()) {
687 * pause exit support required for this mode
689 err = vm_get_capability(ctx, cpu, VM_CAP_PAUSE_EXIT, &tmp);
692 "SMP mux requested, no pause support\n");
695 vm_set_capability(ctx, cpu, VM_CAP_PAUSE_EXIT, 1);
697 handler[VM_EXITCODE_PAUSE] = vmexit_pause;
701 err = vm_set_x2apic_state(ctx, cpu, X2APIC_ENABLED);
703 err = vm_set_x2apic_state(ctx, cpu, X2APIC_DISABLED);
706 fprintf(stderr, "Unable to set x2apic state (%d)\n", err);
710 vm_set_capability(ctx, cpu, VM_CAP_ENABLE_INVPCID, 1);
713 static struct vmctx *
714 do_open(const char *vmname)
718 bool reinit, romboot;
719 #ifndef WITHOUT_CAPSICUM
721 const cap_ioctl_t *cmds;
725 reinit = romboot = false;
730 error = vm_create(vmname);
732 if (errno == EEXIST) {
737 * The virtual machine has been setup by the
738 * userspace bootloader.
748 * If the virtual machine was just created then a
749 * bootrom must be configured to boot it.
751 fprintf(stderr, "virtual machine cannot be booted\n");
756 ctx = vm_open(vmname);
762 #ifndef WITHOUT_CAPSICUM
763 cap_rights_init(&rights, CAP_IOCTL, CAP_MMAP_RW);
764 if (cap_rights_limit(vm_get_device_fd(ctx), &rights) == -1 &&
766 errx(EX_OSERR, "Unable to apply rights for sandbox");
767 vm_get_ioctls(&ncmds);
768 cmds = vm_get_ioctls(NULL);
770 errx(EX_OSERR, "out of memory");
771 if (cap_ioctls_limit(vm_get_device_fd(ctx), cmds, ncmds) == -1 &&
773 errx(EX_OSERR, "Unable to apply rights for sandbox");
774 free((cap_ioctl_t *)cmds);
778 error = vm_reinit(ctx);
788 main(int argc, char *argv[])
790 int c, error, gdb_port, err, bvmcons;
791 int max_vcpus, mptgen, memflags;
799 progname = basename(argv[0]);
807 optstr = "abehuwxACHIPSWYp:g:c:s:m:l:U:";
808 while ((c = getopt(argc, argv, optstr)) != -1) {
820 if (pincpu_parse(optarg) != 0) {
821 errx(EX_USAGE, "invalid vcpu pinning "
822 "configuration '%s'", optarg);
826 guest_ncpus = atoi(optarg);
829 memflags |= VM_MEM_F_INCORE;
832 gdb_port = atoi(optarg);
835 if (lpc_device_parse(optarg) != 0) {
836 errx(EX_USAGE, "invalid lpc device "
837 "configuration '%s'", optarg);
841 if (pci_parse_slot(optarg) != 0)
846 memflags |= VM_MEM_F_WIRED;
849 error = vm_parse_memsize(optarg, &memsize);
851 errx(EX_USAGE, "invalid memsize '%s'", optarg);
854 guest_vmexit_on_hlt = 1;
858 * The "-I" option was used to add an ioapic to the
861 * An ioapic is now provided unconditionally for each
862 * virtual machine and this option is now deprecated.
866 guest_vmexit_on_pause = 1;
875 guest_uuid_str = optarg;
902 ctx = do_open(vmname);
904 if (guest_ncpus < 1) {
905 fprintf(stderr, "Invalid guest vCPUs (%d)\n", guest_ncpus);
909 max_vcpus = num_vcpus_allowed(ctx);
910 if (guest_ncpus > max_vcpus) {
911 fprintf(stderr, "%d vCPUs requested but only %d available\n",
912 guest_ncpus, max_vcpus);
916 fbsdrun_set_capabilities(ctx, BSP);
918 vm_set_memflags(ctx, memflags);
919 err = vm_setup_memory(ctx, memsize, VM_MMAP_ALL);
921 fprintf(stderr, "Unable to setup memory (%d)\n", errno);
927 fprintf(stderr, "init_msr error %d", error);
937 rtc_init(ctx, rtc_localtime);
941 * Exit if a device emulation finds an error in its initilization
943 if (init_pci(ctx) != 0)
947 init_dbgport(gdb_port);
953 if (vm_set_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, 1)) {
954 fprintf(stderr, "ROM boot failed: unrestricted guest "
955 "capability not available\n");
958 error = vcpu_reset(ctx, BSP);
962 error = vm_get_register(ctx, BSP, VM_REG_GUEST_RIP, &rip);
966 * build the guest tables, MP etc.
969 error = mptable_build(ctx, guest_ncpus);
974 error = smbios_build(ctx);
978 error = acpi_build(ctx, guest_ncpus);
985 #ifndef WITHOUT_CAPSICUM
986 caph_cache_catpages();
988 if (caph_limit_stdout() == -1 || caph_limit_stderr() == -1)
989 errx(EX_OSERR, "Unable to apply rights for sandbox");
991 if (cap_enter() == -1 && errno != ENOSYS)
992 errx(EX_OSERR, "cap_enter() failed");
996 * Change the proc title to include the VM name.
998 setproctitle("%s", vmname);
1003 fbsdrun_addcpu(ctx, BSP, BSP, rip);
1006 * Head off to the main event dispatch loop