NetBSD Problem Report #40752

From jmcneill@black.invisible.ca  Wed Feb 25 00:46:58 2009
Return-Path: <jmcneill@black.invisible.ca>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 61F3563C1C0
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 25 Feb 2009 00:46:58 +0000 (UTC)
Message-Id: <20090225004656.D239B7D9FF4@black.invisible.ca>
Date: Tue, 24 Feb 2009 19:46:56 -0500 (EST)
From: jmcneill@invisible.ca
Reply-To: jmcneill@invisible.ca
To: gnats-bugs@gnats.NetBSD.org
Subject: x86 bootloader panic()/exit() loop
X-Send-Pr-Version: 3.95

>Number:         40752
>Category:       port-i386
>Synopsis:       x86 bootloader panic()/exit() loop
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 25 00:50:00 +0000 2009
>Last-Modified:  Thu Feb 26 15:05:02 +0000 2009
>Originator:     Jared D. McNeill
>Release:        NetBSD 5.99.7
>Organization:

>Environment:


System: NetBSD black.invisible.ca 5.99.7 NetBSD 5.99.7 (GENERIC) #60: Sat Feb 21 14:11:27 EST 2009 jmcneill@black.invisible.ca:/export/home/jmcneill/branches/HEAD/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	arch/i386/stand/lib/panic.c:panic() calls exit(0), and
	lib/libsa/exit.c:exit() calls panic("exit"). If the bootloader
	explodes it spits out an endless stream of "exit" messages on the
	console.
>How-To-Repeat:

>Fix:
	Change exit(0) call in i386 panic() to something like:

	for (;;) __asm volatile("hlt");

>Audit-Trail:
From: Andrew Doran <ad@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org
Subject: Re: port-i386/40752: x86 bootloader panic()/exit() loop
Date: Wed, 25 Feb 2009 09:15:51 +0000

 On Wed, Feb 25, 2009 at 12:50:01AM +0000, jmcneill@invisible.ca wrote:

 > 	for (;;) __asm volatile("hlt");

 'int 0x19' isn't enough?

 Andrew

From: "Jared D. McNeill" <jmcneill@invisible.ca>
To: gnats-bugs@NetBSD.org
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org, 
 netbsd-bugs@netbsd.org
Subject: Re: port-i386/40752: x86 bootloader panic()/exit() loop
Date: Wed, 25 Feb 2009 06:30:18 -0500

 Andrew Doran wrote:
 > The following reply was made to PR port-i386/40752; it has been noted by GNATS.
 > 
 > From: Andrew Doran <ad@netbsd.org>
 > To: gnats-bugs@NetBSD.org
 > Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org,
 > 	netbsd-bugs@netbsd.org
 > Subject: Re: port-i386/40752: x86 bootloader panic()/exit() loop
 > Date: Wed, 25 Feb 2009 09:15:51 +0000
 > 
 >  On Wed, Feb 25, 2009 at 12:50:01AM +0000, jmcneill@invisible.ca wrote:
 >  
 >  > 	for (;;) __asm volatile("hlt");
 >  
 >  'int 0x19' isn't enough?

 That's even better.

From: Matthias Drochner <M.Drochner@fz-juelich.de>
To: Andrew Doran <ad@NetBSD.org>
Cc: gnats-bugs@NetBSD.org, port-i386-maintainer@NetBSD.org,
	gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: port-i386/40752: x86 bootloader panic()/exit() loop 
