From owner-freebsd-hackers@FreeBSD.ORG Sun Jan 11 13:39:14 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7343616A4CE; Sun, 11 Jan 2004 13:39:14 -0800 (PST) Received: from as6-1-5.kr.m.bonet.se (as6-1-5.kr.m.bonet.se [217.215.84.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4950143D46; Sun, 11 Jan 2004 13:39:08 -0800 (PST) (envelope-from martin@gneto.com) Received: from gneto.com (euklides.gneto.com [192.168.10.11]) by as6-1-5.kr.m.bonet.se (Postfix) with ESMTP id E7A67743AC; Sun, 11 Jan 2004 22:39:06 +0100 (CET) Message-ID: <4001C283.5080106@gneto.com> Date: Sun, 11 Jan 2004 22:39:15 +0100 From: Martin Nilsson User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.6b) Gecko/20031212 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marcin Dalecki References: <4001552B.5060108@gneto.com> <4001A184.5060301@gmx.net> In-Reply-To: <4001A184.5060301@gmx.net> Content-Type: multipart/mixed; boundary="------------060902090801080906010005" cc: freebsd-hackers@freebsd.org Subject: Re: Assembler coding help needed. [solved, patch enclosed] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jan 2004 21:39:14 -0000 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--