NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: install/42202 (boot installcd fails ((amd64/i386))



I wrote:

> The real fix is to update cdboot.S to support real <-> protect mode
> switches provided by i386/stand/lib/realprot.S, which is already used
> by other primary bootxx loaders.

Ah, no. The problem depends on implementation of INT 13h function 42h
(some BIOSes might handle it properly though), so we might have to
split a large xfer within 64KB in read_sectors function.

The attached dumb patch (checks and split >64KB xfers)
seems to work around even with ~67KB /boot on my machine.
(though I'm not familiar with x86 asm at all)

---
Index: stand/cdboot/cdboot.S
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/cdboot/cdboot.S,v
retrieving revision 1.8
diff -u -r1.8 cdboot.S
--- stand/cdboot/cdboot.S       3 May 2008 13:07:31 -0000       1.8
+++ stand/cdboot/cdboot.S       23 Oct 2009 22:12:50 -0000
@@ -47,6 +47,9 @@
 #define PVD_ADDR       0x1000          /* Where Primary VD is loaded */
 #define ROOTDIR_ADDR   0x1800          /* Where Root Directory is loaded */
 #define LOADER_ADDR    SECONDARY_LOAD_ADDRESS
+#define SEGMENT_SIZE   0x10000
+#define MAX_NBLOCK     (SEGMENT_SIZE / BLOCK_SIZE)
+#define NEXT_SEGMENT   (SEGMENT_SIZE >> 4)
 
 #ifdef BOOT_FROM_FAT
 #define MBR_AFTERBPB   90              /* BPB size in FAT32 partition BR */
@@ -297,16 +300,33 @@
  */
 read_sectors:
        pusha
-       movl    %eax, edd_lba           /* Convert LBA to segment */
        shrl    $4, %ebx
+read_again:
+       movl    %eax, edd_lba           /* Convert LBA to segment */
        movw    %bx, edd_segment
+       pushl   %eax
+       push    %bx
+       push    %dx
+       cmpb    $MAX_NBLOCK, %dh
+       jle     1f
+       movb    $MAX_NBLOCK, %dh
+1:
        movb    %dh, edd_nsecs
        movb    boot_drive, %dl
        movw    $edd_packet, %si
-read_again:
        movb    $0x42, %ah
        int     $0x13
+       pop     %dx
+       pop     %bx
+       popl    %eax
        jc      read_fail
+       cmpb    $MAX_NBLOCK, %dh
+       jle     2f
+       subb    $MAX_NBLOCK, %dh
+       addl    $MAX_NBLOCK, %eax
+       addw    $NEXT_SEGMENT, %bx
+       jmp     read_again
+2:
        popa
        ret
 read_fail:

---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index