Subject: Re: port-i386/20451: biosboot.sym is broken (can't boot NetBSD)
To: None <netbsd-bugs@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: netbsd-bugs
Date: 02/21/2003 07:52:42
> Recent biosboot.sym seems to be broken. If it is installed, my
> machine can't boot NetBSD. (sometimes boot, but easily panic!)
> I'm using mbr_bootsel (fdisk -B) boot selecter.
Some questions:
Exactly how far does it get?
Which messages (if any) do you see?
Can you interrupt the countdown?
Oh, and try the patch below.
David
Index: start_bootsect.S
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/lib/crt/bootsect/start_bootsect.S,v
retrieving revision 1.19
diff -u -r1.19 start_bootsect.S
--- start_bootsect.S 2003/02/01 14:48:18 1.19
+++ start_bootsect.S 2003/02/20 18:51:09
@@ -462,6 +462,11 @@
bootrealseg = . - gdt
.word 0xffff, 0
.byte 0, 0x9e, 0x00, 0
+
+ /* limits (etc) for data segment in real mode */
+bootrealdata = . - gdt
+ .word 0xffff, 0
+ .byte 0, 0x92, 0x00, 0
gdtlen = . - gdt
#ifdef __ELF__
@@ -527,13 +532,11 @@
movw $efail, %si
call message
-#if 1
/* call ROM BASIC */
int $0x18
-#else
cli
- hlt
-#endif
+1: hlt
+ jmp 1b
efail: .asciz "Boot fail\r\n"
CR0_PE = 0x1
@@ -542,7 +545,7 @@
* real_to_prot()
* transfer from real mode to protected mode.
* NB: Call with the 32bit calll instruction so that a 32 bit
- * return address is pushed (using a 32bit %esp).
+ * return address is pushed.
*/
ENTRY(real_to_prot)
.code16
@@ -594,6 +597,16 @@
movl ourseg, %eax
movw %ax, xreal-2
+
+ /*
+ * Load the segment registers while still in protected mode.
+ * Otherwise the control bits don't get changed.
+ * The correct values are loaded later.
+ */
+ movw $bootrealdata, %ax
+ movw %ax, %ds
+ movw %ax, %es
+ movw %ax, %ss
# Change to use16 mode.
ljmp $bootrealseg, $x16
--
David Laight: david@l8s.co.uk