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.
This commit is contained in:
dsl 2009-11-21 11:52:57 +00:00
parent 18382772a4
commit ef19c35a6d
3 changed files with 13 additions and 3 deletions

View File

@ -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) Sept 1992
@ -287,6 +287,7 @@ ENTRY(biosdisk_extread)
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 @@ ENTRY(biosdisk_extread)
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 @@ ENTRY(biosdisk_getextinfo)
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 @@ ENTRY(biosdisk_getextinfo)
movb $0x48, %ah # subfunction
int $0x13
setc %bl
pop %ds
calll _C_LABEL(real_to_prot) # back to protected mode
.code32

View File

@ -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 @@ ENTRY(getextmemps2)
getmem:
# move the parameter to right register
push %ds
movl %edx, %esi
andl $0xf, %esi
shrl $4, %edx
@ -81,6 +82,7 @@ getmem:
movb $0xc7, %ah
int $0x15
setc %bl # save carry
pop %ds
out:
calll _C_LABEL(real_to_prot)

View File

@ -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 @@ ENTRY(dosopen)
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 @@ ENTRY(dosopen)
sti
int $0x21
cli
pop %ds
jnc ok1
mov %ax, _C_LABEL(doserrno)
@ -80,6 +82,7 @@ ENTRY(dosread)
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 @@ ENTRY(dosread)
sti
int $0x21
cli
pop %ds
jnc ok2
mov %ax, _C_LABEL(doserrno)