From owner-freebsd-hackers@FreeBSD.ORG Sun Jan 11 11:18:35 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 A1EB216A4CE for ; Sun, 11 Jan 2004 11:18:35 -0800 (PST) Received: from mail.gmx.net (pop.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id A78FD43D45 for ; Sun, 11 Jan 2004 11:18:33 -0800 (PST) (envelope-from mdcki@gmx.net) Received: (qmail 1874 invoked by uid 65534); 11 Jan 2004 19:18:32 -0000 Received: from Bc20a.b.pppool.de (EHLO gmx.net) (213.7.194.10) by mail.gmx.net (mp016) with SMTP; 11 Jan 2004 20:18:32 +0100 X-Authenticated: #17236065 Message-ID: <4001A184.5060301@gmx.net> Date: Sun, 11 Jan 2004 20:18:28 +0100 From: Marcin Dalecki User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.5) Gecko/20031224 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Martin Nilsson References: <4001552B.5060108@gneto.com> In-Reply-To: <4001552B.5060108@gneto.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-hackers@freebsd.org Subject: Re: Assembler coding help needed. 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 19:18:35 -0000 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). > > My last attempt at programming x86 assembler was ~15years ago so I'm a > bit rusty :-) > > The below loop from cdboot.s is what I'm having problem understanding, > how can this fail on one box but not on another? > > # > # Load the binary into the buffer. Due to real mode addressing limitations > # we have to read it in in 64k chunks. > # > mov DIR_SIZE(%bx),%eax # Read file length > add $SECTOR_SIZE-1,%eax # Convert length to sectors > shr $11,%eax > > %eax is 0x4c here on both machines! > > cmp $BUFFER_LEN,%eax > jbe load_sizeok > mov $msg_load2big,%si # Error message > call error > load_sizeok: movzbw %al,%cx # Num sectors to read > mov DIR_EXTENT(%bx),%eax # Load extent > xor %edx,%edx > mov DIR_EA_LEN(%bx),%dl > add %edx,%eax # Skip extended > mov $MEM_READ_BUFFER,%ebx # Read into the buffer > load_loop: mov %cl,%dh > cmp $MAX_READ_SEC,%cl # Truncate to max read size > jbe load_notrunc > mov $MAX_READ_SEC,%dh > 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. > pop %eax # Restore > add $MAX_READ_SEC,%eax # Update LBA > add $MAX_READ,%ebx # Update dest addr > jcxz load_done # Done? > jmp load_loop # Keep going > load_done: > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > >