diff options
Diffstat (limited to 'sys/arch/i386/stand/libsa')
-rw-r--r-- | sys/arch/i386/stand/libsa/Makefile | 48 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/bioscom.S | 27 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/biosdev.c | 341 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/biosdev.h | 5 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/biosdisk.S | 53 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/bioskbd.S | 99 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/dev_i386.c | 35 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/exec_i386.c | 76 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/libsa.h | 14 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/memprobe.c | 47 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/memsize.S | 98 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/probe_keyboard.c | 117 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/real_prot.S | 45 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/srt0.S | 139 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/startprog.S | 45 |
15 files changed, 464 insertions, 725 deletions
diff --git a/sys/arch/i386/stand/libsa/Makefile b/sys/arch/i386/stand/libsa/Makefile index 4d9b58bcbfe..23103a5ca61 100644 --- a/sys/arch/i386/stand/libsa/Makefile +++ b/sys/arch/i386/stand/libsa/Makefile @@ -1,51 +1,55 @@ -# $OpenBSD: Makefile,v 1.3 1997/03/31 05:52:24 weingart Exp $ +# $OpenBSD: Makefile,v 1.4 1997/03/31 23:06:25 mickey Exp $ -LIB= sa +LIB= sa -CFLAGS+=-Wall -#CFLAGS+=-DBIOS_DEBUG -#CFLAGS+=-DEXEC_DEBUG -CFLAGS+=-DNO_IDTR -CFLAGS+=-DHEAP_START="0x10000" -CFLAGS+=-DHEAP_LIMIT="0xa0000" -CFLAGS+=-D__INTERNAL_LIBSA_CREAD +CFLAGS+=$(SACFLAGS) -D__INTERNAL_LIBSA_CREAD +CFLAGS+=-DHEAP_START=$(HEAP_START) -DHEAP_LIMIT=$(HEAP_LIMIT) CFLAGS+=${DEBUGFLAGS} -I${.CURDIR} -I${.CURDIR}/.. CFLAGS+=-I${.CURDIR}/../../../.. -I${.CURDIR}/../../../../lib/libsa +AS+= -R #AS+= -Wa,-a S=${.CURDIR}/../../../.. -DIR_SA=$S/lib/libsa +DIR_SA= $S/lib/libsa DIR_KERN=$S/lib/libkern # stand routines -SRCS= alloc.c exit.c exec.c getfile.c gets.c globals.c strcmp.c \ - strncmp.c memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c +SRCS= alloc.c exit.c exec.c getfile.c gets.c globals.c strcmp.c strlen.c \ + strncmp.c memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c + +# math for cd9660 +SRCS+= divdi3.c qdivrem.c # io routines -SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ - open.c read.c stat.c write.c cread.c readdir.c cons.c +SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ + open.c read.c stat.c write.c cread.c readdir.c cons.c # network routines -SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c +SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c # network info services -SRCS+= bootp.c bootparam.c rarp.c +SRCS+= bootp.c bootparam.c rarp.c # boot filesystems -SRCS+= ufs.c nfs.c +SRCS+= ufs.c nfs.c cd9660.c # i386 stuff -SRCS+= asm.S bioscom.S biosdev.c biosdisk.S bioskbd.S biostime.S startprog.S \ - dev_i386.c exec_i386.c gateA20.c memprobe.c memsize.S probe_keyboard.c \ - real_prot.S srt0.S unixsys.S +SRCS+= asm.S bioscom.S biosdev.c biosdisk.S bioskbd.S biostime.S biosmem.S \ + dev_i386.c gateA20.c memprobe.c real_prot.S unixsys.S exec_i386.S NOPROFILE=noprofile NOPIC=nopic .PATH: ${DIR_SA} ${DIR_KERN} -all: ${SALIB} +all: machine-links ${SALIB} -.include <bsd.lib.mk> +machine-links: + @rm -f machine i386 + @ln -s ${S}/arch/i386 i386 + @ln -s ${S}/arch/i386/include machine +install: + +.include <bsd.lib.mk> diff --git a/sys/arch/i386/stand/libsa/bioscom.S b/sys/arch/i386/stand/libsa/bioscom.S index f8402007401..db3386dc749 100644 --- a/sys/arch/i386/stand/libsa/bioscom.S +++ b/sys/arch/i386/stand/libsa/bioscom.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bioscom.S,v 1.2 1997/03/31 03:12:09 weingart Exp $ */ +/* $OpenBSD: bioscom.S,v 1.3 1997/03/31 23:06:26 mickey Exp $ */ /* * Mach Operating System @@ -26,7 +26,7 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:34:26 rpd - * $Id: bioscom.S,v 1.2 1997/03/31 03:12:09 weingart Exp $ + * $Id: bioscom.S,v 1.3 1997/03/31 23:06:26 mickey Exp $ */ /* @@ -71,8 +71,9 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <machine/asm.h> + .data port: - .long 0x3f8 + .long 0x2f8 .text @@ -94,8 +95,9 @@ port: * probe com[0-3] ports and store first found in 'port' variable */ ENTRY(com_probe) - push %ebp - mov %esp, %ebp + pushl %ebp + movl %esp, %ebp + pushl %edx /* * void init_serial(void) @@ -132,9 +134,10 @@ ENTRY(com_probe) addb $5, %dl jmp 1b 2: + popl %edx + popl %ebp xorl %eax, %eax # is present (: incl %eax - popl %ebp ret /* @@ -146,6 +149,7 @@ ENTRY(com_probe) ENTRY(com_putc) pushl %ebp movl %esp, %ebp + pushl %ebx movl $port, %edx # line status reg add 5, %edx @@ -158,6 +162,7 @@ ENTRY(com_putc) sub $5, %edx # TX output reg outb %al, %dx # send this one + popl %edx popl %ebp ret @@ -167,8 +172,7 @@ ENTRY(com_putc) */ ENTRY(com_getc) - push %ebp - movl %esp, %ebp + pushl %edx movl $port, %edx # line status reg addl 5, %edx @@ -186,7 +190,7 @@ ENTRY(com_getc) jne 2f movb $0x08, %eax # look like BS 2: - popl %ebp + popl %edx ret /* @@ -194,8 +198,7 @@ ENTRY(com_getc) * if there is a character pending, return true; otherwise return 0 */ ENTRY(com_ischar) - push %ebp - mov %esp, %ebp + pushl %edx xorl %eax, %eax movl $port, %edx # line status reg @@ -203,6 +206,6 @@ ENTRY(com_ischar) inb %dx, %al andb $0x01, %al # RX char available? - pop %ebp + pop %edx ret diff --git a/sys/arch/i386/stand/libsa/biosdev.c b/sys/arch/i386/stand/libsa/biosdev.c index 6049c632923..2bf69993ccb 100644 --- a/sys/arch/i386/stand/libsa/biosdev.c +++ b/sys/arch/i386/stand/libsa/biosdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.c,v 1.2 1997/03/31 03:12:09 weingart Exp $ */ +/* $OpenBSD: biosdev.c,v 1.3 1997/03/31 23:06:26 mickey Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -33,104 +33,65 @@ */ #include <sys/param.h> +#include <sys/reboot.h> +#include <sys/disklabel.h> +#include <string.h> #include <libsa.h> #include "biosdev.h" -dev_t maj, unit, part; +extern int debug; -int -biosstrategy(void *devdata, int rw, - daddr_t blk, size_t size, void *buf, size_t *rsize) -{ - int error = 0; +struct biosdisk { u_int dinfo; - register size_t i, nsect; - void *local_buf, *lb; /* 1MB real mode stuff */ - - /* We need a buffer below 1MB - * - * Note: not really needed for the gzip stuff, - * as it already allocates buffers below 1MB, - * but just to make sure (in case using oread() - */ - lb = local_buf = alloc(size); - -#ifdef BIOS_DEBUG - printf("biosstrategy: %s %d bytes @ %d -> %p\n", - (rw==F_READ?"reading":"writing"), size, blk, buf); -#endif - - dinfo = biosdinfo(bootdev); - nsect = (size + DEV_BSIZE-1) / DEV_BSIZE; - for (i = 0; error == 0 && i < nsect; ) { - register int cyl, hd, sect, n; - - btochs(blk, cyl, hd, sect, - BIOSNHEADS(dinfo), BIOSNSECTS(dinfo)); - if ((sect + (nsect - i)) >= BIOSNSECTS(dinfo)) - n = BIOSNSECTS(dinfo) - sect; - else - n = nsect - i; -#ifdef BIOS_DEBUG - printf("biosread: dev=%x, cyl=%d, hd=%d, sc=%d, n=%d, buf=%lx", - bootdev, cyl, hd, sect, n, (u_long)local_buf); -#endif - if (rw == F_READ) - error = biosread (bootdev, cyl, hd, sect, n, local_buf); - else - error = bioswrite(bootdev, cyl, hd, sect, n, local_buf); -#ifdef BIOS_DEBUG - printf(", ret=%x\n", error); -#endif - local_buf += n * DEV_BSIZE; - i += n; - blk += n; - } - - /* Copy to final location */ - memcpy(buf, lb, size); - free(lb, size); - - /* Amount we read */ - *rsize = i * DEV_BSIZE; - - return error; -} + struct { + u_int8_t mboot[DOSPARTOFF]; + struct dos_partition dparts[NDOSPART]; + u_int16_t signature; + } mbr; + struct disklabel disklabel; + dev_t bsddev; + u_int8_t biosdev; +}; int biosopen(struct open_file *f, ...) { va_list ap; - register char *cp, *fname, **file; - static const char *devs[] = {"wd", "hd", "fd", "wt", "sd", NULL}; + register char *p, *cp, *fname, **file; + char devname[sizeof(bdevs[0])]; + dev_t maj, unit, part; + register struct biosdisk *bd; + daddr_t off = LABELSECTOR; + u_int8_t *buf; + int i; + size_t rsize; va_start(ap, f); cp = fname = *(file = va_arg(ap, char **)); va_end(ap); +#ifdef BIOS_DEBUG + if (debug) + printf("%s\n", cp); +#endif + + f->f_devdata = NULL; /* search for device specification */ - while (*cp != 0 && *cp != '(') - cp++; + for ( p = devname; *cp != 0 && *cp != '(';) + *p++ = *cp++; + *p = '\0'; if (*cp != 0) { if (*cp++ == '(') { - char **devp = (char **)devs; - - for (; *devp != NULL && - (fname[0] != (*devp)[0] || - fname[1] != (*devp)[1]); devp++) - ; - if (*devp == NULL) { - printf("Unknown device"); - errno = ENXIO; - return -1; + for (maj = 0; maj < NENTS(bdevs) && + strncmp(devname, bdevs[maj], sizeof(devname)); + maj++); + if (maj >= NENTS(bdevs)) { + printf("Unknown device: %s\n", devname); + return ENXIO; } - maj = devp - (char **)devs; - } - /* check syntax */ - if (cp[1] != ',' || cp[3] != ')') { + } else { printf("Syntax error\n"); - errno = EINVAL; - return -1; + return EINVAL; } /* get unit */ @@ -138,8 +99,7 @@ biosopen(struct open_file *f, ...) unit = *cp++ - '0'; else { printf("Bad unit number\n"); - errno = ENXIO; - return -1; + return ENXIO; } cp++; /* skip ',' */ /* get partition */ @@ -147,44 +107,229 @@ biosopen(struct open_file *f, ...) part = *cp++ - 'a'; else { printf("Bad partition id\n"); - errno = ENXIO; - return -1; + return ENXIO; } cp++; /* skip ')' */ if (*cp != 0) *file = cp; + bd = alloc(sizeof(*bd)); + bzero(bd, sizeof(bd)); + switch (maj) { - case 0: - case 4: - bootdev = unit | 0x80; + case 0: /* wd */ + case 4: /* sd */ + bd->biosdev = (u_int8_t)(unit | 0x80); break; - case 1: - bootdev = unit | 0x80; - unit = 0; + case 2: /* fd */ + bd->biosdev = (u_int8_t)unit; break; - case 2: - bootdev = unit; - break; - case 3: + case 3: /* wt */ #ifdef DEBUG - printf("Wangtek is unsupported\n"); + if (debug) + printf("Wangtek is unsupported\n"); #endif - errno = ENXIO; - return -1; default: - break; + free(bd, 0); + return ENXIO; } + bd->bsddev = MAKEBOOTDEV(maj, 0, 0, unit, part); + bd->dinfo = biosdinfo((dev_t)bd->biosdev); + + } else + return ENOENT; + +#ifdef BIOS_DEBUG + if (debug) { + printf("BIOS geometry: heads: %u, s/t: %u\n", + BIOSNHEADS(bd->dinfo), BIOSNSECTS(bd->dinfo)); } +#endif + + if (maj == 0 || maj == 4) { /* wd, sd */ + if ((errno = biosstrategy(bd, F_READ, DOSBBSECTOR, + DEV_BSIZE, &bd->mbr, &rsize)) != 0) { +#ifdef DEBUG + if (debug) + printf("cannot read MBR\n"); +#endif + free(bd, 0); + return errno; + } + + /* check mbr signature */ + if (bd->mbr.signature != 0xaa55) { +#ifdef DEBUG + if (debug) + printf("bad MBR signature\n"); +#endif + free(bd, 0); + return EINVAL; + } + + for (off = 0, i = 0; i < NDOSPART; i++) + if (bd->mbr.dparts[i].dp_typ == DOSPTYP_OPENBSD) { + off = bd->mbr.dparts[i].dp_start + LABELSECTOR; + break; + } + + if (off == 0) { +#ifdef DEBUG + if (debug) + printf("no BSD partition\n"); +#endif + free(bd, 0); + return EINVAL; + } + } + + buf = alloc(DEV_BSIZE); +#ifdef BIOS_DEBUG + if (debug) + printf("loading disklabel @ %u\n", off); +#endif + /* read disklabel */ + if ((errno = biosstrategy(bd, F_READ, off, + DEV_BSIZE, buf, &rsize)) != 0) { +#ifdef DEBUG + if (debug) + printf("failed to read disklabel\n"); +#endif + free(buf, 0); + free(bd, 0); + return errno; + } + + if ((p = getdisklabel(buf, &bd->disklabel)) != NULL) { +#ifdef DEBUG + if (debug) + printf("%s\n", p); +#endif + free(buf, 0); + free(bd, 0); + return EINVAL; + } + + free(buf,0); + f->f_devdata = bd; return 0; } +/* BIOS disk errors translation table */ +static const struct bd_error { + u_int8_t bd_id; + int unix_id; + char *msg; +} bd_errors[] = { + { 0x00, 0 , "successful completion" }, + { 0x01, EINVAL , "invalid function or parameter" }, + { 0x02, EIO , "address mark not found" }, + { 0x03, EROFS , "disk write-protected" }, + { 0x04, EIO , "sector not found/read error" }, + { 0x05, EIO , "reset failed" }, + { 0x06, EIO , "disk changed" }, + { 0x07, EIO , "drive parameter activity failed" }, + { 0x08, EINVAL , "DMA overrun" }, + { 0x09, EINVAL , "data boundary error" }, + { 0x0A, EIO , "bad sector detected" }, + { 0x0B, EIO , "bad track detected" }, + { 0x0C, ENXIO , "unsupported track or invalid media" }, + { 0x0D, EINVAL , "invalid number of sectors on format" }, + { 0x0E, EIO , "control data address mark detected" }, + { 0x0F, EIO , "DMA arbitration level out of range" }, + { 0x10, EIO , "uncorrectable CRC or ECC error on read" }, + { 0x11, 0 , "data ECC corrected" }, + { 0x20, EIO , "controller failure" }, + { 0x31, ENXIO , "no media in drive" }, + { 0x32, ENXIO , "incorrect drive type stored in CMOS" }, + { 0x40, EIO , "seek failed" }, + { 0x80, EIO , "operation timed out" }, + { 0xAA, EIO , "drive not ready" }, + { 0xB0, EIO , "volume not locked in drive" }, + { 0xB1, EIO , "volume locked in drive" }, + { 0xB2, EIO , "volume not removable" }, + { 0xB3, EDEADLK, "volume in use" }, + { 0xB4, ENOLCK , "lock count exceeded" }, + { 0xB5, EINVAL , "valid eject request failed" }, + { 0xBB, EIO , "undefined error" }, + { 0xCC, EROFS , "write fault" }, + { 0xE0, EIO , "status register error" }, + { 0xFF, EIO , "sense operation failed" } +}; +int bd_nents = NENTS(bd_errors); + int -biosclose(struct open_file *f) +biosstrategy(void *devdata, int rw, + daddr_t blk, size_t size, void *buf, size_t *rsize) { + u_int8_t error = 0; + register struct biosdisk *bd = (struct biosdisk *)devdata; + register size_t i, nsect, n; + register const struct bd_error *p = bd_errors; + nsect = (size + DEV_BSIZE-1) / DEV_BSIZE; + blk += bd->disklabel.d_partitions[B_PARTITION(bd->bsddev)].p_offset; + +#ifdef BIOS_DEBUG + if (debug) + printf("biosstrategy(%p,%s,%u,%u,%p,%p), dev=%x:%x\nbiosread:", + bd, (rw==F_READ?"reading":"writing"), blk, size, + buf, rsize, bd->biosdev, bd->bsddev); +#endif + + for (i = 0; error == 0 && i < nsect; + i += n, blk += n, buf += n * DEV_BSIZE) { + register int cyl, hd, sect; +#if 0 + /* fight seg boundary error XXX */ + static u_int8_t bbuf[DEV_BSIZE]; +#endif + + btochs(blk, cyl, hd, sect, + BIOSNHEADS(bd->dinfo), BIOSNSECTS(bd->dinfo)); + if ((sect + (nsect - i)) >= BIOSNSECTS(bd->dinfo)) + n = BIOSNSECTS(bd->dinfo) - sect; + else + n = nsect - i; +#ifdef BIOS_DEBUG + if (debug) + printf(" (%d,%d,%d,%d)@%p", cyl, hd, sect, n, buf); +#endif + if (rw == F_READ) { + error = biosread (bd->biosdev, cyl, hd, sect, n, buf); + /* bcopy(bbuf, buf, sizeof(bbuf)); */ + } else { + /* bcopy(buf, bbuf, sizeof(bbuf)); */ + error = bioswrite(bd->biosdev, cyl, hd, sect, n, buf); + } + if (error != 0) { + for (p = bd_errors; p < &bd_errors[bd_nents] && + p->bd_id != error; p++); + + if (error == 0x11) /* ECC corrected */ + error = 0; + } + } + +#ifdef BIOS_DEBUG + if (debug) { + if (error != 0) + printf("=%x(%s)", p->bd_id, p->msg); + putchar('\n'); + } +#endif + + *rsize = i * DEV_BSIZE; + + return p->unix_id; +} + +int +biosclose(struct open_file *f) +{ + free(f->f_devdata, 0); return 0; } diff --git a/sys/arch/i386/stand/libsa/biosdev.h b/sys/arch/i386/stand/libsa/biosdev.h index da619027b82..9ef4becc2af 100644 --- a/sys/arch/i386/stand/libsa/biosdev.h +++ b/sys/arch/i386/stand/libsa/biosdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.h,v 1.2 1997/03/31 03:12:10 weingart Exp $ */ +/* $OpenBSD: biosdev.h,v 1.3 1997/03/31 23:06:27 mickey Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -60,5 +60,8 @@ void com_putc __P((int c)); int com_getc __P((void)); int com_ischar __P((void)); +/* biosmem.S */ +u_int biosmem __P((int)); + /* biostime.S */ void usleep __P((u_long)); diff --git a/sys/arch/i386/stand/libsa/biosdisk.S b/sys/arch/i386/stand/libsa/biosdisk.S index f036d0f95c0..f54e23efccc 100644 --- a/sys/arch/i386/stand/libsa/biosdisk.S +++ b/sys/arch/i386/stand/libsa/biosdisk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdisk.S,v 1.2 1997/03/31 03:12:11 weingart Exp $ */ +/* $OpenBSD: biosdisk.S,v 1.3 1997/03/31 23:06:27 mickey Exp $ */ /* * Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 @@ -70,10 +70,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ENTRY(biosread) pushl %ebp movl %esp, %ebp - pushl %ebx - pushl %esi - pushl %edi - push %es + pushal movb 8(%ebp), %dl # device movw 12(%ebp), %cx @@ -87,44 +84,30 @@ ENTRY(biosread) movb 24(%ebp), %al # number of sectors movl %eax, %esi # save this against mode switch movl 28(%ebp), %ebx # offset - - - # prot_to_real will set %es to BOOTSEG - # Which means %cs == %es. - # XXX - This hoses things severly. Better - # recoup %es to point to the base of the given - # buffer, and let %bx be the index into it, - # that way we can read a max of 64K give or - # take 15 bytes anyways. - - # Save %es in %edi - movl %ebx, %eax - shrl $4, %eax - movl %eax, %edi - andl $0xF, %ebx + movl %ebx, %edi # spilt off for seg:off pair + shrl $4, %edi + andl $0xf, %ebx # atomic read for up to 64k call _C_LABEL(prot_to_real) # enter real mode - # Restore %es movl %di, %es - - # Restore %ax movl %si, %ax - int $0x13 - setc %bl - + movb $0, %cl + jnc 1f + movb %ah, %cl +1: data32 call _C_LABEL(real_to_prot) # back to protected mode - movzbl %bl, %eax # return value in %ax + movzbl %cl, %eax # return value in %ax + movl %eax, 1f - pop %es - popl %edi - popl %esi - popl %ebx + popal + movl 1f, %eax popl %ebp ret +1: .long 0 ENTRY(bioswrite) @@ -142,8 +125,8 @@ ENTRY(biosdinfo) pushl %ebp movl %esp, %ebp pushl %ebx - pushl %esi - pushl %edi + pushl %ecx + pushl %edx movb 8(%ebp), %dl # diskinfo(drive #) @@ -179,8 +162,8 @@ ok: andb $0x3f, %cl # mask of cylinder gunk movb %cl, %al # max sector (and # sectors) - popl %edi - popl %esi + popl %edx + popl %ecx popl %ebx popl %ebp ret diff --git a/sys/arch/i386/stand/libsa/bioskbd.S b/sys/arch/i386/stand/libsa/bioskbd.S index ff414bf30f2..83b5d283573 100644 --- a/sys/arch/i386/stand/libsa/bioskbd.S +++ b/sys/arch/i386/stand/libsa/bioskbd.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bioskbd.S,v 1.2 1997/03/31 03:12:11 weingart Exp $ */ +/* $OpenBSD: bioskbd.S,v 1.3 1997/03/31 23:06:28 mickey Exp $ */ /* * Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 @@ -61,7 +61,75 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ ENTRY(kbd_probe) - +#if 0 +#include <machine/console.h> +#include <machine/cpufunc.h> +#include "boot.h" + +int +probe_keyboard(void) +{ + int i, retries = 5; + unsigned char val; + + /* flush any noise in the buffer */ + while (inb(KB_STAT) & KB_BUF_FULL) { + delay1ms(); + (void) inb(KB_DATA); + } + + /* Try to reset keyboard hardware */ + again: + while (--retries) { +#ifdef DEBUG + printf("%d ", retries); +#endif + while ((inb(KB_STAT) & KB_READY) == KB_READY) delay1ms(); + outb(KB_DATA, KB_RESET); + for (i=0; i<1000; i++) { + delay1ms(); + val = inb(KB_DATA); + if (val == KB_ACK || val == KB_ECHO) + goto gotack; + if (val == KB_RESEND) + break; + } + } +gotres: +#ifdef DEBUG + printf("gotres\n"); +#endif + if (!retries) { +#ifdef DEBUG + printf("gave up\n"); +#endif + return(1); + } +gotack: + delay1ms(); + while ((inb(KB_STAT) & KB_BUF_FULL) == 0) delay1ms(); + delay1ms(); +#ifdef DEBUG + printf("ACK "); +#endif + val = inb(KB_DATA); + if (val == KB_ACK) + goto gotack; + if (val == KB_RESEND) + goto again; + if (val != KB_RESET_DONE) { +#ifdef DEBUG + printf("stray val %d\n", val); +#endif + return(0); + } +#ifdef DEBUG + printf("ok\n"); +#endif + return(0); +} + +#endif movl 1, %eax /* present (: */ ret @@ -75,9 +143,7 @@ ENTRY(kbd_probe) ENTRY(kbd_putc) pushl %ebp movl %esp, %ebp - pushl %ebx - pushl %esi - pushl %edi + pushal movb 8(%ebp), %cl @@ -86,16 +152,14 @@ ENTRY(kbd_putc) movb %cl, %al movb $0x0e, %ah - xorl %ebx, %ebx - incl %ebx + xorl %bx, %bx + incl %bx int $0x10 # display a byte data32 call _C_LABEL(real_to_prot) - popl %edi - popl %esi - popl %ebx + popal popl %ebp ret @@ -144,11 +208,7 @@ ENTRY(kbd_getc) # ZF = set */ ENTRY(kbd_ischar) - pushl %ebp - movl %esp, %ebp - pushl %ebx - pushl %esi - pushl %edi + pushal call _C_LABEL(prot_to_real) @@ -162,9 +222,10 @@ ENTRY(kbd_ischar) call _C_LABEL(real_to_prot) movzbl %bl, %eax + movl %eax, 1f - popl %edi - popl %esi - popl %ebx - popl %ebp + popal + movl 1f, %eax ret +1: .long 0 + diff --git a/sys/arch/i386/stand/libsa/dev_i386.c b/sys/arch/i386/stand/libsa/dev_i386.c index c573295390f..0e1b75eb2ce 100644 --- a/sys/arch/i386/stand/libsa/dev_i386.c +++ b/sys/arch/i386/stand/libsa/dev_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev_i386.c,v 1.2 1997/03/31 03:12:12 weingart Exp $ */ +/* $OpenBSD: dev_i386.c,v 1.3 1997/03/31 23:06:28 mickey Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -35,20 +35,25 @@ #include <libsa.h> #include "biosdev.h" +const char bdevs[19][4] = { + "wd", "", "fd", "wt", "sd", "st", "cd", "mcd", + "", "", "", "", "", "", "", "scd", "", "", "acd" +}; + /* pass dev_t to the open routines */ int devopen(struct open_file *f, const char *fname, char **file) { struct devsw *dp = devsw; - register int i, rc = 0; + register int i, rc = 1; *file = (char *)fname; - for (i = 0; i < ndevs ; dp++, i++) - if ((rc = (*dp->dv_open)(f, file))== 0) { + for (i = 0; i < ndevs && rc != 0; dp++, i++) + if ((rc = (*dp->dv_open)(f, file)) == 0) { f->f_dev = dp; return 0; - } + } if ((f->f_flags & F_NODEV) == 0) f->f_dev = dp; @@ -60,9 +65,24 @@ void putchar(c) int c; { - putc(c); - if (c == '\n') + static int pos = 0; + + switch(c) { + case '\t': + while(++pos % 8) + putc(' '); + break; + case '\n': putc('\r'); + case '\r': + putc(c); + pos=0; + break; + default: + putc(c); + pos++; + break; + } } int @@ -80,3 +100,4 @@ getchar() return(c); } + diff --git a/sys/arch/i386/stand/libsa/exec_i386.c b/sys/arch/i386/stand/libsa/exec_i386.c deleted file mode 100644 index f9eb127a3b9..00000000000 --- a/sys/arch/i386/stand/libsa/exec_i386.c +++ /dev/null @@ -1,76 +0,0 @@ - -/* $OpenBSD: exec_i386.c,v 1.2 1997/03/31 05:52:25 weingart Exp $ */ - -#include <sys/param.h> -#include <sys/exec.h> -#include <sys/reboot.h> -#include <libsa.h> - - -void -machdep_start(startaddr, howto, loadaddr, ssym, esym) - char *startaddr, *loadaddr, *ssym, *esym; - int howto; -{ - static int argv[9]; - struct exec *x; - - -#ifdef DEBUG - x = (void *)loadaddr; - printf("exec {\n"); - printf(" a_midmag = %lx\n", x->a_midmag); - printf(" a_text = %lx\n", x->a_text); - printf(" a_data = %lx\n", x->a_data); - printf(" a_bss = %lx\n", x->a_bss); - printf(" a_syms = %lx\n", x->a_syms); - printf(" a_entry = %lx\n", x->a_entry); - printf(" a_trsize = %lx\n", x->a_trsize); - printf(" a_drsize = %lx\n", x->a_drsize); - printf("}\n"); - - getchar(); -#endif - - (int)startaddr &= 0xffffff; - - /* - * We now pass the various bootstrap parameters to the loaded - * image via the argument list - * - * arg0 = 8 (magic) - * arg1 = boot flags - * arg2 = boot device - * arg3 = Cylinder offset (XXX - used to be ssym) - * arg4 = end of symbol table (0 if not loaded) - * arg5 = transfer address from image - * arg6 = transfer address for next image pointer - * arg7 = conventional memory size (640) - * arg8 = extended memory size (8196) - */ - argv[0] = 8; - argv[1] = howto; - argv[2] = bootdev; /* Boot device */ - argv[3] = 0; /* Cyl offset */ - argv[4] = 0; - argv[5] = (int)startaddr; - argv[6] = 0; - argv[7] = memsize(0); - argv[8] = memsize(1); - -#ifdef DEBUG - { int i; - for(i = 0; i <= argv[0]; i++) - printf("argv[%d] = %x\n", i, argv[i]); - - getchar(); - } -#endif - - /****************************************************************/ - /* copy that first page and overwrite any BIOS variables */ - /****************************************************************/ - printf("entry point at 0x%x\n", (int)startaddr); - startprog(startaddr, argv); -} - diff --git a/sys/arch/i386/stand/libsa/libsa.h b/sys/arch/i386/stand/libsa/libsa.h index b5eb8ddea58..28ea3117349 100644 --- a/sys/arch/i386/stand/libsa/libsa.h +++ b/sys/arch/i386/stand/libsa/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.2 1997/03/31 03:12:14 weingart Exp $ */ +/* $OpenBSD: libsa.h,v 1.3 1997/03/31 23:06:29 mickey Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -34,12 +34,10 @@ #include <stand.h> -void startprog __P((char *addr, int argv[])); -void gateA20 __P((int on)); -int memsize __P((int which)); -int memprobe __P((void)); +void gateA20 __P((int)); +void memprobe __P((void)); -extern dev_t bootdev, maj, unit, part; -extern u_long cyloffset; -extern u_long ourseg, esym; +extern u_long codeseg; extern int boothowto; +extern u_int cnvmem, extmem; +extern const char bdevs[19][4]; diff --git a/sys/arch/i386/stand/libsa/memprobe.c b/sys/arch/i386/stand/libsa/memprobe.c index 1a67eafb84d..a50cac42932 100644 --- a/sys/arch/i386/stand/libsa/memprobe.c +++ b/sys/arch/i386/stand/libsa/memprobe.c @@ -1,8 +1,33 @@ -/* $OpenBSD: memprobe.c,v 1.1 1997/03/31 03:12:14 weingart Exp $ */ +/* $OpenBSD: memprobe.c,v 1.2 1997/03/31 23:06:30 mickey Exp $ */ #include <sys/param.h> -#include <libsa.h> +#include "libsa.h" +#include "biosdev.h" +static int addrprobe __P((int)); + +void +memprobe() +{ + int ram; + + cnvmem = biosmem(0); + extmem = biosmem(1); + + /* probe extended memory + * + * There is no need to do this in assembly language. This are + * much easier to debug in C anyways. + */ + for(ram = 1024; ram < 512*1024; ram += 4){ + + printf("Probing memory: %d KB\r", ram-1024); + if(addrprobe(ram)) break; + } + + printf("\n"); + extmem = ram - 1024; +} /* addrprobe(kloc): Probe memory at address kloc * 1024. * @@ -30,21 +55,3 @@ static int addrprobe(int kloc){ } -/* memprobe(): return probed memory size in KB for extended memory - * - * There is no need to do this in assembly language. This are - * much easier to debug in C anyways. - */ -int memprobe(void){ - int ram; - - for(ram = 1024; ram < 512*1024; ram += 4){ - - printf("Probing memory: %d KB\r", ram-1024); - if(addrprobe(ram)) break; - } - - printf("\n"); - return(ram-1024); -} - diff --git a/sys/arch/i386/stand/libsa/memsize.S b/sys/arch/i386/stand/libsa/memsize.S deleted file mode 100644 index 2887d10449b..00000000000 --- a/sys/arch/i386/stand/libsa/memsize.S +++ /dev/null @@ -1,98 +0,0 @@ -/* $OpenBSD: memsize.S,v 1.2 1997/03/31 03:12:15 weingart Exp $ */ - -/* - * Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 - * - * Mach Operating System - * Copyright (c) 1992, 1991 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -/* - Copyright 1988, 1989, 1990, 1991, 1992 - by Intel Corporation, Santa Clara, California. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appears in all -copies and that both the copyright notice and this permission notice -appear in supporting documentation, and that the name of Intel -not be used in advertising or publicity pertaining to distribution -of the software without specific, written prior permission. - -INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, -IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, -NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#include <machine/asm.h> -#define addr32 .byte 0x67 -#define data32 .byte 0x66 - -/* -# -# memsize(i) : return the memory size in KB. i == 0 for conventional memory, -# i == 1 for extended memory -# BIOS call "INT 12H" to get conventional memory size -# BIOS call "INT 15H, AH=88H" to get extended memory size -# Both have the return value in AX. -# -*/ - -ENTRY(memsize) - pushl %ebp - movl %esp, %ebp - pushl %esi - pushl %edi - - movl 8(%ebp), %edx - - call _C_LABEL(prot_to_real) # enter real mode - - testb %dl, %dl - jnz 1f - - int $0x12 - jmp 2f - -1: - movb $0x88, %ah - int $0x15 - -2: - movl %eax, %edx - - data32 - call _C_LABEL(real_to_prot) - - movl %edx, %eax - popl %edi - popl %esi - popl %ebp - ret diff --git a/sys/arch/i386/stand/libsa/probe_keyboard.c b/sys/arch/i386/stand/libsa/probe_keyboard.c deleted file mode 100644 index e680c248e91..00000000000 --- a/sys/arch/i386/stand/libsa/probe_keyboard.c +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * Copyright (c) 1992-1995 Søren Schmidt - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz and Don Ahn. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer - * in this position and unchanged. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This is a modified version of the keyboard reset code used in syscons. - * If the keyboard reset fails, we assume that the keyboard has been - * unplugged and we use a serial port (COM1) as the console instead. - * Returns 1 on failure (no keyboard), 0 on success (keyboard attached). - * - * This grody hack brought to you by Bill Paul (wpaul@ctr.columbia.edu) - * - * $Id: probe_keyboard.c,v 1.2 1997/03/31 03:12:15 weingart Exp $ - */ - -#ifdef PROBE_KEYBOARD - -#include <machine/console.h> -#include <machine/cpufunc.h> -#include "boot.h" - -int -probe_keyboard(void) -{ - int i, retries = 5; - unsigned char val; - - /* flush any noise in the buffer */ - while (inb(KB_STAT) & KB_BUF_FULL) { - delay1ms(); - (void) inb(KB_DATA); - } - - /* Try to reset keyboard hardware */ - again: - while (--retries) { -#ifdef DEBUG - printf("%d ", retries); -#endif - while ((inb(KB_STAT) & KB_READY) == KB_READY) delay1ms(); - outb(KB_DATA, KB_RESET); - for (i=0; i<1000; i++) { - delay1ms(); - val = inb(KB_DATA); - if (val == KB_ACK || val == KB_ECHO) - goto gotack; - if (val == KB_RESEND) - break; - } - } -gotres: -#ifdef DEBUG - printf("gotres\n"); -#endif - if (!retries) { -#ifdef DEBUG - printf("gave up\n"); -#endif - return(1); - } -gotack: - delay1ms(); - while ((inb(KB_STAT) & KB_BUF_FULL) == 0) delay1ms(); - delay1ms(); -#ifdef DEBUG - printf("ACK "); -#endif - val = inb(KB_DATA); - if (val == KB_ACK) - goto gotack; - if (val == KB_RESEND) - goto again; - if (val != KB_RESET_DONE) { -#ifdef DEBUG - printf("stray val %d\n", val); -#endif - return(0); - } -#ifdef DEBUG - printf("ok\n"); -#endif - return(0); -} - -#endif /* PROBE_KEYBOARD */ diff --git a/sys/arch/i386/stand/libsa/real_prot.S b/sys/arch/i386/stand/libsa/real_prot.S index 765c318cc76..ff7b4beaa6d 100644 --- a/sys/arch/i386/stand/libsa/real_prot.S +++ b/sys/arch/i386/stand/libsa/real_prot.S @@ -1,4 +1,4 @@ -/* $OpenBSD: real_prot.S,v 1.2 1997/03/31 03:12:16 weingart Exp $ */ +/* $OpenBSD: real_prot.S,v 1.3 1997/03/31 23:06:31 mickey Exp $ */ /* * Mach Operating System @@ -26,7 +26,6 @@ * the rights to redistribute these changes. * * from: Mach, Revision 2.2 92/04/04 11:34:13 rpd - * $Id: real_prot.S,v 1.2 1997/03/31 03:12:16 weingart Exp $ */ @@ -77,9 +76,8 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * transfer from real mode to protected mode. */ -.align 4,0x90 ENTRY(real_to_prot) - /* guarantee that interrupt is disabled when in prot mode */ + /* guarantee that interrupts are disabled when in prot mode */ cli /* load the gdtr */ @@ -108,6 +106,8 @@ ENTRY(real_to_prot) movl %ax, %ds movl %ax, %ss movl %ax, %es + movl %ax, %fs + movl %ax, %gs #ifndef NO_IDTR /* load idtr so we can debug */ @@ -122,44 +122,33 @@ ENTRY(real_to_prot) * */ -.align 4,0x90 ENTRY(prot_to_real) - /* - * This is self-modifying code, but we need a writable - * code segment, and an intersegment return does not give us that. - */ - movw _codeseg, %ax - pushw %ax - movw $2f, %ax - pushw %ax + movl _codeseg, %eax + # movw %ax, 2f /* Change to use16 mode. */ ljmp $0x18, $1f - -1: /* clear the PE bit of CR0 */ +1: + /* clear the PE bit of CR0 */ movl %cr0, %eax data32 andl $~CR0_PE, %eax movl %eax, %cr0 - /* - * make intersegment jmp to flush the processor pipeline - * using the fake stack frame set up earlier - * and reload CS register - */ -#if 0 - hlt -#endif - lret -2: /* - * we are in real mode now - * set up the real mode segment registers : DS, SS, ES - */ + data32 + # ljmp _codeseg, $2f + .byte 0xea + .long 3f +2: .word 0 +3: + /* setup: %ds, %es, %ss */ movl %cs, %ax movl %ax, %ds movl %ax, %ss movl %ax, %es + movl %ax, %fs + movl %ax, %gs #ifndef NO_IDTR /* load idtr so we can debug */ addr32 diff --git a/sys/arch/i386/stand/libsa/srt0.S b/sys/arch/i386/stand/libsa/srt0.S deleted file mode 100644 index e0c94c975eb..00000000000 --- a/sys/arch/i386/stand/libsa/srt0.S +++ /dev/null @@ -1,139 +0,0 @@ -/* $OpenBSD: srt0.S,v 1.2 1997/03/31 03:12:16 weingart Exp $ */ -/* $NetBSD: srt0.c,v 1.3 1994/10/27 04:21:59 cgd Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)srt0.c 5.3 (Berkeley) 4/28/91 - */ - -/* - * Startup code for standalone system - * Non-relocating version -- for programs which are loaded by boot - * Relocating version for boot - * Small relocating version for "micro" boot - */ - -#include <machine/psl.h> - - .globl _end - .globl _edata - .globl _boot - .globl __rtt - .globl _bootdev - .globl _boothowto - .globl _cyloffset - - .data - .globl _Gdtr -_Gdtr: - .long 0 - .word 0 -_bootdev: .long 0 -_boothowto: .long 0 -_cyloffset: .long 0 -_esym: .long 0 - - .text - -#define NOP inb $0x84,%al ; inb $0x84,%al - - .globl start_boot - -start_boot: - pushl %ebp - movl %esp, %ebp - - /* First, reset the PSL. */ - pushl $PSL_MBO - popfl - - movl 8(%ebp), %eax - movl %eax, _boothowto - movl 12(%ebp),%eax - movl %eax, _bootdev - movl 16(%ebp),%eax - movl %eax, _cyloffset - movl 20(%ebp),%eax - movl %eax, _esym - - /* save old stack state */ - movl %esp,savearea - movl %ebp,savearea+4 - -#if 0 - /* setup stack pointer */ - movl _end, %eax - addl $10000, %eax - movl %eax, %esp - - /* clear memory as needed */ - movl %esp,%esi - movl $_edata,%edx - - movl %esp,%eax - subl %edx,%eax - pushl %edx - pushl 0 - pushl %esp - call _memset - - #call _kbdreset /* resets keyboard and gatea20 brain damage */ - movl %esi,%esp -#endif - call _boot - jmp __rtt - - .data - -savearea: .long 0,0 # sp & bp to return to - - .text - -__rtt: - movl $-7,%eax -#ifdef REL -#ifndef SMALL - call _reset_cpu -#endif - movw $0x1234,%ax - movw %ax,0x472 # warm boot - movl $0,%esp # segment violation - ret -#else - movl savearea,%esp - movl savearea+4,%ebp - ret -#endif diff --git a/sys/arch/i386/stand/libsa/startprog.S b/sys/arch/i386/stand/libsa/startprog.S deleted file mode 100644 index 465c8f888a5..00000000000 --- a/sys/arch/i386/stand/libsa/startprog.S +++ /dev/null @@ -1,45 +0,0 @@ -/* $OpenBSD: startprog.S,v 1.2 1997/03/31 05:52:25 weingart Exp $ */ - -#include <machine/asm.h> - - -/* - * startprog(phyaddr, argv) - * start the program on protected mode where phyaddr is the entry point - */ -ENTRY(startprog) - pushl %ebp - movl %esp, %ebp - - # get things we need into registers - movl 8(%ebp), %ecx # entry offset - movl 12(%ebp), %eax # &argv - - # make a new stack at 0:0x90000 (big segs) - movl $0x10, %ebx - movw %bx, %ss - movl $0x90000, %ebx - movl %ebx, %esp - - # push some number of args onto the stack - pushl 28(%eax) # argv[7] = cnvmem - pushl 32(%eax) # argv[8] = extmem - pushl 16(%eax) # argv[4] = esym - pushl 12(%eax) # argv[3] = cyl offset - pushl 8(%eax) # argv[2] = bootdev - pushl 4(%eax) # argv[1] = howto - pushl $0 # dummy 'return' address - - # push on our entry address - movl $0x8, %ebx # segment - pushl %bx - pushl %ecx - - # convert over the other data segs - movl $0x10, %ebx - movl %bx, %ds - movl %bx, %es - - # convert the PC (and code seg) - lret - |