Changes: Boot omagic kernels (like Mach), pass cnvmem, extmem, and esym args, load symbol table into memory, enable kbd clock.
This commit is contained in:
parent
534b51feac
commit
966d7491cc
|
@ -29,12 +29,15 @@
|
|||
/*
|
||||
* HISTORY
|
||||
* $Log: asm.S,v $
|
||||
* Revision 1.2 1993/07/11 12:02:19 andrew
|
||||
* Fixes from bde, including support for loading @ any MB boundary (e.g. a
|
||||
* kernel linked for 0xfe100000 will load at the 1MB mark) and read-ahead
|
||||
* buffering to speed booting from floppies. Also works with aha174x
|
||||
* controllers in enhanced mode.
|
||||
* Revision 1.3 1993/08/28 01:18:52 brezak
|
||||
* Changes: Boot omagic kernels (like Mach), pass cnvmem, extmem, and esym args, load symbol table into memory, enable kbd clock.
|
||||
*
|
||||
Revision 1.2 1993/07/11 12:02:19 andrew
|
||||
Fixes from bde, including support for loading @ any MB boundary (e.g. a
|
||||
kernel linked for 0xfe100000 will load at the 1MB mark) and read-ahead
|
||||
buffering to speed booting from floppies. Also works with aha174x
|
||||
controllers in enhanced mode.
|
||||
|
||||
*
|
||||
* 93/06/28 bde
|
||||
* Switch IDT for debugger.
|
||||
|
@ -203,6 +206,9 @@ ENTRY(startprog)
|
|||
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 $0 # nominally a cyl offset in the boot.
|
||||
pushl 0x8(%eax) # argv[2] = bootdev
|
||||
pushl 0x4(%eax) # argv[1] = howto
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*
|
||||
* $Id: boot.c,v 1.9 1993/08/02 17:52:14 mycroft Exp $
|
||||
* $Id: boot.c,v 1.10 1993/08/28 01:18:43 brezak Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -57,12 +57,17 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <sys/reboot.h>
|
||||
|
||||
struct exec head;
|
||||
int argv[10], esym;
|
||||
int argv[9];
|
||||
char *name;
|
||||
char *names[] = {
|
||||
#ifdef MACH
|
||||
"/mach", "/mach.old",
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
"/netbsd", "/onetbsd", "/netbsd.old",
|
||||
#else
|
||||
"/386bsd", "/o386bsd", "/386bsd.old",
|
||||
"/vmunix", "/ovmunix", "/vmunix.old"
|
||||
#endif
|
||||
};
|
||||
#define NUMNAMES (sizeof(names)/sizeof(char *))
|
||||
|
||||
|
@ -73,12 +78,11 @@ int drive;
|
|||
int loadflags, currname = 0;
|
||||
char *t;
|
||||
|
||||
printf("\n>> NetBSD BOOT @ 0x%x: %d/%d k of memory [%s]\n",
|
||||
printf("\n>> NetBSD BOOT @ 0x%x: %d/%d k [%s]\n",
|
||||
ouraddr,
|
||||
argv[7] = memsize(0),
|
||||
argv[8] = memsize(1),
|
||||
"$Revision: 1.9 $");
|
||||
printf("use options hd(1,...... to boot sd0 when wd0 is also installed\n");
|
||||
"$Revision: 1.10 $");
|
||||
gateA20();
|
||||
loadstart:
|
||||
/***************************************************************\
|
||||
|
@ -87,6 +91,7 @@ loadstart:
|
|||
\***************************************************************/
|
||||
part = unit = 0;
|
||||
maj = (drive&0x80 ? 0 : 2); /* a good first bet */
|
||||
|
||||
name = names[currname++];
|
||||
|
||||
loadflags = 0;
|
||||
|
@ -97,9 +102,10 @@ loadstart:
|
|||
printf("Can't find %s\n", name);
|
||||
goto loadstart;
|
||||
}
|
||||
/* if (inode.i_mode&IEXEC)
|
||||
#if 0
|
||||
if (inode.i_mode&IEXEC)
|
||||
loadflags |= RB_KDB;
|
||||
*/
|
||||
#endif
|
||||
loadprog(loadflags);
|
||||
goto loadstart;
|
||||
}
|
||||
|
@ -110,7 +116,7 @@ loadprog(howto)
|
|||
long int startaddr;
|
||||
long int addr; /* physical address.. not directly useable */
|
||||
long int addr0;
|
||||
int i;
|
||||
int i, omagic;
|
||||
static int (*x_entry)() = 0;
|
||||
unsigned char tmpbuf[4096]; /* we need to load the first 4k here */
|
||||
|
||||
|
@ -122,9 +128,10 @@ loadprog(howto)
|
|||
return;
|
||||
}
|
||||
|
||||
omagic = N_GETMAGIC(head) == OMAGIC;
|
||||
if(omagic) poff = sizeof(struct exec);
|
||||
else
|
||||
poff = N_TXTOFF(head);
|
||||
/*if(poff==0)
|
||||
poff = 32;*/
|
||||
|
||||
startaddr = (int)head.a_entry;
|
||||
addr = (startaddr & 0x00f00000); /* some MEG boundary */
|
||||
|
@ -170,6 +177,7 @@ loadprog(howto)
|
|||
/********************************************************/
|
||||
/* Load the Initialised data after the text */
|
||||
/********************************************************/
|
||||
if(!omagic)
|
||||
while (addr & CLOFSET)
|
||||
*(char *)addr++ = 0;
|
||||
|
||||
|
@ -190,9 +198,8 @@ loadprog(howto)
|
|||
{
|
||||
pbzero(addr,head.a_bss);
|
||||
}
|
||||
argv[3] = (addr += head.a_bss);
|
||||
|
||||
#ifdef LOADSYMS /* not yet, haven't worked this out yet */
|
||||
argv[3] = (addr += head.a_bss);
|
||||
if (addr > 0x100000)
|
||||
{
|
||||
/********************************************************/
|
||||
|
@ -204,7 +211,7 @@ loadprog(howto)
|
|||
/********************************************************/
|
||||
/* READ in the symbol table */
|
||||
/********************************************************/
|
||||
printf("symbols=[+0x%x", head.a_syms);
|
||||
printf("symbols=[0x%x", head.a_syms);
|
||||
xread(addr, head.a_syms);
|
||||
addr += head.a_syms;
|
||||
|
||||
|
@ -214,36 +221,40 @@ loadprog(howto)
|
|||
/********************************************************/
|
||||
read(&i, sizeof(int));
|
||||
pcpy(&i, addr, sizeof(int));
|
||||
if (i) {
|
||||
i -= sizeof(int);
|
||||
addr += sizeof(int);
|
||||
|
||||
xread(addr, i);
|
||||
addr += i;
|
||||
}
|
||||
|
||||
/********************************************************/
|
||||
/* and that many bytes of (debug symbols?) */
|
||||
/********************************************************/
|
||||
printf("+0x%x] ", i);
|
||||
xread(addr, i);
|
||||
addr += i;
|
||||
argv[4] = ((addr+sizeof(int)-1))&~(sizeof(int)-1);
|
||||
}
|
||||
#endif LOADSYMS
|
||||
|
||||
/********************************************************/
|
||||
/* and note the end address of all this */
|
||||
/********************************************************/
|
||||
|
||||
argv[4] = ((addr+sizeof(int)-1))&~(sizeof(int)-1);
|
||||
printf("total=0x%x ",argv[4]);
|
||||
printf("total=0x%x ",(addr+sizeof(int)-1))&~(sizeof(int)-1);
|
||||
|
||||
|
||||
/*
|
||||
* We now pass the various bootstrap parameters to the loaded
|
||||
* image via the argument list
|
||||
* (THIS IS A BIT OF HISTORY FROM MACH.. LEAVE FOR NOW)
|
||||
*
|
||||
* arg0 = 8 (magic)
|
||||
* arg1 = boot flags
|
||||
* arg2 = boot device
|
||||
* arg3 = start of symbol table (0 if not loaded)
|
||||
* 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)
|
||||
*/
|
||||
switch(maj)
|
||||
{
|
||||
|
@ -262,7 +273,7 @@ loadprog(howto)
|
|||
/****************************************************************/
|
||||
/* copy that first page and overwrite any BIOS variables */
|
||||
/****************************************************************/
|
||||
printf("entry point=0x%x\n" ,((int)startaddr) & 0xffffff);
|
||||
/*printf("entry point=0x%x\n" ,((int)startaddr) & 0xffffff);*/
|
||||
/* Under no circumstances overwrite precious BIOS variables! */
|
||||
pcpy(tmpbuf, addr0, 0x400);
|
||||
pcpy(tmpbuf + 0x500, addr0 + 0x500, 4096 - 0x500);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*
|
||||
* $Id: io.c,v 1.4 1993/08/02 17:52:16 mycroft Exp $
|
||||
* $Id: io.c,v 1.5 1993/08/28 01:19:01 brezak Exp $
|
||||
*/
|
||||
|
||||
#include <i386/include/pio.h>
|
||||
|
@ -39,10 +39,10 @@
|
|||
|
||||
#define KC_CMD_WIN 0xd0 /* read output port */
|
||||
#define KC_CMD_WOUT 0xd1 /* write output port */
|
||||
#define KB_A20 0x9f /* enable A20,
|
||||
#define KB_A20 0xdf /* enable A20,
|
||||
enable output buffer full interrupt
|
||||
enable data line
|
||||
disable clock line */
|
||||
enable clock line */
|
||||
|
||||
/*
|
||||
* Gate A20 for high memory
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* any improvements or extensions that they make and grant Carnegie Mellon
|
||||
* the rights to redistribute these changes.
|
||||
*
|
||||
* $Id: version.c,v 1.9 1993/08/02 17:52:14 mycroft Exp $
|
||||
* $Id: version.c,v 1.10 1993/08/28 01:18:43 brezak Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -57,12 +57,17 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <sys/reboot.h>
|
||||
|
||||
struct exec head;
|
||||
int argv[10], esym;
|
||||
int argv[9];
|
||||
char *name;
|
||||
char *names[] = {
|
||||
#ifdef MACH
|
||||
"/mach", "/mach.old",
|
||||
#endif
|
||||
#ifdef __NetBSD__
|
||||
"/netbsd", "/onetbsd", "/netbsd.old",
|
||||
#else
|
||||
"/386bsd", "/o386bsd", "/386bsd.old",
|
||||
"/vmunix", "/ovmunix", "/vmunix.old"
|
||||
#endif
|
||||
};
|
||||
#define NUMNAMES (sizeof(names)/sizeof(char *))
|
||||
|
||||
|
@ -73,12 +78,11 @@ int drive;
|
|||
int loadflags, currname = 0;
|
||||
char *t;
|
||||
|
||||
printf("\n>> NetBSD BOOT @ 0x%x: %d/%d k of memory [%s]\n",
|
||||
printf("\n>> NetBSD BOOT @ 0x%x: %d/%d k [%s]\n",
|
||||
ouraddr,
|
||||
argv[7] = memsize(0),
|
||||
argv[8] = memsize(1),
|
||||
"$Revision: 1.9 $");
|
||||
printf("use options hd(1,...... to boot sd0 when wd0 is also installed\n");
|
||||
"$Revision: 1.10 $");
|
||||
gateA20();
|
||||
loadstart:
|
||||
/***************************************************************\
|
||||
|
@ -87,6 +91,7 @@ loadstart:
|
|||
\***************************************************************/
|
||||
part = unit = 0;
|
||||
maj = (drive&0x80 ? 0 : 2); /* a good first bet */
|
||||
|
||||
name = names[currname++];
|
||||
|
||||
loadflags = 0;
|
||||
|
@ -97,9 +102,10 @@ loadstart:
|
|||
printf("Can't find %s\n", name);
|
||||
goto loadstart;
|
||||
}
|
||||
/* if (inode.i_mode&IEXEC)
|
||||
#if 0
|
||||
if (inode.i_mode&IEXEC)
|
||||
loadflags |= RB_KDB;
|
||||
*/
|
||||
#endif
|
||||
loadprog(loadflags);
|
||||
goto loadstart;
|
||||
}
|
||||
|
@ -110,7 +116,7 @@ loadprog(howto)
|
|||
long int startaddr;
|
||||
long int addr; /* physical address.. not directly useable */
|
||||
long int addr0;
|
||||
int i;
|
||||
int i, omagic;
|
||||
static int (*x_entry)() = 0;
|
||||
unsigned char tmpbuf[4096]; /* we need to load the first 4k here */
|
||||
|
||||
|
@ -122,9 +128,10 @@ loadprog(howto)
|
|||
return;
|
||||
}
|
||||
|
||||
omagic = N_GETMAGIC(head) == OMAGIC;
|
||||
if(omagic) poff = sizeof(struct exec);
|
||||
else
|
||||
poff = N_TXTOFF(head);
|
||||
/*if(poff==0)
|
||||
poff = 32;*/
|
||||
|
||||
startaddr = (int)head.a_entry;
|
||||
addr = (startaddr & 0x00f00000); /* some MEG boundary */
|
||||
|
@ -170,6 +177,7 @@ loadprog(howto)
|
|||
/********************************************************/
|
||||
/* Load the Initialised data after the text */
|
||||
/********************************************************/
|
||||
if(!omagic)
|
||||
while (addr & CLOFSET)
|
||||
*(char *)addr++ = 0;
|
||||
|
||||
|
@ -190,9 +198,8 @@ loadprog(howto)
|
|||
{
|
||||
pbzero(addr,head.a_bss);
|
||||
}
|
||||
argv[3] = (addr += head.a_bss);
|
||||
|
||||
#ifdef LOADSYMS /* not yet, haven't worked this out yet */
|
||||
argv[3] = (addr += head.a_bss);
|
||||
if (addr > 0x100000)
|
||||
{
|
||||
/********************************************************/
|
||||
|
@ -204,7 +211,7 @@ loadprog(howto)
|
|||
/********************************************************/
|
||||
/* READ in the symbol table */
|
||||
/********************************************************/
|
||||
printf("symbols=[+0x%x", head.a_syms);
|
||||
printf("symbols=[0x%x", head.a_syms);
|
||||
xread(addr, head.a_syms);
|
||||
addr += head.a_syms;
|
||||
|
||||
|
@ -214,36 +221,40 @@ loadprog(howto)
|
|||
/********************************************************/
|
||||
read(&i, sizeof(int));
|
||||
pcpy(&i, addr, sizeof(int));
|
||||
if (i) {
|
||||
i -= sizeof(int);
|
||||
addr += sizeof(int);
|
||||
|
||||
xread(addr, i);
|
||||
addr += i;
|
||||
}
|
||||
|
||||
/********************************************************/
|
||||
/* and that many bytes of (debug symbols?) */
|
||||
/********************************************************/
|
||||
printf("+0x%x] ", i);
|
||||
xread(addr, i);
|
||||
addr += i;
|
||||
argv[4] = ((addr+sizeof(int)-1))&~(sizeof(int)-1);
|
||||
}
|
||||
#endif LOADSYMS
|
||||
|
||||
/********************************************************/
|
||||
/* and note the end address of all this */
|
||||
/********************************************************/
|
||||
|
||||
argv[4] = ((addr+sizeof(int)-1))&~(sizeof(int)-1);
|
||||
printf("total=0x%x ",argv[4]);
|
||||
printf("total=0x%x ",(addr+sizeof(int)-1))&~(sizeof(int)-1);
|
||||
|
||||
|
||||
/*
|
||||
* We now pass the various bootstrap parameters to the loaded
|
||||
* image via the argument list
|
||||
* (THIS IS A BIT OF HISTORY FROM MACH.. LEAVE FOR NOW)
|
||||
*
|
||||
* arg0 = 8 (magic)
|
||||
* arg1 = boot flags
|
||||
* arg2 = boot device
|
||||
* arg3 = start of symbol table (0 if not loaded)
|
||||
* 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)
|
||||
*/
|
||||
switch(maj)
|
||||
{
|
||||
|
@ -262,7 +273,7 @@ loadprog(howto)
|
|||
/****************************************************************/
|
||||
/* copy that first page and overwrite any BIOS variables */
|
||||
/****************************************************************/
|
||||
printf("entry point=0x%x\n" ,((int)startaddr) & 0xffffff);
|
||||
/*printf("entry point=0x%x\n" ,((int)startaddr) & 0xffffff);*/
|
||||
/* Under no circumstances overwrite precious BIOS variables! */
|
||||
pcpy(tmpbuf, addr0, 0x400);
|
||||
pcpy(tmpbuf + 0x500, addr0 + 0x500, 4096 - 0x500);
|
||||
|
|
Loading…
Reference in New Issue