summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bhyve
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2013-09-19 04:29:03 +0000
committergrehan <grehan@FreeBSD.org>2013-09-19 04:29:03 +0000
commitbc1d6700f21955a8477239bfa33a11db0f8917c8 (patch)
tree48f03263479f9a1d6970ff943174edc0d3c908e5 /usr.sbin/bhyve
parent6f44e4d05bfebf51480d9cadbad13bbce97a539b (diff)
downloadFreeBSD-src-bc1d6700f21955a8477239bfa33a11db0f8917c8.zip
FreeBSD-src-bc1d6700f21955a8477239bfa33a11db0f8917c8.tar.gz
Allow the alarm hours/mins/seconds registers to be read/written,
though without any action. This avoids a hypervisor exit when o/s's access these regs (Linux). Reviewed by: neel Approved by: re@ (blanket)
Diffstat (limited to 'usr.sbin/bhyve')
-rw-r--r--usr.sbin/bhyve/rtc.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/usr.sbin/bhyve/rtc.c b/usr.sbin/bhyve/rtc.c
index 05542e7..e2b9f30 100644
--- a/usr.sbin/bhyve/rtc.c
+++ b/usr.sbin/bhyve/rtc.c
@@ -46,8 +46,11 @@ __FBSDID("$FreeBSD$");
#define IO_RTC 0x70
#define RTC_SEC 0x00 /* seconds */
+#define RTC_SEC_ALARM 0x01
#define RTC_MIN 0x02
+#define RTC_MIN_ALARM 0x03
#define RTC_HRS 0x04
+#define RTC_HRS_ALARM 0x05
#define RTC_WDAY 0x06
#define RTC_DAY 0x07
#define RTC_MONTH 0x08
@@ -94,6 +97,12 @@ static uint8_t rtc_nvram[RTC_NVRAM_SZ];
/* XXX initialize these to default values as they would be from BIOS */
static uint8_t status_a, status_b;
+static struct {
+ uint8_t hours;
+ uint8_t mins;
+ uint8_t secs;
+} rtc_alarm;
+
static u_char const bin2bcd_data[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19,
@@ -148,8 +157,11 @@ rtc_addr_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
switch (*eax & 0x7f) {
case RTC_SEC:
+ case RTC_SEC_ALARM:
case RTC_MIN:
+ case RTC_MIN_ALARM:
case RTC_HRS:
+ case RTC_HRS_ALARM:
case RTC_WDAY:
case RTC_DAY:
case RTC_MONTH:
@@ -199,6 +211,15 @@ rtc_data_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
if (in) {
switch (addr) {
+ case RTC_SEC_ALARM:
+ *eax = rtc_alarm.secs;
+ break;
+ case RTC_MIN_ALARM:
+ *eax = rtc_alarm.mins;
+ break;
+ case RTC_HRS_ALARM:
+ *eax = rtc_alarm.hours;
+ break;
case RTC_SEC:
*eax = rtcout(tm.tm_sec);
return (0);
@@ -266,6 +287,15 @@ rtc_data_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes,
case RTC_STATUSD:
/* ignore write */
break;
+ case RTC_SEC_ALARM:
+ rtc_alarm.secs = *eax;
+ break;
+ case RTC_MIN_ALARM:
+ rtc_alarm.mins = *eax;
+ break;
+ case RTC_HRS_ALARM:
+ rtc_alarm.hours = *eax;
+ break;
case RTC_SEC:
case RTC_MIN:
case RTC_HRS:
OpenPOWER on IntegriCloud