Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/vmm/io/vpmtmr.c
| Show All 23 Lines | |||||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||||
| */ | */ | ||||
| #include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
| __FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
| #include "opt_bhyve_snapshot.h" | |||||
| #include <sys/param.h> | #include <sys/param.h> | ||||
| #include <sys/queue.h> | #include <sys/queue.h> | ||||
| #include <sys/kernel.h> | #include <sys/kernel.h> | ||||
| #include <sys/malloc.h> | #include <sys/malloc.h> | ||||
| #include <sys/systm.h> | #include <sys/systm.h> | ||||
| #include <machine/vmm.h> | #include <machine/vmm.h> | ||||
| #include <machine/vmm_snapshot.h> | |||||
| #include "vpmtmr.h" | #include "vpmtmr.h" | ||||
| /* | /* | ||||
| * The ACPI Power Management timer is a free-running 24- or 32-bit | * The ACPI Power Management timer is a free-running 24- or 32-bit | ||||
| * timer with a frequency of 3.579545MHz | * timer with a frequency of 3.579545MHz | ||||
| * | * | ||||
| * This implementation will be 32-bits | * This implementation will be 32-bits | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | vpmtmr_handler(struct vm *vm, int vcpuid, bool in, int port, int bytes, | ||||
| now = sbinuptime(); | now = sbinuptime(); | ||||
| delta = now - vpmtmr->baseuptime; | delta = now - vpmtmr->baseuptime; | ||||
| KASSERT(delta >= 0, ("vpmtmr_handler: uptime went backwards: " | KASSERT(delta >= 0, ("vpmtmr_handler: uptime went backwards: " | ||||
| "%#lx to %#lx", vpmtmr->baseuptime, now)); | "%#lx to %#lx", vpmtmr->baseuptime, now)); | ||||
| *val = vpmtmr->baseval + delta / vpmtmr->freq_sbt; | *val = vpmtmr->baseval + delta / vpmtmr->freq_sbt; | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| #ifdef BHYVE_SNAPSHOT | |||||
| int | |||||
| vpmtmr_snapshot(struct vpmtmr *vpmtmr, struct vm_snapshot_meta *meta) | |||||
| { | |||||
| int ret; | |||||
| SNAPSHOT_VAR_OR_LEAVE(vpmtmr->baseval, meta, ret, done); | |||||
| done: | |||||
| return (ret); | |||||
| } | |||||
| #endif | |||||