Port-i386 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-i386/43156: NetBSD bootloader countdown runs at 1/20 speed in qemu 0.12



Hi,

Is there any objection to commiting this bootloader changes for QEMU
in PR port-i386/43156?
---
Izumi Tsutsui

--- original message ---

> >Synopsis:       NetBSD bootloader countdown runs at 1/20 speed in qemu 0.12

> After upgrading the qemu package to version 0.12, the bootloader
> countdown in a qemu emulated NetBSD system takes about 20 times longer
> than it should, counting down by one every 20 seconds instead of every
> second, taking a total of 100 seconds to count down from five.

Probably BIOS in the new QEMU distribution implements a BIOS function call
INT 15h/AH=86h (WAIT), but the emulation takes more time than it should
on long delays.

Fixing BIOS package in QEMU is not so easy so it would be better
to apply workaround using INT 1Ah/AH=00h (GET SYSTEMTIME)
as used to fix the similar countdown speed issue:
http://mail-index.NetBSD.org/source-changes/2009/08/26/msg000190.html

The attached diff seems working for me but I wonder if we should have
more common API to wait specified seconds in libsa...

Index: lib/biosdisk.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/biosdisk.c,v
retrieving revision 1.30
diff -u -r1.30 biosdisk.c
--- lib/biosdisk.c      20 Oct 2009 14:49:03 -0000      1.30
+++ lib/biosdisk.c      9 May 2010 10:31:14 -0000
@@ -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: lib/exec.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/exec.c,v
retrieving revision 1.42
diff -u -r1.42 exec.c
--- lib/exec.c  14 Sep 2009 11:56:27 -0000      1.42
+++ lib/exec.c  9 May 2010 10:31:14 -0000
@@ -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: lib/libi386.h
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/libi386.h,v
retrieving revision 1.32
diff -u -r1.32 libi386.h
--- lib/libi386.h       13 Sep 2009 22:45:27 -0000      1.32
+++ lib/libi386.h       9 May 2010 10:31:14 -0000
@@ -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: lib/pcio.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/pcio.c,v
retrieving revision 1.27
diff -u -r1.27 pcio.c
--- lib/pcio.c  26 Aug 2009 13:28:48 -0000      1.27
+++ lib/pcio.c  9 May 2010 10:31:14 -0000
@@ -371,3 +371,10 @@
 
        return c;
 }
+
+void
+wait_sec(int sec)
+{
+
+       wait(sec * 1000000);
+}
Index: lib/vbe.c
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/vbe.c,v
retrieving revision 1.5
diff -u -r1.5 vbe.c
--- lib/vbe.c   20 Oct 2009 14:47:33 -0000      1.5
+++ lib/vbe.c   9 May 2010 10:31:14 -0000
@@ -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;

---


Home | Main Index | Thread Index | Old Index