Subject: Re: boot loader timeout under qemu
To: Alan Barrett <apb@cequrux.com>
From: Rui Paulo <rpaulo@NetBSD.org>
List: port-i386
Date: 08/06/2005 12:41:46
On 2005.08.06 13:32:38 +0000, Alan Barrett wrote:
| When booting an i386 system in a virtual machine under qemu
| (pkgsrc/emulators/qemu), the second stage boot loader's timeout expires
| much too quickly.  If I set the timeout to 6000 seconds (via installboot
| -o timeout=6000), then I observe it counting down at about 100 counts
| per second, instead of 1 count per second.
| 
| sys/arch/i386/stand/boot/boot2.c:boot2() prints "Press return
| to boot now, any other key for boot menu", and then calls
| awaitkey(boot_params.bp_timeout, 1).  I have verified that
| boot_params.bp_timeout is correct.
| 
| sys/arch/i386/stand/lib/pcio.c:awaitkey() calls delay() to delay for
| 1/POLL_FREQ seconds, and POLL_FREQ = 10, so it calls delay(100000).
| 
| I think that the boot code is linked with the version of delay() from
| sys/arch/i386/stand/lib/biosdelay.S, not the "#define delay(x)
| (*delay_func)(x)" from sys/arch/i386/include/cpu.h.  
| 
| sys/arch/i386/stand/lib/biosdelay.S:delay() uses BIOS call "INT 15H
| Function 86H".
| 
| As far as I can tell, qemu attempts to provide the INT 15H
| function 86H BIOS call. qemu uses a BIOS from bochs, and
| pkgsrc/emulators/bochs/work/bochs-2.1.1/bios/rombios.c 3356 contains an
| implementation of the relevant function.  The BIOS in qemu seems to be
| based on a more recent version of bochs (qemu-0.7.0 seems to contain a
| BIOS built from rombios.c revision 1.130, according to strings; while
| bochs-2.1.1 has rombios.c revision 1.103.2.2).
| 
| So, what's wrong, and how can it be fixed?

I think this is not a NetBSD problem, unless you only experience it
when running qemu on top of NetBSD. I've had some problems with
how qemu emulates the clock device, so I'm not really surprised.

Did you tried other operating systems ? What happened ?

		-- Rui Paulo