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 Change all .S files to use .code16 and ....



details:   https://anonhg.NetBSD.org/src/rev/d00c4b14ed04
branches:  trunk
changeset: 542555:d00c4b14ed04
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sat Feb 01 14:48:16 2003 +0000

description:
Change all .S files to use .code16 and .code32
Support 32bit addresses >64k as valid on bios calls.
Move stack for dosboot and biosboot to >64 so stack doesn't hit data.
Use disk sector number passed by mbr code to select default partition
(the mbr code doesn't do this yet).
NB only biosboot and dosboot have been tested so far.
(changes approved by christos and fvdl)

diffstat:

 sys/arch/i386/stand/Makefile.booters                  |   23 +-
 sys/arch/i386/stand/biosboot/Makefile                 |    7 +-
 sys/arch/i386/stand/biosboot/devopen.c                |   10 +-
 sys/arch/i386/stand/biosboot/devopen.h                |    4 +-
 sys/arch/i386/stand/biosboot/main.c                   |  127 +--
 sys/arch/i386/stand/biosboot/version                  |    6 +-
 sys/arch/i386/stand/dosboot/Makefile                  |    6 +-
 sys/arch/i386/stand/dosboot/version                   |    4 +-
 sys/arch/i386/stand/lib/bios_disk.S                   |   64 +-
 sys/arch/i386/stand/lib/bios_pci.S                    |   34 +-
 sys/arch/i386/stand/lib/biosdelay.S                   |    7 +-
 sys/arch/i386/stand/lib/biosdisk.c                    |  166 +++-
 sys/arch/i386/stand/lib/biosdisk.h                    |   12 +-
 sys/arch/i386/stand/lib/biosdisk_ll.c                 |   52 +-
 sys/arch/i386/stand/lib/biosgetrtc.S                  |    8 +-
 sys/arch/i386/stand/lib/biosmca.S                     |   26 +-
 sys/arch/i386/stand/lib/biosmem.S                     |   18 +-
 sys/arch/i386/stand/lib/biosmemx.S                    |   20 +-
 sys/arch/i386/stand/lib/biosreboot.S                  |    7 +-
 sys/arch/i386/stand/lib/biosvideomode.S               |    8 +-
 sys/arch/i386/stand/lib/bootinfo_biosgeom.c           |   10 +-
 sys/arch/i386/stand/lib/comio.S                       |   24 +-
 sys/arch/i386/stand/lib/conio.S                       |   26 +-
 sys/arch/i386/stand/lib/crt/bootsect/bootsectmain.c   |   14 +-
 sys/arch/i386/stand/lib/crt/bootsect/start_bootsect.S |  567 +++++++++--------
 sys/arch/i386/stand/lib/crt/dos/start_dos.S           |  273 ++++++--
 sys/arch/i386/stand/lib/crt/pxe/start_pxe.S           |  123 +--
 sys/arch/i386/stand/lib/crt/rom/start_rom.S           |  212 ++---
 sys/arch/i386/stand/lib/diskbuf.c                     |   26 +-
 sys/arch/i386/stand/lib/diskbuf.h                     |    7 +-
 sys/arch/i386/stand/lib/dos_file.S                    |  116 +-
 sys/arch/i386/stand/lib/dosfile.c                     |    9 +-
 sys/arch/i386/stand/lib/pcio.c                        |   23 +-
 sys/arch/i386/stand/lib/pread.c                       |    7 +-
 sys/arch/i386/stand/lib/startprog.S                   |    6 +-
 sys/arch/i386/stand/netboot/version                   |    3 +-
 sys/arch/i386/stand/pxeboot/pxe_call.S                |   35 +-
 sys/arch/i386/stand/pxeboot/version                   |    3 +-
 38 files changed, 1152 insertions(+), 941 deletions(-)

diffs (truncated from 4235 to 300 lines):

diff -r 0a474ba16b0c -r d00c4b14ed04 sys/arch/i386/stand/Makefile.booters
--- a/sys/arch/i386/stand/Makefile.booters      Sat Feb 01 13:53:36 2003 +0000
+++ b/sys/arch/i386/stand/Makefile.booters      Sat Feb 01 14:48:16 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.booters,v 1.40 2003/01/29 18:44:47 fvdl Exp $
+#      $NetBSD: Makefile.booters,v 1.41 2003/02/01 14:48:16 dsl Exp $
 
 .include <bsd.own.mk>
 
@@ -54,7 +54,7 @@
 KERNMISCMAKEFLAGS="LIBKERN_ARCH=i386"
 .endif
 
-CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list ${BASE}.ldscript
+CLEANFILES+= ${STARTFILE} vers.c ${BASE}.list
 SRCS+= vers.c
 
 .if !make(obj) && !make(clean) && !make(cleandir)
@@ -110,25 +110,8 @@
 
 CLEANFILES+= ${BASE}.sym
 ${BASE}.sym: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
-       @# A default link has a 4k gap between the rodata and data.
-       @# We don't need it here - and are short of space!
-       @# The -N option might work - but it puts the code at offset
-       @# 0x80 in the file.
-       @# Get linker to tell us its link script and remove the line.
-       @rm -f ${BASE}.ldscript
-       @ ${LD} --verbose >${BASE}.ldscript
-       @ printf '%b' "1,/^===/d\n/ALIGN(0x1000.*)/\nd\n/^===/\nd\nwq\n" \
-               | ed -s ${BASE}.ldscript >/dev/null
-       ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} -T ${BASE}.ldscript \
+       ${LD} -o ${BASE}.sym ${LDFLAGS} -Ttext ${RELOC} \
            ${STARTFILE} ${OBJS} ${LIBLIST} >${BASE}.list
