Module Name: src
Committed By: tsutsui
Date: Fri Jun 25 15:35:08 UTC 2010
Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c exec.c libi386.h pcio.c vbe.c
Log Message:
Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).
No particular comments on the PR and port-i...@.
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/i386/stand/lib/biosdisk.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/i386/stand/lib/exec.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/i386/stand/lib/libi386.h
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/i386/stand/lib/pcio.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/lib/vbe.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.30 src/sys/arch/i386/stand/lib/biosdisk.c:1.31
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.30 Tue Oct 20 14:49:03 2009
+++ src/sys/arch/i386/stand/lib/biosdisk.c Fri Jun 25 15:35:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: biosdisk.c,v 1.30 2009/10/20 14:49:03 jmcneill Exp $ */
+/* $NetBSD: biosdisk.c,v 1.31 2010/06/25 15:35:08 tsutsui Exp $ */
/*
* Copyright (c) 1996, 1998
@@ -509,7 +509,7 @@
/* let the floppy drive go off */
if (d->ll.type == BIOSDISK_TYPE_FD)
- delay(3000000); /* 2s is enough on all PCs I found */
+ wait_sec(3); /* 2s is enough on all PCs I found */
dealloc(d, sizeof(struct biosdisk));
f->f_devdata = NULL;
Index: src/sys/arch/i386/stand/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.42 src/sys/arch/i386/stand/lib/exec.c:1.43
--- src/sys/arch/i386/stand/lib/exec.c:1.42 Mon Sep 14 11:56:27 2009
+++ src/sys/arch/i386/stand/lib/exec.c Fri Jun 25 15:35:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.42 2009/09/14 11:56:27 jmcneill Exp $ */
+/* $NetBSD: exec.c,v 1.43 2010/06/25 15:35:08 tsutsui Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -125,7 +125,7 @@
#define PAGE_SIZE 4096
#endif
-#define MODULE_WARNING_DELAY 5000000
+#define MODULE_WARNING_SEC 5
extern struct btinfo_console btinfo_console;
@@ -486,7 +486,7 @@
btinfo_modulelist = alloc(len);
if (btinfo_modulelist == NULL) {
printf("WARNING: couldn't allocate module list\n");
- delay(MODULE_WARNING_DELAY);
+ wait_sec(MODULE_WARNING_SEC);
return;
}
memset(btinfo_modulelist, 0, len);
@@ -530,7 +530,7 @@
printf("WARNING: %d module%s failed to load\n",
nfail, nfail == 1 ? "" : "s");
#if notyet
- delay(MODULE_WARNING_DELAY);
+ wait_sec(MODULE_WARNING_SEC);
#endif
}
}
Index: src/sys/arch/i386/stand/lib/libi386.h
diff -u src/sys/arch/i386/stand/lib/libi386.h:1.32 src/sys/arch/i386/stand/lib/libi386.h:1.33
--- src/sys/arch/i386/stand/lib/libi386.h:1.32 Sun Sep 13 22:45:27 2009
+++ src/sys/arch/i386/stand/lib/libi386.h Fri Jun 25 15:35:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: libi386.h,v 1.32 2009/09/13 22:45:27 jmcneill Exp $ */
+/* $NetBSD: libi386.h,v 1.33 2010/06/25 15:35:08 tsutsui Exp $ */
/*
* Copyright (c) 1996
@@ -69,6 +69,7 @@
#define CONSDEV_AUTO (-1)
int iskey(int);
char awaitkey(int, int);
+void wait_sec(int);
/* this is in "user code"! */
int parsebootfile(const char *, char **, char **, int *, int *, const char **);
Index: src/sys/arch/i386/stand/lib/pcio.c
diff -u src/sys/arch/i386/stand/lib/pcio.c:1.27 src/sys/arch/i386/stand/lib/pcio.c:1.28
--- src/sys/arch/i386/stand/lib/pcio.c:1.27 Wed Aug 26 13:28:48 2009
+++ src/sys/arch/i386/stand/lib/pcio.c Fri Jun 25 15:35:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: pcio.c,v 1.27 2009/08/26 13:28:48 jmcneill Exp $ */
+/* $NetBSD: pcio.c,v 1.28 2010/06/25 15:35:08 tsutsui Exp $ */
/*
* Copyright (c) 1996, 1997
@@ -371,3 +371,10 @@
return c;
}
+
+void
+wait_sec(int sec)
+{
+
+ wait(sec * 1000000);
+}
Index: src/sys/arch/i386/stand/lib/vbe.c
diff -u src/sys/arch/i386/stand/lib/vbe.c:1.5 src/sys/arch/i386/stand/lib/vbe.c:1.6
--- src/sys/arch/i386/stand/lib/vbe.c:1.5 Tue Oct 20 14:47:33 2009
+++ src/sys/arch/i386/stand/lib/vbe.c Fri Jun 25 15:35:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: vbe.c,v 1.5 2009/10/20 14:47:33 jmcneill Exp $ */
+/* $NetBSD: vbe.c,v 1.6 2010/06/25 15:35:08 tsutsui Exp $ */
/*-
* Copyright (c) 2009 Jared D. McNeill <[email protected]>
@@ -172,7 +172,7 @@
if (ret) {
printf("WARNING: failed to set VBE mode 0x%x\n",
vbestate.modenum);
- delay(5000000);
+ wait_sec(5);
}
}
return ret;