Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/vmm/io/vatpit.c
Show All 32 Lines | |||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <machine/vmm.h> | #include <machine/vmm.h> | ||||
#include <machine/vmm_snapshot.h> | |||||
#include "vmm_ktr.h" | #include "vmm_ktr.h" | ||||
#include "vatpic.h" | #include "vatpic.h" | ||||
#include "vioapic.h" | #include "vioapic.h" | ||||
#include "vatpit.h" | #include "vatpit.h" | ||||
static MALLOC_DEFINE(M_VATPIT, "atpit", "bhyve virtual atpit (8254)"); | static MALLOC_DEFINE(M_VATPIT, "atpit", "bhyve virtual atpit (8254)"); | ||||
▲ Show 20 Lines • Show All 400 Lines • ▼ Show 20 Lines | |||||
vatpit_cleanup(struct vatpit *vatpit) | vatpit_cleanup(struct vatpit *vatpit) | ||||
{ | { | ||||
int i; | int i; | ||||
for (i = 0; i < 3; i++) | for (i = 0; i < 3; i++) | ||||
callout_drain(&vatpit->channel[i].callout); | callout_drain(&vatpit->channel[i].callout); | ||||
free(vatpit, M_VATPIT); | free(vatpit, M_VATPIT); | ||||
} | |||||
int | |||||
vatpit_snapshot(struct vatpit *vatpit, struct vm_snapshot_meta *meta) | |||||
{ | |||||
int ret; | |||||
int i; | |||||
struct channel *channel; | |||||
SNAPSHOT_VAR_OR_LEAVE(vatpit->freq_sbt, meta, ret, done); | |||||
/* properly restore timers; they will NOT work currently */ | |||||
printf("%s: snapshot restore does not reset timers!\r\n", __func__); | |||||
for (i = 0; i < nitems(vatpit->channel); i++) { | |||||
channel = &vatpit->channel[i]; | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->mode, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->initial, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->now_sbt, meta, ret, done); | |||||
SNAPSHOT_BUF_OR_LEAVE(channel->cr, sizeof(channel->cr), | |||||
meta, ret, done); | |||||
SNAPSHOT_BUF_OR_LEAVE(channel->ol, sizeof(channel->ol), | |||||
meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->slatched, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->status, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->crbyte, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->frbyte, meta, ret, done); | |||||
SNAPSHOT_VAR_OR_LEAVE(channel->callout_sbt, meta, ret, done); | |||||
} | |||||
done: | |||||
return (ret); | |||||
} | } |