Move update of BIOS variable at 0x6c (time counter) completely to timer.c.
Suggested by: Igor Serikov <bt@turtle.pangeatech.com>
This commit is contained in:
parent
753d686d34
commit
f7448f4297
@ -8,16 +8,11 @@
|
||||
static void
|
||||
int08(regcontext_t *REGS)
|
||||
{
|
||||
struct timeval tv;
|
||||
time_t tv_sec;
|
||||
struct timezone tz;
|
||||
struct tm tm;
|
||||
|
||||
gettimeofday(&tv, &tz);
|
||||
tv_sec = tv.tv_sec;
|
||||
tm = *localtime(&tv_sec);
|
||||
*(u_long *)&BIOSDATA[0x6c] =
|
||||
(((tm.tm_hour * 60 + tm.tm_min) * 60) + tm.tm_sec) * 182 / 10;
|
||||
*(u_long *)&BIOSDATA[0x6c] += 1; /* ticks since midnight */
|
||||
while (*(u_long *)&BIOSDATA[0x6c] >= 24*60*6*182) {
|
||||
*(u_long *)&BIOSDATA[0x6c] -= 24*60*6*182;
|
||||
BIOSDATA[0x70]++; /* # times past mn */
|
||||
}
|
||||
|
||||
softint(0x1c);
|
||||
}
|
||||
@ -40,6 +35,10 @@ timer_init(void)
|
||||
{
|
||||
u_long vec;
|
||||
struct itimerval itv;
|
||||
struct timeval tv;
|
||||
time_t tv_sec;
|
||||
struct timezone tz;
|
||||
struct tm tm;
|
||||
|
||||
vec = insert_hardint_trampoline();
|
||||
ivec[0x08] = vec;
|
||||
@ -52,6 +51,13 @@ timer_init(void)
|
||||
define_input_port_handler(0x42, inb_timer);
|
||||
define_input_port_handler(0x40, inb_timer);
|
||||
|
||||
/* Initialize time counter BIOS variable. */
|
||||
gettimeofday(&tv, &tz);
|
||||
tv_sec = tv.tv_sec;
|
||||
tm = *localtime(&tv_sec);
|
||||
*(u_long *)&BIOSDATA[0x6c] =
|
||||
(((tm.tm_hour * 60 + tm.tm_min) * 60) + tm.tm_sec) * 182 / 10;
|
||||
|
||||
itv.it_interval.tv_sec = 0;
|
||||
itv.it_interval.tv_usec = 54925; /* 1193182/65536 times per second */
|
||||
itv.it_value.tv_sec = 0;
|
||||
|
@ -373,14 +373,6 @@ video_update(regcontext_t *REGS)
|
||||
else
|
||||
video_update_text();
|
||||
}
|
||||
|
||||
if (!booting) {
|
||||
*(u_long *)&BIOSDATA[0x6c] += 1; /* ticks since midnight */
|
||||
while (*(u_long *)&BIOSDATA[0x6c] >= 24*60*6*182) {
|
||||
*(u_long *)&BIOSDATA[0x6c] -= 24*60*6*182;
|
||||
BIOSDATA[0x70]++; /* # times past mn */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user