Subject: Re: mbr_bootsel timer code incorrect.
To: None <port-i386@netbsd.org>
From: David Laight <David.Laight@btinternet.com>
List: port-i386
Date: 12/07/2001 17:48:46
This is a multi-part message in MIME format.

------=_NextPart_000_0493_01C17F47.6BBAE2E0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit


> send-pr this?

Did it a while ago port-i386/14748 (I think) after testing the fix!

I've attacted the full diff -c to this mail
(John W had objected to the cut one I put in the original report)
It is all a bit tedious since I can't (yet) email out of netbsd
- setting up sendmail (correctly) usually requires the book, it also
would really like a proper domain name.

There are also some associated fixes/changes to fdisk I might sort out.

    David




------=_NextPart_000_0493_01C17F47.6BBAE2E0
Content-Type: application/octet-stream;
	name="mbr.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="mbr.diff"

*** mbr_bootsel.S	Tue Nov 27 12:09:59 2001=0A=
--- mbr_bootsel.S.issue	Tue Nov 27 11:50:18 2001=0A=
***************=0A=
*** 261,286 ****=0A=
  =0A=
  /*=0A=
   * Get the initial time value for the timeout comparison. It is =
returned=0A=
!  * by int 1a in cx:dx. We do sums modulo 2^16 so it doesn't matter if=0A=
!  * the counter wraps (which it does every hour) - so we can safely=0A=
!  * ignore 'cx'.=0A=
   *=0A=
   * Loop around checking for a keypress until we have one, or timeout is=0A=
   * reached.=0A=
   */=0A=
  	xorb	%ah,%ah=0A=
  	int	$0x1a=0A=
  	movl	%edx,%edi=0A=
  3:=0A=
  	movb	$1,%ah=0A=
  	int	$0x16=0A=
  	jnz	4f=0A=
  	xorb	%ah,%ah=0A=
  	int	$0x1a=0A=
  	subl	%edi,%edx=0A=
  	movw_mem_ax(timeout)=0A=
! 	cmpl	%eax,%edx		/* always wait for 1 tick... */=0A=
! 	jbe	3b			/* 0xffff means never timeout */=0A=
  	movb_mem_al(defkey)=0A=
  	jmp	default=0A=
  4:=0A=
--- 261,295 ----=0A=
  =0A=
  /*=0A=
   * Get the initial time value for the timeout comparison. It is =
returned=0A=
!  * by int 1a in cx:dx. Make sure to grab the whole 32 bit value, =
otherwise=0A=
!  * it'd wrap around every hour. Now it'll only do so every 24 hours. =
Boots=0A=
!  * should happen infrequent enough that this isn't a problem.=0A=
   *=0A=
   * Loop around checking for a keypress until we have one, or timeout is=0A=
   * reached.=0A=
   */=0A=
  	xorb	%ah,%ah=0A=
  	int	$0x1a=0A=
+ 	data32=0A=
+ 	shll	$16,%ecx=0A=
  	movl	%edx,%edi=0A=
+ 	data32=0A=
+ 	orl	%ecx,%edi=0A=
  3:=0A=
  	movb	$1,%ah=0A=
  	int	$0x16=0A=
  	jnz	4f=0A=
  	xorb	%ah,%ah=0A=
  	int	$0x1a=0A=
+ 	data32=0A=
+ 	shll	$16,%ecx=0A=
+ 	data32=0A=
+ 	orl	%ecx,%edx=0A=
+ 	data32=0A=
  	subl	%edi,%edx=0A=
  	movw_mem_ax(timeout)=0A=
! 	cmpl	%eax,%edx=0A=
! 	jl	3b=0A=
  	movb_mem_al(defkey)=0A=
  	jmp	default=0A=
  4:=0A=
***************=0A=
*** 471,479 ****=0A=
  fakeent:=0A=
  	.byte 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00=0A=
  	.long 0x0000, 0x0001=0A=
- =0A=
- /* Stuff from here on is overwritten by fdisk - the offset must=0A=
-    not change... */=0A=
  	. =3D _C_LABEL(start) + (0x1bc - NAMETABSIZE - 4)=0A=
  /*=0A=
   * Default action, as a keyvalue we'd normally read from the BIOS. This=0A=
--- 480,485 ----=0A=
***************=0A=
*** 485,491 ****=0A=
  	.byte	0x01=0A=
  /*=0A=
   * Timeout value. 65536 ticks per hour, which is about 18.2 times per =
second.=0A=
-  * 0xffff means never timeout.=0A=
   */=0A=
  timeout:=0A=
  	.word	0x00b6=0A=
--- 491,496 ----=0A=

------=_NextPart_000_0493_01C17F47.6BBAE2E0--