From owner-freebsd-i386@FreeBSD.ORG Tue May 5 19:30:01 2009 Return-Path: Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0482106564A for ; Tue, 5 May 2009 19:30:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 9BE0F8FC1B for ; Tue, 5 May 2009 19:30:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n45JU1Yf055423 for ; Tue, 5 May 2009 19:30:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n45JU1Dc055420; Tue, 5 May 2009 19:30:01 GMT (envelope-from gnats) Resent-Date: Tue, 5 May 2009 19:30:01 GMT Resent-Message-Id: <200905051930.n45JU1Dc055420@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-i386@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Rick van der Zwet Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89B2C106564A for ; Tue, 5 May 2009 19:26:35 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 782198FC13 for ; Tue, 5 May 2009 19:26:35 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n45JQZ3Y045957 for ; Tue, 5 May 2009 19:26:35 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n45JQYtu045956; Tue, 5 May 2009 19:26:34 GMT (envelope-from nobody) Message-Id: <200905051926.n45JQYtu045956@www.freebsd.org> Date: Tue, 5 May 2009 19:26:34 GMT From: Rick van der Zwet To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: i386/134242: [patch] improvement i386 boot0 error diagnose X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2009 19:30:02 -0000 >Number: 134242 >Category: i386 >Synopsis: [patch] improvement i386 boot0 error diagnose >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-i386 >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue May 05 19:30:01 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Rick van der Zwet >Release: RELENG_7_2 >Organization: Stichting Wireless Leiden >Environment: FreeBSD virbsd 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 14:37:25 UTC 2009 root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 (build machine) >Description: While booting it is not clear what kind of error is encountered. Is there an input error, read error or something else? This small patch suggest a few additions to the error handling (enabled during compile time) >How-To-Repeat: Boot a machine and just see one '#' appearing and try to guess if the error is the input device (serial,ps/2, usb keyboard),wrongly pressed key, disk read error or misconfiguration in boot block 'magic'. >Fix: Patch attached. Patch attached with submission follows: # For the use of debugging boot0 related issues, using special beeps (or hashes) # for every error: # 1x = Not F1 .. F5 pressed (if force checked) # 2x = Option not enabled (invalid input) # 3x = Sector read error # 4x = Bootable flag not set --- /usr/src/sys/boot/i386/boot0/boot0.S 2009-04-15 03:14:26.000000000 +0000 +++ boot0.S 2009-05-05 14:59:44.000000000 +0000 @@ -43,6 +43,11 @@ #define SAVE_MORE_MEMORY #endif +#ifdef DEBUG_USING_BEEP +#define SAVE_MEMORY +#define SAVE_MORE_MEMORY +#endif + /* * Note - this code uses many tricks to save space and fit in one sector. * This includes using side effects of certain instructions, reusing @@ -338,7 +343,16 @@ /* * Here we have the code waiting for user input or a timeout. + * XXX: To compile correctly */ +#ifdef DEBUG_USING_BEEP +beep4: movb $ASCII_BEL,%al # Input error, print or beep + callw putchr +beep3: movb $ASCII_BEL,%al # Input error, print or beep + callw putchr +beep2: movb $ASCII_BEL,%al # Input error, print or beep + callw putchr +#endif beep: movb $ASCII_BEL,%al # Input error, print or beep callw putchr @@ -429,7 +443,11 @@ */ cbtw # Extend (%ah=0 used later) btw %ax,_MNUOPT(%bp) # Option enabled? - jnc beep # No +#ifdef DEBUG_USING_BEEP + jnc beep2 # No +#else + jnc beep # No +#endif /* * Save the info in the original tables * for rewriting to the disk. @@ -486,9 +504,17 @@ 3: movw $LOAD,%bx # Address for read movb $0x2,%ah # Read sector callw intx13 # from disk - jc beep # If error +#ifdef DEBUG_USING_BEEP + jc beep3 # If error +#else + jc beep # If error +#endif cmpw $MAGIC,0x1fe(%bx) # Bootable? - jne beep # No +#ifdef DEBUG_USING_BEEP + jne beep4 # No +#else + jne beep # No +#endif pushw %si # Save ptr to selected part. callw putn # Leave some space popw %si # Restore, next stage uses it >Release-Note: >Audit-Trail: >Unformatted: