summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2009-03-20 05:21:29 +0000
committernyan <nyan@FreeBSD.org>2009-03-20 05:21:29 +0000
commit3e77c602f84f4ca57843322309e4cadbb15ffa50 (patch)
tree407a2227d2659151ce48b83d8ceb569a883e85ca /sys/boot
parent895053fb73e8437f2bb9c15258104e0cac32eacf (diff)
downloadFreeBSD-src-3e77c602f84f4ca57843322309e4cadbb15ffa50.zip
FreeBSD-src-3e77c602f84f4ca57843322309e4cadbb15ffa50.tar.gz
MFi386: the part of r179825 to reduce diffs against i386.
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/pc98/libpc98/time.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/sys/boot/pc98/libpc98/time.c b/sys/boot/pc98/libpc98/time.c
index b8dbe02..5d832bb 100644
--- a/sys/boot/pc98/libpc98/time.c
+++ b/sys/boot/pc98/libpc98/time.c
@@ -33,23 +33,21 @@ __FBSDID("$FreeBSD$");
#include "bootstrap.h"
#include "libi386.h"
+static int bios_seconds(void);
+
/*
- * Return the time in seconds since the beginning of the day.
- *
- * If we pass midnight, don't wrap back to 0.
+ * Return the BIOS time-of-day value.
*
* XXX uses undocumented BCD support from libstand.
*/
-
-time_t
-time(time_t *t)
+static int
+bios_seconds(void)
{
- static time_t lasttime, now;
int hr, minute, sec;
unsigned char bios_time[6];
-
+
v86.ctl = 0;
- v86.addr = 0x1c; /* int 0x1c, function 0 */
+ v86.addr = 0x1c; /* int 0x1c, function 0 */
v86.eax = 0x0000;
v86.es = VTOPSEG(bios_time);
v86.ebx = VTOPOFF(bios_time);
@@ -59,7 +57,20 @@ time(time_t *t)
minute = bcd2bin(bios_time[4]);
sec = bcd2bin(bios_time[5]);
- now = hr * 3600 + minute * 60 + sec;
+ return (hr * 3600 + minute * 60 + sec);
+}
+
+/*
+ * Return the time in seconds since the beginning of the day.
+ */
+time_t
+time(time_t *t)
+{
+ static time_t lasttime;
+ time_t now;
+
+ now = bios_seconds();
+
if (now < lasttime)
now += 24 * 3600;
lasttime = now;
OpenPOWER on IntegriCloud