From c71b9b3c243ff11f44a801c129f18ce32a2a3622 Mon Sep 17 00:00:00 2001 From: Robert Nordier Date: Tue, 13 Oct 1998 22:17:05 +0000 Subject: [PATCH] Adjust NDEV value. Optimize reading of system time. --- sys/boot/i386/boot2/boot2.c | 19 ++++++++----------- sys/boot/i386/gptboot/gptboot.c | 19 ++++++++----------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c index a715d76a93b3..2845ada6e7a2 100644 --- a/sys/boot/i386/boot2/boot2.c +++ b/sys/boot/i386/boot2/boot2.c @@ -14,7 +14,7 @@ */ /* - * $Id: boot2.c,v 1.2 1998/10/13 17:41:06 rnordier Exp $ + * $Id: boot2.c,v 1.3 1998/10/13 21:35:42 rnordier Exp $ */ #include @@ -51,7 +51,7 @@ #define ARGS 0x800 #define NOPT 8 #define BSIZEMAX 8192 -#define NDEV 3 +#define NDEV 5 #define MEM_BASE 0x12 #define MEM_EXT 0x15 #define V86_CY(x) ((x) & 1) @@ -712,22 +712,19 @@ drvread(void *buf, unsigned lba, unsigned nblk) static int keyhit(unsigned ticks) { - uint32_t x; + uint32_t t0, t1; - x = 0; + t0 = 0; for (;;) { v86.addr = 0x16; v86.eax = 0x100; v86int(); if (!V86_ZR(v86.efl)) return 1; - v86.addr = 0x1a; - v86.eax = 0; - v86.edx = 0; - v86int(); - if (!x) - x = v86.edx; - else if (v86.edx < x || v86.edx > x + ticks) + t1 = *(uint32_t *)PTOV(0x46c); + if (!t0) + t0 = t1; + if (t1 < t0 || t1 >= t0 + ticks) return 0; } } diff --git a/sys/boot/i386/gptboot/gptboot.c b/sys/boot/i386/gptboot/gptboot.c index a715d76a93b3..2845ada6e7a2 100644 --- a/sys/boot/i386/gptboot/gptboot.c +++ b/sys/boot/i386/gptboot/gptboot.c @@ -14,7 +14,7 @@ */ /* - * $Id: boot2.c,v 1.2 1998/10/13 17:41:06 rnordier Exp $ + * $Id: boot2.c,v 1.3 1998/10/13 21:35:42 rnordier Exp $ */ #include @@ -51,7 +51,7 @@ #define ARGS 0x800 #define NOPT 8 #define BSIZEMAX 8192 -#define NDEV 3 +#define NDEV 5 #define MEM_BASE 0x12 #define MEM_EXT 0x15 #define V86_CY(x) ((x) & 1) @@ -712,22 +712,19 @@ drvread(void *buf, unsigned lba, unsigned nblk) static int keyhit(unsigned ticks) { - uint32_t x; + uint32_t t0, t1; - x = 0; + t0 = 0; for (;;) { v86.addr = 0x16; v86.eax = 0x100; v86int(); if (!V86_ZR(v86.efl)) return 1; - v86.addr = 0x1a; - v86.eax = 0; - v86.edx = 0; - v86int(); - if (!x) - x = v86.edx; - else if (v86.edx < x || v86.edx > x + ticks) + t1 = *(uint32_t *)PTOV(0x46c); + if (!t0) + t0 = t1; + if (t1 < t0 || t1 >= t0 + ticks) return 0; } }