i386/134242: [patch] improvement i386 boot0 error diagnose

Rick van der Zwet info at rickvanderzwet.nl
Tue May 5 19:30:02 UTC 2009


>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 at 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:


More information about the freebsd-i386 mailing list