-       @# The code, bss, data and stack are restricted to one 64k segment.
-       @# Check there is a 'moderate' amount (4k) of stack space.
-       @# 2k isn't enough, 3.5k might be (but harder to test for).
-       @# If the stack is too small hair starts being pulled out.
-       @ grep '^[ 0x]*[a-e].*PROVIDE (end, .)$$' ${BASE}.list >/dev/null || { \
-               echo "*** Less that 4k stack space in biosboot" >&2; \
-               rm -f ${BASE}.sym; \
-               false; }
 
 CLEANFILES+= ${BASE}.rom
 ${BASE}.rom: ${STARTFILE} ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBI386}
diff -r 0a474ba16b0c -r d00c4b14ed04 sys/arch/i386/stand/biosboot/Makefile
--- a/sys/arch/i386/stand/biosboot/Makefile     Sat Feb 01 13:53:36 2003 +0000
+++ b/sys/arch/i386/stand/biosboot/Makefile     Sat Feb 01 14:48:16 2003 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.40 2003/01/14 23:53:31 thorpej Exp $
+#      $NetBSD: Makefile,v 1.41 2003/02/01 14:48:17 dsl Exp $
 
 S=     ${.CURDIR}/../../../../
 
@@ -59,6 +59,11 @@
 #CFLAGS= -O2 -fomit-frame-pointer -fno-defer-pop
 CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main
 
+# The biosboot code is linked to 'virtual' address of zero and is
+# loaded at physical address 0x10000.
+# With these values there is 128kb for code, data and stack.
+# XXX The values should be determined from _end.
+CPPFLAGS+= -DSTACK_START=0x10000
 SAMISCCPPFLAGS+= -DHEAP_START=0x20000 -DHEAP_LIMIT=0x50000
 SAMISCMAKEFLAGS+= SA_USE_CREAD=yes     # Read compressed kernels
 SAMISCMAKEFLAGS+= SA_INCLUDE_NET=no    # Netboot via TFTP, NFS
diff -r 0a474ba16b0c -r d00c4b14ed04 sys/arch/i386/stand/biosboot/devopen.c
--- a/sys/arch/i386/stand/biosboot/devopen.c    Sat Feb 01 13:53:36 2003 +0000
+++ b/sys/arch/i386/stand/biosboot/devopen.c    Sat Feb 01 14:48:16 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: devopen.c,v 1.11 2001/06/01 23:26:30 jdolecek Exp $     */
+/*     $NetBSD: devopen.c,v 1.12 2003/02/01 14:48:17 dsl Exp $  */
 
 /*
  * Copyright (c) 1996, 1997
@@ -66,10 +66,7 @@
 }
 
 int
-bios2dev(biosdev, devname, unit)
-       int             biosdev;
-       char          **devname;
-       unsigned int   *unit;
+bios2dev(int biosdev, char **devname, u_int *unit, u_int sector, u_int *ptnp)
 {
        if (biosdev & 0x80)
                *devname = "hd";
@@ -77,8 +74,9 @@
                *devname = "fd";
 
        *unit = biosdev & 0x7f;
+       *ptnp = biosdiskfindptn(biosdev, sector);
 
-       return (0);
+       return 0;
 }
 
 #ifdef _STANDALONE
diff -r 0a474ba16b0c -r d00c4b14ed04 sys/arch/i386/stand/biosboot/devopen.h
--- a/sys/arch/i386/stand/biosboot/devopen.h    Sat Feb 01 13:53:36 2003 +0000
+++ b/sys/arch/i386/stand/biosboot/devopen.h    Sat Feb 01 14:48:16 2003 +0000
@@ -1,3 +1,3 @@
-/* $NetBSD: devopen.h,v 1.1 1999/04/14 11:45:39 drochner Exp $ */
+/* $NetBSD: devopen.h,v 1.2 2003/02/01 14:48:17 dsl Exp $ */
 
