Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Jan 2004 22:39:15 +0100
From:      Martin Nilsson <martin@gneto.com>
To:        Marcin Dalecki <mdcki@gmx.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Assembler coding help needed. [solved, patch enclosed]
Message-ID:  <4001C283.5080106@gneto.com>
In-Reply-To: <4001A184.5060301@gmx.net>
References:  <4001552B.5060108@gneto.com> <4001A184.5060301@gmx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------060902090801080906010005
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Marcin Dalecki wrote:
 > Martin Nilsson wrote:
 >
 >> I'm trying to find out why I can't boot 5.2 from USB CDROM on
 >> Supermicro  motherboards. (I have an old Gateway P3 that can!).
 >>
 >> I've found out that that only 0x20 of 0x4c sectors of the loader are
 >> read in and it therfor traps when executed. (read is only called once).
 >>
 >> load_notrunc:    sub %dh,%cl            # Update count
 >>         push %eax            # Save
 >>         call read            # Read it in
 >
 >
 > The fun will be ^^^^ here. The rest is self contained and
 > doesn't depend on CPU variant or periphery.
 >


I found the problem!
The bios trashes %cx when reading from USB CD but not when reading from 
ATAPI CD.

The attached patch fixes this and two other small nits in 
sys/boot/i386/cdboot/cdboot.s

Can somebody (jhb) commit this?

This probably affects all Phoenix-Award bios equipped boxes. My old 
Gateway with AMI BIOS works as it should.


/Martin

--------------060902090801080906010005
Content-Type: text/plain;
 name="cdboot.s.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="cdboot.s.diff"

*** cdboot.s-original	Sun Jan 11 22:16:45 2004
--- cdboot.s	Sun Jan 11 22:16:13 2004
***************
*** 165,171 ****
  #
  		mov DIR_SIZE(%bx),%eax		# Read file length
  		add $SECTOR_SIZE-1,%eax		# Convert length to sectors
! 		shr $11,%eax
  		cmp $BUFFER_LEN,%eax
  		jbe load_sizeok
  		mov $msg_load2big,%si		# Error message
--- 165,171 ----
  #
  		mov DIR_SIZE(%bx),%eax		# Read file length
  		add $SECTOR_SIZE-1,%eax		# Convert length to sectors
! 		shr $SECTOR_SHIFT,%eax
  		cmp $BUFFER_LEN,%eax
  		jbe load_sizeok
  		mov $msg_load2big,%si		# Error message
***************
*** 182,189 ****
  		mov $MAX_READ_SEC,%dh
  load_notrunc:	sub %dh,%cl			# Update count
  		push %eax			# Save
  		call read			# Read it in
! 		pop %eax			# Restore
  		add $MAX_READ_SEC,%eax		# Update LBA
  		add $MAX_READ,%ebx		# Update dest addr
  		jcxz load_done			# Done?
--- 182,191 ----
  		mov $MAX_READ_SEC,%dh
  load_notrunc:	sub %dh,%cl			# Update count
  		push %eax			# Save
+ 		push %cx			# Supermicro BIOS trashes cx when booting USB CD
  		call read			# Read it in
! 		pop %cx				# Restore
! 		pop %eax
  		add $MAX_READ_SEC,%eax		# Update LBA
  		add $MAX_READ,%ebx		# Update dest addr
  		jcxz load_done			# Done?
***************
*** 460,465 ****
--- 462,468 ----
  		mov twiddle_chars,%bx		# Address table
  		inc %al				# Next
  		and $3,%al			#  char
+ 		mov %al,twiddle_index		# Save index
  		xlat				# Get char
  		call putc			# Output it
  		mov $8,%al			# Backspace

--------------060902090801080906010005--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4001C283.5080106>