Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/stand/lib Preserve %ds over bios calls.



details:   https://anonhg.NetBSD.org/src/rev/2bfcd967f4e6
branches:  trunk
changeset: 749199:2bfcd967f4e6
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sat Nov 21 11:52:57 2009 +0000

description:
Preserve %ds over bios calls.
Not strickly necessary because real_to_prot doesn't normally rely on in.
However it caused much confusion while debugging, and does no harm.

diffstat:

 sys/arch/i386/stand/lib/bios_disk.S  |  6 +++++-
 sys/arch/i386/stand/lib/biosmemps2.S |  4 +++-
 sys/arch/i386/stand/lib/dos_file.S   |  6 +++++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diffs (107 lines):

diff -r e13a2d98d43f -r 2bfcd967f4e6 sys/arch/i386/stand/lib/bios_disk.S
--- a/sys/arch/i386/stand/lib/bios_disk.S       Sat Nov 21 11:40:52 2009 +0000
+++ b/sys/arch/i386/stand/lib/bios_disk.S       Sat Nov 21 11:52:57 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bios_disk.S,v 1.18 2005/12/11 12:17:48 christos Exp $  */
+/*     $NetBSD: bios_disk.S,v 1.19 2009/11/21 11:52:57 dsl Exp $       */
 
 /*
  * Ported to boot 386BSD by Julian Elischer (julian%tfs.com@localhost) Sept 1992
@@ -287,6 +287,7 @@
        call    _C_LABEL(prot_to_real)  # enter real mode
        .code16
 
+       push    %ds
        movl    %esi, %eax
        shrl    $4, %eax
        movw    %ds, %bx
@@ -298,6 +299,7 @@
        int     $0x13
        setc    %bl
        movb    %ah, %bh        # save error code
+       pop     %ds
 
        calll   _C_LABEL(real_to_prot) # back to protected mode
        .code32
@@ -328,6 +330,7 @@
        call    _C_LABEL(prot_to_real)  # enter real mode
        .code16
 
+       push    %ds
        movl    %esi, %eax
        shrl    $4, %eax
        andw    $0xf, %si
@@ -338,6 +341,7 @@
        movb    $0x48, %ah      # subfunction
        int     $0x13
        setc    %bl
+       pop     %ds
 
        calll   _C_LABEL(real_to_prot) # back to protected mode
        .code32
diff -r e13a2d98d43f -r 2bfcd967f4e6 sys/arch/i386/stand/lib/biosmemps2.S
--- a/sys/arch/i386/stand/lib/biosmemps2.S      Sat Nov 21 11:40:52 2009 +0000
+++ b/sys/arch/i386/stand/lib/biosmemps2.S      Sat Nov 21 11:52:57 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: biosmemps2.S,v 1.3 2008/04/28 20:23:25 martin Exp $    */
+/*     $NetBSD: biosmemps2.S,v 1.4 2009/11/21 11:52:57 dsl Exp $       */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -70,6 +70,7 @@
 
 getmem:
        # move the parameter to right register
+       push    %ds
        movl    %edx, %esi
        andl    $0xf, %esi
        shrl    $4, %edx
@@ -81,6 +82,7 @@
        movb    $0xc7, %ah
        int     $0x15
        setc    %bl             # save carry
+       pop     %ds
 
 out:
        calll   _C_LABEL(real_to_prot)
diff -r e13a2d98d43f -r 2bfcd967f4e6 sys/arch/i386/stand/lib/dos_file.S
--- a/sys/arch/i386/stand/lib/dos_file.S        Sat Nov 21 11:40:52 2009 +0000
+++ b/sys/arch/i386/stand/lib/dos_file.S        Sat Nov 21 11:52:57 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dos_file.S,v 1.5 2003/02/01 14:48:18 dsl Exp $ */
+/*     $NetBSD: dos_file.S,v 1.6 2009/11/21 11:52:57 dsl Exp $ */
        
 /* extracted from Tor Egge's patches for NetBSD boot */
 
@@ -29,6 +29,7 @@
        call    _C_LABEL(prot_to_real)  # enter real mode
        .code16
 
+       push    %ds
        movl    %edx, %eax
        shrl    $4, %eax
        mov     %ds, %si
@@ -42,6 +43,7 @@
        sti
        int     $0x21
        cli
+       pop     %ds
 
        jnc     ok1
        mov     %ax, _C_LABEL(doserrno)
@@ -80,6 +82,7 @@
        call    _C_LABEL(prot_to_real)  # enter real mode
        .code16
 
+       push    %ds
        movl    %edx, %eax
        shrl    $4, %eax
        mov     %ds, %si
@@ -92,6 +95,7 @@
        sti
        int     $0x21
        cli
+       pop     %ds
 
        jnc     ok2
        mov     %ax, _C_LABEL(doserrno)



Home | Main Index | Thread Index | Old Index