Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174993103
D60430.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D60430.diff
View Options
diff --git a/sys/amd64/vmm/io/vpmtmr.c b/sys/amd64/vmm/io/vpmtmr.c
--- a/sys/amd64/vmm/io/vpmtmr.c
+++ b/sys/amd64/vmm/io/vpmtmr.c
@@ -50,7 +50,6 @@
#define PMTMR_FREQ 3579545 /* 3.579545MHz */
struct vpmtmr {
- sbintime_t freq_sbt;
sbintime_t baseuptime;
uint32_t baseval;
};
@@ -61,15 +60,11 @@
vpmtmr_init(struct vm *vm)
{
struct vpmtmr *vpmtmr;
- struct bintime bt;
vpmtmr = malloc(sizeof(struct vpmtmr), M_VPMTMR, M_WAITOK | M_ZERO);
vpmtmr->baseuptime = sbinuptime();
vpmtmr->baseval = 0;
- FREQ2BT(PMTMR_FREQ, &bt);
- vpmtmr->freq_sbt = bttosbt(bt);
-
return (vpmtmr);
}
@@ -99,7 +94,13 @@
delta = now - vpmtmr->baseuptime;
KASSERT(delta >= 0, ("vpmtmr_handler: uptime went backwards: "
"%#lx to %#lx", vpmtmr->baseuptime, now));
- *val = vpmtmr->baseval + delta / vpmtmr->freq_sbt;
+ /*
+ * delta is in seconds as 32.32 fixed point; multiply each half by the
+ * frequency rather than divide by the period, which is not a whole
+ * number of sbintime units.
+ */
+ *val = vpmtmr->baseval + (uint64_t)(delta >> 32) * PMTMR_FREQ +
+ (((uint64_t)delta & 0xffffffff) * PMTMR_FREQ >> 32);
return (0);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 8, 11:40 AM (17 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40407328
Default Alt Text
D60430.diff (1 KB)
Attached To
Mode
D60430: vmm: compute the ACPI PM timer value without a lossy division
Attached
Detach File
Event Timeline
Log In to Comment