Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/vmm/vmm_dev.c
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
#include "vmm_lapic.h" | #include "vmm_lapic.h" | ||||
#include "vmm_stat.h" | #include "vmm_stat.h" | ||||
#include "vmm_mem.h" | #include "vmm_mem.h" | ||||
#include "io/ppt.h" | #include "io/ppt.h" | ||||
#include "io/vatpic.h" | #include "io/vatpic.h" | ||||
#include "io/vioapic.h" | #include "io/vioapic.h" | ||||
#include "io/vhpet.h" | #include "io/vhpet.h" | ||||
#include "io/vrtc.h" | |||||
struct vmmdev_softc { | struct vmmdev_softc { | ||||
struct vm *vm; /* vm instance cookie */ | struct vm *vm; /* vm instance cookie */ | ||||
struct cdev *cdev; | struct cdev *cdev; | ||||
SLIST_ENTRY(vmmdev_softc) link; | SLIST_ENTRY(vmmdev_softc) link; | ||||
int flags; | int flags; | ||||
}; | }; | ||||
#define VSC_LINKED 0x01 | #define VSC_LINKED 0x01 | ||||
▲ Show 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, | ||||
struct vm_stat_desc *statdesc; | struct vm_stat_desc *statdesc; | ||||
struct vm_x2apic *x2apic; | struct vm_x2apic *x2apic; | ||||
struct vm_gpa_pte *gpapte; | struct vm_gpa_pte *gpapte; | ||||
struct vm_suspend *vmsuspend; | struct vm_suspend *vmsuspend; | ||||
struct vm_gla2gpa *gg; | struct vm_gla2gpa *gg; | ||||
struct vm_activate_cpu *vac; | struct vm_activate_cpu *vac; | ||||
struct vm_cpuset *vm_cpuset; | struct vm_cpuset *vm_cpuset; | ||||
struct vm_intinfo *vmii; | struct vm_intinfo *vmii; | ||||
struct vm_rtc_time *rtctime; | |||||
struct vm_rtc_data *rtcdata; | |||||
sc = vmmdev_lookup2(cdev); | sc = vmmdev_lookup2(cdev); | ||||
if (sc == NULL) | if (sc == NULL) | ||||
return (ENXIO); | return (ENXIO); | ||||
error = 0; | error = 0; | ||||
vcpu = -1; | vcpu = -1; | ||||
state_changed = 0; | state_changed = 0; | ||||
▲ Show 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, | ||||
case VM_SET_INTINFO: | case VM_SET_INTINFO: | ||||
vmii = (struct vm_intinfo *)data; | vmii = (struct vm_intinfo *)data; | ||||
error = vm_exit_intinfo(sc->vm, vmii->vcpuid, vmii->info1); | error = vm_exit_intinfo(sc->vm, vmii->vcpuid, vmii->info1); | ||||
break; | break; | ||||
case VM_GET_INTINFO: | case VM_GET_INTINFO: | ||||
vmii = (struct vm_intinfo *)data; | vmii = (struct vm_intinfo *)data; | ||||
error = vm_get_intinfo(sc->vm, vmii->vcpuid, &vmii->info1, | error = vm_get_intinfo(sc->vm, vmii->vcpuid, &vmii->info1, | ||||
&vmii->info2); | &vmii->info2); | ||||
break; | |||||
case VM_RTC_WRITE: | |||||
rtcdata = (struct vm_rtc_data *)data; | |||||
error = vrtc_nvram_write(sc->vm, rtcdata->offset, | |||||
rtcdata->value); | |||||
break; | |||||
case VM_RTC_READ: | |||||
rtcdata = (struct vm_rtc_data *)data; | |||||
error = vrtc_nvram_read(sc->vm, rtcdata->offset, | |||||
&rtcdata->value); | |||||
break; | |||||
case VM_RTC_SETTIME: | |||||
rtctime = (struct vm_rtc_time *)data; | |||||
error = vrtc_set_time(sc->vm, rtctime->secs); | |||||
break; | |||||
case VM_RTC_GETTIME: | |||||
error = 0; | |||||
rtctime = (struct vm_rtc_time *)data; | |||||
rtctime->secs = vrtc_get_time(sc->vm); | |||||
break; | break; | ||||
default: | default: | ||||
error = ENOTTY; | error = ENOTTY; | ||||
break; | break; | ||||
} | } | ||||
if (state_changed == 1) { | if (state_changed == 1) { | ||||
vcpu_set_state(sc->vm, vcpu, VCPU_IDLE, false); | vcpu_set_state(sc->vm, vcpu, VCPU_IDLE, false); | ||||
▲ Show 20 Lines • Show All 180 Lines • Show Last 20 Lines |