Deleted Added
full compact
bhyverun.c (239045) bhyverun.c (240912)
1/*-
2 * Copyright (c) 2011 NetApp, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 41 unchanged lines hidden (view full) ---

50#include "fbsdrun.h"
51#include "inout.h"
52#include "dbgport.h"
53#include "mevent.h"
54#include "pci_emul.h"
55#include "xmsr.h"
56#include "instruction_emul.h"
57#include "ioapic.h"
1/*-
2 * Copyright (c) 2011 NetApp, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 41 unchanged lines hidden (view full) ---

50#include "fbsdrun.h"
51#include "inout.h"
52#include "dbgport.h"
53#include "mevent.h"
54#include "pci_emul.h"
55#include "xmsr.h"
56#include "instruction_emul.h"
57#include "ioapic.h"
58#include "spinup_ap.h"
58
59#define DEFAULT_GUEST_HZ 100
60#define DEFAULT_GUEST_TSLICE 200
61
62#define GUEST_NIO_PORT 0x488 /* guest upcalls via i/o port */
63
64#define VMEXIT_SWITCH 0 /* force vcpu switch in mux mode */
65#define VMEXIT_CONTINUE 1 /* continue from next instruction */

--- 275 unchanged lines hidden (view full) ---

341 retval = VMEXIT_SWITCH;
342 *pvcpu = newcpu;
343 }
344
345 return (retval);
346}
347
348static int
59
60#define DEFAULT_GUEST_HZ 100
61#define DEFAULT_GUEST_TSLICE 200
62
63#define GUEST_NIO_PORT 0x488 /* guest upcalls via i/o port */
64
65#define VMEXIT_SWITCH 0 /* force vcpu switch in mux mode */
66#define VMEXIT_CONTINUE 1 /* continue from next instruction */

--- 275 unchanged lines hidden (view full) ---

342 retval = VMEXIT_SWITCH;
343 *pvcpu = newcpu;
344 }
345
346 return (retval);
347}
348
349static int
350vmexit_spinup_ap(struct vmctx *ctx, struct vm_exit *vme, int *pvcpu)
351{
352 int newcpu;
353 int retval = VMEXIT_CONTINUE;
354
355 newcpu = spinup_ap(ctx, *pvcpu,
356 vme->u.spinup_ap.vcpu, vme->u.spinup_ap.rip);
357
358 if (guest_vcpu_mux && *pvcpu != newcpu) {
359 retval = VMEXIT_SWITCH;
360 *pvcpu = newcpu;
361 }
362
363 return (retval);
364}
365
366static int
349vmexit_vmx(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
350{
351
352 printf("vm exit[%d]\n", *pvcpu);
353 printf("\treason\t\tVMX\n");
354 printf("\trip\t\t0x%016lx\n", vmexit->rip);
355 printf("\tinst_length\t%d\n", vmexit->inst_length);
356 printf("\terror\t\t%d\n", vmexit->u.vmx.error);

--- 109 unchanged lines hidden (view full) ---

466
467static vmexit_handler_t handler[VM_EXITCODE_MAX] = {
468 [VM_EXITCODE_INOUT] = vmexit_inout,
469 [VM_EXITCODE_VMX] = vmexit_vmx,
470 [VM_EXITCODE_BOGUS] = vmexit_bogus,
471 [VM_EXITCODE_RDMSR] = vmexit_rdmsr,
472 [VM_EXITCODE_WRMSR] = vmexit_wrmsr,
473 [VM_EXITCODE_MTRAP] = vmexit_mtrap,
367vmexit_vmx(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
368{
369
370 printf("vm exit[%d]\n", *pvcpu);
371 printf("\treason\t\tVMX\n");
372 printf("\trip\t\t0x%016lx\n", vmexit->rip);
373 printf("\tinst_length\t%d\n", vmexit->inst_length);
374 printf("\terror\t\t%d\n", vmexit->u.vmx.error);

--- 109 unchanged lines hidden (view full) ---

484
485static vmexit_handler_t handler[VM_EXITCODE_MAX] = {
486 [VM_EXITCODE_INOUT] = vmexit_inout,
487 [VM_EXITCODE_VMX] = vmexit_vmx,
488 [VM_EXITCODE_BOGUS] = vmexit_bogus,
489 [VM_EXITCODE_RDMSR] = vmexit_rdmsr,
490 [VM_EXITCODE_WRMSR] = vmexit_wrmsr,
491 [VM_EXITCODE_MTRAP] = vmexit_mtrap,
474 [VM_EXITCODE_PAGING] = vmexit_paging
492 [VM_EXITCODE_PAGING] = vmexit_paging,
493 [VM_EXITCODE_SPINUP_AP] = vmexit_spinup_ap,
475};
476
477static void
478vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip)
479{
480 int error, rc, prevcpu;
481
482 if (guest_vcpu_mux)

--- 203 unchanged lines hidden ---
494};
495
496static void
497vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip)
498{
499 int error, rc, prevcpu;
500
501 if (guest_vcpu_mux)

--- 203 unchanged lines hidden ---