Assembler coding help needed. [solved, patch enclosed]
Martin Nilsson
martin at gneto.com
Sun Jan 11 13:39:14 PST 2004
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
-------------- next part --------------
*** 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
More information about the freebsd-hackers
mailing list