Date: Wed, 25 Feb 2009 17:33:47 +0100

 This is a multipart MIME message.

 --==_Exmh_52932271007360
 Content-Type: text/plain; charset=us-ascii


 ad@NetBSD.org said:
 > > 	for (;;) __asm volatile("hlt");
 > 'int 0x19' isn't enough? 

 int 0x18! It is almost there -- formerly, the biosboot start
 code did define an "exit" entry point. This got lost when
 it was split into "bootxx" and "boot".
 The appended patch should fix things and even make the
 code a couple of bytes smaller.
 best regards
 Matthias





 -------------------------------------------------------------------
 -------------------------------------------------------------------
 Forschungszentrum Juelich GmbH
 52425 Juelich

 Sitz der Gesellschaft: Juelich
 Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
 Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
 Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
 Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
 Dr. Sebastian M. Schmidt
 -------------------------------------------------------------------
 -------------------------------------------------------------------

 --==_Exmh_52932271007360
 Content-Type: text/plain ; name="boot.txt"; charset=us-ascii
 Content-Description: boot.txt
 Content-Disposition: attachment; filename="boot.txt"

 #
 # old_revision [47c1df0d4767cb616c1f79cf6ce07dc5ed4f0714]
 #
 # patch "sys/arch/i386/stand/boot/Makefile.boot"
 #  from [d704724387418e1716e63943da1904f181aeb235]
 #    to [0b13bad190bc7441f15db09633bae419a5f0a2e1]
 # 
 # patch "sys/arch/i386/stand/boot/biosboot.S"
 #  from [01ce4fdd4987286ee7204ee0829b23322c104c22]
 #    to [7cc60a58ac155152ebf21bf705fc97d37d2bdd54]
 # 
 # patch "sys/arch/i386/stand/bootxx/Makefile.bootxx"
 #  from [b8395519a1fecd7a04efbb75771ecb10f2037d95]
 #    to [2d797d0ad8b873ee65a397615baae191e99cf289]
 # 
 # patch "sys/arch/i386/stand/bootxx/bootxx.S"
 #  from [ddd72d6658a6d76ef40032620ae8e86bd9193ff3]
 #    to [b539f3c0c113923705fcddb9dea1eca274edc9ce]
 # 
 # patch "sys/arch/i386/stand/bootxx/bootxx_ustarfs/Makefile"
 #  from [e1564bf8f91ef5f592532f32a87e403240921123]
 #    to [16bc843fd72ba897193528b6fca738f3e87f4c6f]
 #
 ============================================================
 --- sys/arch/i386/stand/boot/Makefile.boot	d704724387418e1716e63943da1904f181aeb235
 +++ sys/arch/i386/stand/boot/Makefile.boot	0b13bad190bc7441f15db09633bae419a5f0a2e1
 @@ -9,7 +9,7 @@ VERSIONFILE?= ${.CURDIR}/../version
  NEWVERSWHAT?= "BIOS Boot"
  VERSIONFILE?= ${.CURDIR}/../version

 -SOURCES?= biosboot.S boot2.c conf.c devopen.c exec.c
 +SOURCES?= biosboot.S boot2.c conf.c devopen.c exec.c panic.c
  SRCS= ${SOURCES}
  .if !make(depend)
  SRCS+= vers.c
 ============================================================
 --- sys/arch/i386/stand/boot/biosboot.S	01ce4fdd4987286ee7204ee0829b23322c104c22
 +++ sys/arch/i386/stand/boot/biosboot.S	7cc60a58ac155152ebf21bf705fc97d37d2bdd54
 @@ -127,7 +127,7 @@ 1:	.asciz	"Boot2 failed: "
  	jmp	loopstop
  1:	.asciz	"Boot2 failed: "

 -ENTRY(_rtt)
 +ENTRY(exit)
  	.code32
  	call	prot_to_real
  	.code16
 ============================================================
 --- sys/arch/i386/stand/bootxx/Makefile.bootxx	b8395519a1fecd7a04efbb75771ecb10f2037d95
 +++ sys/arch/i386/stand/bootxx/Makefile.bootxx	2d797d0ad8b873ee65a397615baae191e99cf289
 @@ -18,7 +18,7 @@ BOOTXX_MAXSIZE?= $$(( ${BOOTXX_SECTORS} 
  BOOTXX_SECTORS?=15
  BOOTXX_MAXSIZE?= $$(( ${BOOTXX_SECTORS} * 512 ))

 -SRCS= pbr.S label.S bootxx.S boot1.c
 +SRCS= pbr.S label.S bootxx.S boot1.c ${EXTRASRCS}

  .include <bsd.own.mk>

 ============================================================
 --- sys/arch/i386/stand/bootxx/bootxx.S	ddd72d6658a6d76ef40032620ae8e86bd9193ff3
 +++ sys/arch/i386/stand/bootxx/bootxx.S	b539f3c0c113923705fcddb9dea1eca274edc9ce
 @@ -105,7 +105,7 @@ 12:	.asciz	"xx): "
  11:	.ascii	"Boot failed (errno "
  12:	.asciz	"xx): "

 -ENTRY(_rtt)
 +ENTRY(exit)
  	.code32
  	call	prot_to_real
  	.code16
 ============================================================
 --- sys/arch/i386/stand/bootxx/bootxx_ustarfs/Makefile	e1564bf8f91ef5f592532f32a87e403240921123
 +++ sys/arch/i386/stand/bootxx/bootxx_ustarfs/Makefile	16bc843fd72ba897193528b6fca738f3e87f4c6f
 @@ -4,5 +4,6 @@ CPPFLAGS+=	-DSHOW_BANNER

  BOOTXX_SECTORS=16
  CPPFLAGS+=	-DSHOW_BANNER
 +EXTRASRCS=	panic.c

  .include <../Makefile.bootxx>

 --==_Exmh_52932271007360--

From: "Jared D. McNeill" <jmcneill@invisible.ca>
To: gnats-bugs@NetBSD.org
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org, 
 netbsd-bugs@netbsd.org
Subject: Re: port-i386/40752: x86 bootloader panic()/exit() loop
Date: Thu, 26 Feb 2009 08:48:31 -0500

 Matthias Drochner wrote:
 > The following reply was made to PR port-i386/40752; it has been noted by GNATS.
 > 
 > From: Matthias Drochner <M.Drochner@fz-juelich.de>
 > To: Andrew Doran <ad@NetBSD.org>
 > Cc: gnats-bugs@NetBSD.org, port-i386-maintainer@NetBSD.org,
 > 	gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
 > Subject: Re: port-i386/40752: x86 bootloader panic()/exit() loop 
 > Date: Wed, 25 Feb 2009 17:33:47 +0100
 > 
 >  This is a multipart MIME message.
 >  
 >  --==_Exmh_52932271007360
 >  Content-Type: text/plain; charset=us-ascii
 >  
 >  
 >  ad@NetBSD.org said:
 >  > > 	for (;;) __asm volatile("hlt");
 >  > 'int 0x19' isn't enough? 
 >  
 >  int 0x18! It is almost there -- formerly, the biosboot start
 >  code did define an "exit" entry point. This got lost when
 >  it was split into "bootxx" and "boot".
 >  The appended patch should fix things and even make the
 >  code a couple of bytes smaller.

 ``Ralf Brown's Interrupt List'' says about int 0x18:

 Notes: Very few PCs other than those produced by IBM contain BASIC in 
 ROM, so the action is unpredictable on compatibles; this interrupt often 
 reboots the system, and often has no effect at all.

 Is this typically the case today?

 Cheers,
 Jared

From: Matthias Drochner <M.Drochner@fz-juelich.de>
To: "Jared D. McNeill" <jmcneill@invisible.ca>
Cc: gnats-bugs@NetBSD.org, port-i386-maintainer@NetBSD.org,
	gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: port-i386/40752: x86 bootloader panic()/exit() loop 
Date: Thu, 26 Feb 2009 15:51:27 +0100

 jmcneill@invisible.ca said:
 > ``Ralf Brown's Interrupt List'' says about int 0x18: 
 > [...]

 There has been some research ~10 years ago when the
 boot code was reworked.
 PCs now usually try the next of the list of
 boot devices if a boot loader terminates with
 int 0x18, do the "press any key to reboot" prompt
 if none is left. So this would fit into the
 usual semantics.
 (This is only for biosboot; it only rarely works
 for network boot ROMs, and of course not from DOS.
 That's why the "exit" code needs to be booter
 specific rather than a generic library function.)

 best regards
 Matthias




 -------------------------------------------------------------------
 -------------------------------------------------------------------
 Forschungszentrum Juelich GmbH
 52425 Juelich

 Sitz der Gesellschaft: Juelich
 Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
 Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
 Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
 Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr. Harald Bolt,
 Dr. Sebastian M. Schmidt
 -------------------------------------------------------------------
 -------------------------------------------------------------------

From: "Jared D. McNeill" <jmcneill@invisible.ca>
To: gnats-bugs@NetBSD.org
Cc: port-i386-maintainer@netbsd.org, gnats-admin@netbsd.org, 
 netbsd-bugs@netbsd.org
Subject: Re: port-i386/40752: x86 bootloader panic()/exit() loop
Date: Thu, 26 Feb 2009 10:00:20 -0500

 Matthias Drochner wrote:
 > The following reply was made to PR port-i386/40752; it has been noted by GNATS.
 > 
 > From: Matthias Drochner <M.Drochner@fz-juelich.de>
 > To: "Jared D. McNeill" <jmcneill@invisible.ca>
 > Cc: gnats-bugs@NetBSD.org, port-i386-maintainer@NetBSD.org,
 > 	gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org
 > Subject: Re: port-i386/40752: x86 bootloader panic()/exit() loop 
 > Date: Thu, 26 Feb 2009 15:51:27 +0100
 > 
 >  jmcneill@invisible.ca said:
 >  > ``Ralf Brown's Interrupt List'' says about int 0x18: 
 >  > [...]
 >  
 >  There has been some research ~10 years ago when the
 >  boot code was reworked.
 >  PCs now usually try the next of the list of
 >  boot devices if a boot loader terminates with
 >  int 0x18, do the "press any key to reboot" prompt
 >  if none is left. So this would fit into the
 >  usual semantics.
 >  (This is only for biosboot; it only rarely works
 >  for network boot ROMs, and of course not from DOS.
 >  That's why the "exit" code needs to be booter
 >  specific rather than a generic library function.)

 Great. Is there a command at the boot prompt to do this as well? I can 
 see how that could come in handy.

 Cheers,
 Jared

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.