Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/arch/i386/stand/lib/crt/bootsect pullup 1.12->1.15 ...



details:   https://anonhg.NetBSD.org/src/rev/f1a7d756ea13
branches:  netbsd-1-4
changeset: 468611:f1a7d756ea13
user:      perry <perry%NetBSD.org@localhost>
date:      Sun May 02 21:35:11 1999 +0000

description:
pullup 1.12->1.15 (fvdl)

diffstat:

 sys/arch/i386/stand/lib/crt/bootsect/start_bootsect.S |  67 +++++++++++++++++-
 1 files changed, 61 insertions(+), 6 deletions(-)

diffs (116 lines):

diff -r b955622ee745 -r f1a7d756ea13 sys/arch/i386/stand/lib/crt/bootsect/start_bootsect.S
--- a/sys/arch/i386/stand/lib/crt/bootsect/start_bootsect.S     Sun May 02 21:32:50 1999 +0000
+++ b/sys/arch/i386/stand/lib/crt/bootsect/start_bootsect.S     Sun May 02 21:35:11 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: start_bootsect.S,v 1.12 1999/04/01 19:36:09 drochner Exp $     */
+/*     $NetBSD: start_bootsect.S,v 1.12.2.1 1999/05/02 21:35:11 perry Exp $    */
        
 /*
  * BIOS bootsector startup
@@ -146,7 +146,6 @@
        data32
        jb      read_error
 
-
        /***# find the first NetBSD partition *****/
        data32
        movl    $PARTSTART, %ebx
@@ -182,6 +181,7 @@
 #endif
 
        /* didn't find either NetBSD or 386BSD partitions */
+noboot:
        data32
        movl    $enoboot, %esi
        data32
@@ -190,6 +190,60 @@
 
 found:
 /*
+ * See if we night need int13 extensions. Compute the total number
+ * of CHS addressable sectors, and compare them to what we need
+ * The reason to avoid int13 extensions as much as possible, is
+ * that they're apparently buggy in some BIOSs.
+ */
+       data32
+       pushl   %ebx            /* save partition entry */
+       data32
+       pushl   %edx            /* save drive number */
+
+       data32
+       xorl    %ecx,%ecx
+       data32
+       xorl    %eax,%eax
+
+       data32
+       movl    %ebx,%esi
+
+       movb    $8,%ah
+       int     $0x13
+
+       shrl    $8,%edx
+       incl    %edx            /* dx now has #heads */
+
+       movl    %ecx,%eax
+       andl    $0x3f,%eax      /* ax has #sectors */
+
+       movl    %ecx,%ebx
+       shrl    $8,%ecx
+
+       andl    $0xc0,%ebx
+       shll    $2,%ebx
+       orl     %ebx,%ecx
+       incl    %ecx            /* cx has #cylinders */
+
+       mull    %edx            /* h * s (will fit in 16 bits) */
+       data32
+       mull    %ecx            /* eax = c * h * s */
+
+       data32
+       addr32
+       movl    8(%esi),%ebx
+       data32
+       addl    $LOADSZ+1, %ebx /* ebx = maximum sector # we need */
+
+       data32
+       cmpl    %eax, %ebx
+       data32
+       popl    %edx
+       data32
+       popl    %ebx
+       data32
+       jl      tradint13
+/*
  * First we check for int13 extensions.
  * If they work, let's use them.
  * If not, revert to the traditional way of doing things.
@@ -205,8 +259,8 @@
  *                     %bx = 0xaa55
  *                     %cx = API subset bitmap, &1 -> extended disk access
  */
-       pushl   %ebx            /* save partition entry */
-       pushl   %edx            /* save drive number */
+       pushl   %ebx
+       pushl   %edx
        movb    $0x41, %ah
        data32
        movl    $0x55aa, %bx
@@ -219,6 +273,7 @@
        data32
        movl    $0xaa55, %edi
        cmpl    %edi, %eax
+       data32
        jnz     tradint13
        testb   $1, %cl
        data32
@@ -354,8 +409,8 @@
        data32
        ret
 
-eread: .asciz          "Read error\r\n"
-enoboot: .asciz                "No bootable partition\r\n"
+eread: .asciz          "Read err\r\n"
+enoboot: .asciz                "No NetBSD part\r\n"
 efail: .asciz          "Boot failed\r\n"
 
 /* throw in a partition in case we are block0 as well */



Home | Main Index | Thread Index | Old Index