-int bios2dev __P((int, char **, unsigned int *));
+int bios2dev(int, char **, u_int *, u_int, u_int *);
diff -r 0a474ba16b0c -r d00c4b14ed04 sys/arch/i386/stand/biosboot/main.c
--- a/sys/arch/i386/stand/biosboot/main.c       Sat Feb 01 13:53:36 2003 +0000
+++ b/sys/arch/i386/stand/biosboot/main.c       Sat Feb 01 14:48:16 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.29 2002/06/01 11:40:32 itojun Exp $ */
+/*     $NetBSD: main.c,v 1.30 2003/02/01 14:48:17 dsl Exp $    */
 
 /*
  * Copyright (c) 1996, 1997, 1999
@@ -53,6 +53,7 @@
 
 int errno;
 extern int boot_biosdev;
+extern int boot_biossector;    /* may be wrong... */
 
 extern const char bootprog_name[], bootprog_rev[], bootprog_date[],
        bootprog_maker[];
@@ -61,7 +62,7 @@
     "netbsd", "netbsd.gz",
     "netbsd.old", "netbsd.old.gz",
     "onetbsd", "onetbsd.gz",
-#ifdef notyet    
+#ifdef notyet
     "netbsd.el", "netbsd.el.gz",
 #endif /*notyet*/
 };
@@ -83,12 +84,12 @@
 void print_banner __P((void));
 void main __P((void));
 
-void   command_help __P((char *));
-void   command_ls __P((char *));
-void   command_quit __P((char *));
-void   command_boot __P((char *));
-void   command_dev __P((char *));
-void   command_consdev __P((char *));
+void   command_help(char *);
+void   command_ls(char *);
+void   command_quit(char *);
+void   command_boot(char *);
+void   command_dev(char *);
+void   command_consdev(char *);
 
 const struct bootblk_command commands[] = {
        { "help",       command_help },
@@ -104,14 +105,10 @@
 };
 
 int
-parsebootfile(fname, fsname, devname, unit, partition, file)
-       const char *fname;
-       char **fsname; /* out */
-       char **devname; /* out */
-       unsigned int *unit, *partition; /* out */
-       const char **file; /* out */
+parsebootfile(const char *fname, char **fsname, char **devname,
+       u_int *unit, u_int *partition, const char **file)
 {
-       const char *col, *help;
+       const char *col;
 
        *fsname = "ufs";
        *devname = default_devname;
@@ -164,25 +161,23 @@
                *devname = savedevname;
                *unit = u;
                *partition = p;
-               help = col + 1;
-       } else
-               help = fname;
+               fname = col + 1;
+       }
 
-       if (*help)
-               *file = help;
+       if (*fname)
+               *file = fname;
 
        return(0);
 }
 
 char *
-sprint_bootsel(filename)
-       const char *filename;
+sprint_bootsel(const char *filename)
 {
        char *fsname, *devname;
        int unit, partition;
        const char *file;
        static char buf[80];
-       
+
        if (parsebootfile(filename, &fsname, &devname, &unit,
                          &partition, &file) == 0) {
                sprintf(buf, "%s%d%c:%s", devname, unit, 'a' + partition, file);
@@ -192,9 +187,7 @@
 }
 
 void
-bootit(filename, howto, tell)
-       const char *filename;
-       int howto, tell;
+bootit(const char *filename, int howto, int tell)
 {
 
        if (tell) {
@@ -212,7 +205,7 @@
 }
 
 void
-print_banner()
+print_banner(void)
 {
 
        printf("\n");
@@ -222,12 +215,12 @@
 }
 
 
-/* 
+/*
  * note: normally, void main() wouldn't be legal, but this isn't a
  * hosted environment...
  */
 void
-main()
+main(void)
 {
        int currname;
        char c;
@@ -250,8 +243,8 @@
        print_banner();
 
        /* try to set default device to what BIOS tells us */
-       bios2dev(boot_biosdev, &default_devname, &default_unit);
-       default_partition = 0;
+       bios2dev(boot_biosdev, &default_devname, &default_unit,
+               boot_biossector, &default_partition);
 
        /* if the user types "boot" without filename */
        default_filename = DEFFILENAME;
@@ -291,8 +284,7 @@
 
 /* ARGSUSED */
 void
-command_help(arg)
-       char *arg;
+command_help(char *arg)
 {
 
        printf("commands are:\n"
@@ -308,8 +300,7 @@
 }
 
 void
-command_ls(arg)
-       char *arg;
+command_ls(char *arg)
 {
        const char *save = default_filename;
 
@@ -320,8 +311,7 @@
 
 /* ARGSUSED */
 void
-command_quit(arg)
-       char *arg;
+command_quit(char *arg)
 {
 
        printf("Exiting...\n");
@@ -333,8 +323,7 @@
 }
 
 void
-command_boot(arg)
-       char *arg;
+command_boot(char *arg)
 {
        char *filename;
        int howto;
@@ -344,8 +333,7 @@
 }
 
 void
-command_dev(arg)
-       char *arg;
+command_dev(char *arg)
 {
        static char savedevname[MAXDEVNAME + 1];
        char *fsname, *devname;
@@ -363,40 +351,41 @@
                command_help(NULL);



Home | Main Index | Thread Index | Old Index