Various minor cleanup.

This commit is contained in:
mycroft 1995-03-12 00:10:53 +00:00
parent f092d07ee7
commit 40a71a0a2c
5 changed files with 66 additions and 59 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: asm.S,v 1.11 1995/01/18 17:50:50 mycroft Exp $ */
/* $NetBSD: asm.S,v 1.12 1995/03/12 00:10:53 mycroft Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
@ -102,7 +102,6 @@ xprot:
* transfer from protected mode to real mode
*/
ENTRY(prot_to_real)
# set up a dummy stack frame for the second seg change.
movl _ourseg, %eax
pushw %ax
@ -145,13 +144,13 @@ ENTRY(startprog)
movl %esp, %ebp
# get things we need into registers
movl 0x8(%ebp), %ecx # entry offset
movl 0xc(%ebp), %eax # &argv
movl 8(%ebp), %ecx # entry offset
movl 12(%ebp), %eax # &argv
# make a new stack at 0:0xa0000 (big segs)
# make a new stack at 0:0x90000 (big segs)
movl $0x10, %ebx
movw %bx, %ss
movl $0xa0000, %ebx
movl $0x90000, %ebx
movl %ebx, %esp
# push some number of args onto the stack
@ -159,8 +158,8 @@ ENTRY(startprog)
pushl 32(%eax) # argv[8] = extmem
pushl 16(%eax) # argv[4] = esym
pushl $0 # nominally a cyl offset in the boot.
pushl 0x8(%eax) # argv[2] = bootdev
pushl 0x4(%eax) # argv[1] = howto
pushl 8(%eax) # argv[2] = bootdev
pushl 4(%eax) # argv[1] = howto
pushl $0 # dummy 'return' address
# push on our entry address
@ -185,7 +184,6 @@ ENTRY(pbzero)
movl %esp, %ebp
pushl %es
pushl %edi
pushl %ecx
cld
@ -193,18 +191,16 @@ ENTRY(pbzero)
movl $0x10, %eax
movl %ax, %es
movl 0x8(%ebp), %edi # destination
movl 0xc(%ebp), %ecx # count
movl 8(%ebp), %edi # destination
movl 12(%ebp), %ecx # count
xorl %eax, %eax # value
rep
stosb
popl %ecx
popl %edi
popl %es
popl %ebp
ret
/*
@ -217,7 +213,6 @@ ENTRY(pcpy)
pushl %es
pushl %esi
pushl %edi
pushl %ecx
cld
@ -225,19 +220,17 @@ ENTRY(pcpy)
movl $0x10, %eax
movl %ax, %es
movl 0x8(%ebp), %esi # source
movl 0xc(%ebp), %edi # destination
movl 0x10(%ebp), %ecx # count
movl 8(%ebp), %esi # source
movl 12(%ebp), %edi # destination
movl 16(%ebp), %ecx # count
rep
movsb
popl %ecx
popl %edi
popl %esi
popl %es
popl %ebp
ret
#ifdef CHECKSUM
@ -250,7 +243,6 @@ ENTRY(cksum)
movl %esp, %ebp
pushl %es
pushl %edi
pushl %ecx
cld
@ -258,8 +250,8 @@ ENTRY(cksum)
movl $0x10, %eax
movl %ax, %es
movl 0x8(%ebp), %edi # destination
movl 0xc(%ebp), %ecx # count
movl 8(%ebp), %edi # destination
movl 12(%ebp), %ecx # count
shrl $2, %ecx
xorl %edx, %edx # value
@ -270,8 +262,29 @@ ENTRY(cksum)
movl %edx, %eax
popl %ecx
popl %edi
popl %es
popl %ebp
ret
#endif
#if 0
ENTRY(getword)
pushl %ebp
movl %esp, %ebp
pushl %es
# set %es to point at the flat segment
movl $0x10, %eax
movl %ax, %es
movl 8(%ebp), %eax
es
movl (%eax), %edx
movl %edx, %eax
popl %es
popl %ebp
ret
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: bios.S,v 1.10 1995/01/18 17:50:51 mycroft Exp $ */
/* $NetBSD: bios.S,v 1.11 1995/03/12 00:10:56 mycroft Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
@ -71,39 +71,32 @@ ENTRY(biosread)
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %ecx
pushl %edx
pushl %es
movb 0x10(%ebp), %dh
movw 0x0c(%ebp), %cx
movb 16(%ebp), %dh
movw 12(%ebp), %cx
xchgb %ch, %cl # cylinder; the highest 2 bits of cyl is in %cl
rorb $2, %cl
movb 0x14(%ebp), %al
movb 20(%ebp), %al
orb %al, %cl
incb %cl # sector; sec starts from 1, not 0
movb 0x8(%ebp), %dl # device
movl 0x1c(%ebp), %ebx # offset
movb 8(%ebp), %dl # device
movl 28(%ebp), %ebx # offset
# prot_to_real will set %es to BOOTSEG
call _C_LABEL(prot_to_real) # enter real mode
movb $0x2, %ah # subfunction
addr32
movb 0x18(%ebp), %al # number of sectors
movb 24(%ebp), %al # number of sectors
int $0x13
movl %eax, %ebx # save return value (actually movw %ax, %bx)
setc %bl
data32
call _C_LABEL(real_to_prot) # back to protected mode
xorl %eax, %eax
movb %bh, %al # return value in %ax
movb %bl, %al # return value in %ax
popl %es
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret
@ -129,7 +122,7 @@ ENTRY(putc)
pushl %ebx
pushl %ecx
movb 0x8(%ebp), %cl
movb 8(%ebp), %cl
call _C_LABEL(prot_to_real)
@ -258,11 +251,8 @@ ENTRY(get_diskinfo)
pushl %ebp
movl %esp, %ebp
pushl %ebx
pushl %ecx
pushl %edx
pushl %es
movb 0x8(%ebp), %dl # diskinfo(drive #)
movb 8(%ebp), %dl # diskinfo(drive #)
call _C_LABEL(prot_to_real) # enter real mode
@ -296,9 +286,6 @@ ok:
andb $0x3f, %cl # mask of cylinder gunk
movb %cl, %al # max sector (and # sectors)
popl %es
popl %edx
popl %ecx
popl %ebx
popl %ebp
ret

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot.c,v 1.27 1995/01/18 17:28:10 mycroft Exp $ */
/* $NetBSD: boot.c,v 1.28 1995/03/12 00:10:57 mycroft Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
@ -82,7 +82,7 @@ int drive;
argv[7] = memsize(0),
argv[8] = memsize(1),
version);
gateA20();
gateA20(1);
loadstart:
/***************************************************************\
* As a default set it to the first partition of the first *

View File

@ -1,4 +1,4 @@
/* $NetBSD: disk.c,v 1.11 1995/01/18 16:22:35 mycroft Exp $ */
/* $NetBSD: disk.c,v 1.12 1995/03/12 00:10:58 mycroft Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
@ -153,6 +153,8 @@ Bread(sector, addr)
int sector;
void *addr;
{
int error;
if (dosdev != ra_dev || sector < ra_first || sector >= ra_end) {
int cyl, head, sec, nsec;
@ -163,13 +165,10 @@ Bread(sector, addr)
if (nsec > RA_SECTORS)
nsec = RA_SECTORS;
twiddle();
if (biosread(dosdev, cyl, head, sec, nsec, ra_buf) != 0) {
while ((error = biosread(dosdev, cyl, head, sec, nsec, ra_buf)) != 0) {
printf("Error %d: C:%d H:%d S:%d\n", error, cyl, head, sec);
nsec = 1;
twiddle();
while (biosread(dosdev, cyl, head, sec, nsec, ra_buf) != 0) {
printf("Error: C:%d H:%d S:%d\n", cyl, head, sec);
twiddle();
}
}
ra_dev = dosdev;
ra_first = sector;

View File

@ -1,4 +1,4 @@
/* $NetBSD: io.c,v 1.16 1995/02/21 06:34:58 mycroft Exp $ */
/* $NetBSD: io.c,v 1.17 1995/03/12 00:11:00 mycroft Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
@ -48,20 +48,28 @@
/*
* Gate A20 for high memory
*/
unsigned char x_20 = KB_A20;
gateA20()
gateA20(on)
int on;
{
#ifdef IBM_L40
outb(0x92, 0x2);
#else IBM_L40
while (inb(K_STATUS) & K_IBUF_FUL);
while (inb(K_STATUS) & K_OBUF_FUL)
(void)inb(K_RDWR);
outb(K_CMD, KC_CMD_WOUT);
while (inb(K_STATUS) & K_IBUF_FUL);
outb(K_RDWR, x_20);
if (on)
outb(K_RDWR, 0xdf);
else
outb(K_RDWR, 0xcd);
while (inb(K_STATUS) & K_IBUF_FUL);
while (inb(K_STATUS) & K_OBUF_FUL)
(void)inb(K_RDWR);
#endif IBM_L40
}