Subject: Re: i386 bootselector changes
To: None <>
From: David Laight <>
List: current-users
Date: 10/30/2003 09:40:18
> > Switching the disks to be 1.. and the partitions to be F1.. will actually
> > give problems with the menu - it will take a few more bytes of code to
> > generate (you really don't want to know some of the details!)
> Is the menu generated, or static? I thought it was static, and you use 
> fdisk -b to update it. If it isn't, would it be easy to make it static?

The menu is generated by the boot program (it adds the "%d: " and "\r\n").

> If it's dynamic, I think it would also be fine to emit a space before the
> numbers if the partitions are still '1'. So that way the added code just
> loads a constant and prints it. While we'd still need the space for the
> constant and the call to the BIOS, we wouldn't need any conditionals.

The code actually relies on the number being at the start of the
'prefix' string.  Doing anything else costs several more bytes of code.

The relevant code is:

	/* output menu item */
	movw	$prefix, %si
	incb	(%si)
	call	message			/* menu number */
	mov	(%si), %si		/* ':' << 8 | '1' + count */
	shl	$2, %si			/* const + count * 4 */
#define	CONST	(4 * ((':' << 8) + '1' - ((SCAN_1 - SCAN_F1) & 0xff)))
	addl	lba_sector, %edi
	movl	%edi, ptn_list - CONST(%si)	/* sector to read */
prefix:	.asciz	"0: "

Later ptn_lst is indexed by the key code (after some numbers have
been subtracted for other tests).

> While it would be nice to have (the option of) F1 back, F1 vs 1 isn't 
> something that will change on the fly, so we can cut corners to keep 
> everything fitting in the needed space.

The corners have already been cut off :-)


David Laight: