Re: kern/66248: [panic] bootloader is confused by booting from USB flash, trashes main drives boot block

From: Julian Elischer <julian_at_elischer.org>
Date: Wed, 05 Jan 2005 16:17:58 -0800
Peter Edwards wrote:

>The following reply was made to PR kern/66248; it has been noted by GNATS.
>
>From: Peter Edwards <peadar_at_freebsd.org>
>To: freebsd-gnats-submit_at_FreeBSD.org, bremner_at_unb.ca
>Cc: julian_at_elischer.org, imp_at_bsdimp.org
>Subject: Re: kern/66248: [panic] bootloader is confused by booting from USB
> flash, trashes main drives boot block
>Date: Wed, 05 Jan 2005 20:53:02 +0000
>
> This is a multi-part message in MIME format.
> --------------070200040205060401080901
> Content-Type: text/plain; charset=us-ascii; format=flowed
> Content-Transfer-Encoding: 7bit
> 
> The following patch, applied before the one above, shrinks boot0 enough 
> to squeeze the previous patch in without undeffing the BEL stuff.
> 
> FWIW: The patch to fix the bug looks good to me.
> I someone gives a go-ahead, I'll commit a combined patch: I certainly 
> don't want to make a commit to boot0 and have half the FreeBSD community 
> left without a bootable machine, unless I can pass the book :-)
>

you can pass the book here, but I don't need that buck..

> 
> 
> --------------070200040205060401080901
> Content-Type: text/plain;
>  name="boot0.smaller.patch"
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline;
>  filename="boot0.smaller.patch"
> 
> Index: boot0.S
> ===================================================================
> RCS file: /usr/cvs/FreeBSD-CVS/src/sys/boot/i386/boot0/boot0.S,v
> retrieving revision 1.12
> diff -u -w -r1.12 boot0.S
> --- boot0.S	24 Nov 2004 15:39:04 -0000	1.12
> +++ boot0.S	5 Jan 2005 20:44:32 -0000
> _at__at_ -29,7 +29,7 _at__at_
>  		.set PRT_OFF,0x1be		# Partition table
>  
>  		.set TBL0SZ,0x3 		# Table 0 size
> -		.set TBL1SZ,0xb 		# Table 1 size
> +		.set TBL1SZ,0xc 		# Table 1 size
>  
>  		.set MAGIC,0xaa55		# Magic: bootable
>  		.set B0MAGIC,0xbb66		# Identification
> _at__at_ -148,13 +148,8 _at__at_
>  		movb $TBL1SZ,%cl		# Number of entries
>  		repne				# Known
>  		scasb				#  type?
> -		jne main.4			# No
> -/*
> - * If it matches get the matching element in the next array.  If it doesn't,
> - * we are already pointing at its first element which points to a "?".
> - */
> -		addw $TBL1SZ,%di		# Adjust
> -main.4:		movb (%di),%cl			# Partition
> +		addw $TBL1SZ - 1, %di		# Adjust
> +		movb (%di),%cl			# Partition
>  		addw %cx,%di			#  description
>  		callw putx			# Display it
>  main.5:		incw %dx			# Next item
> _at__at_ -314,8 +309,7 _at__at_
>  		cmpw $MAGIC,0x1fe(%bx)		# Bootable?
>  		jne main.10			# No
>  		pushw %si			# Save
> -		movw $crlf,%si			# Leave some
> -		callw puts			#  space
> +		callw putn			# Leave some space
>  		popw %si			# Restore
>  		jmp *%bx			# Invoke bootstrap
>  
> _at__at_ -408,14 +402,14 _at__at_
>  		.byte 0x0, 0x5, 0xf
>  /*
>   * These values indicate bootable types we know the names of.
> + * The value of the last entry is unimportant: it indicates "everything else"
>   */
>  		.byte 0x1, 0x4, 0x6, 0xb, 0xc, 0xe, 0x83
> -		.byte 0x9f, 0xa5, 0xa6, 0xa9
> +		.byte 0x9f, 0xa5, 0xa6, 0xa9, 0xff
>  /*
>   * These are offsets that match the known names above and point to the strings
>   * that will be printed.
>   */
> -		.byte os_misc-. 		# Unknown
>  		.byte os_dos-.			# DOS
>  		.byte os_dos-.			# DOS
>  		.byte os_dos-.			# DOS
> _at__at_ -427,6 +421,7 _at__at_
>  		.byte os_freebsd-.		# FreeBSD
>  		.byte os_bsd-.			# OpenBSD
>  		.byte os_bsd-.			# NetBSD
> +		.byte os_misc-. 		# Unknown
>  /*
>   * And here are the strings themselves. 0x80 or'd into a byte indicates
>   * the end of the string. (not so great for Russians but...)
> 
> --------------070200040205060401080901--
>_______________________________________________
>freebsd-usb_at_freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/freebsd-usb
>To unsubscribe, send any mail to "freebsd-usb-unsubscribe_at_freebsd.org"
>  
>
Received on Wed Jan 05 2005 - 23:17:59 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:25 UTC