pmap.c, machdep.c, autoconf.c, cpu.c, intr.c, : net-posted patches from Torek

autoconf.c: mountroot kludges that need fixing later
clock.c: two volatile decls
conf.c: stategy()'s return void, *tty[] not tty[], __P()'d xxdump() calls,
	add mem_no, *constty[] not &cons.
genassym.c, machdep.c: sys/vmmeter.h needed
intr.c: make kernel writable temporarily in intr_fasttrap()
intr.c: do not use NETISR_ARP
locore.s: icode maps at 0 so do not relocate, don't define __main here.
machdep.c: don't have sysctl.h (yet), use vm_page_free_count for freemem,
	setregs() sets pc/npc/stack, note: signal delivery code needs
	fixing, add various other NetBSD function stubs.
pmap.c: do kernel_pmap/kernel_pmap_store the old way, delete
	vm_page_startup_initialized weirdness.
swapgeneric.c: everything about mountroot needs fixing, help.
trap.c: sunsys -> sun_sysent, etc.
vm_machdep.c: don't use cpu_coredump() for now.
This commit is contained in:
deraadt 1993-10-11 02:16:12 +00:00
parent e98e3183fc
commit ed575390ee
12 changed files with 427 additions and 155 deletions

View File

@ -42,7 +42,7 @@
* @(#)autoconf.c 8.1 (Berkeley) 6/11/93
*
* from: Header: autoconf.c,v 1.32 93/05/28 03:55:59 torek Exp (LBL)
* $Id: autoconf.c,v 1.1 1993/10/02 10:24:01 deraadt Exp $
* $Id: autoconf.c,v 1.2 1993/10/11 02:16:12 deraadt Exp $
*/
#include <sys/param.h>
@ -82,10 +82,13 @@ void setroot __P((void));
static int getstr __P((char *, int));
static int findblkmajor __P((struct dkdevice *));
static struct device *getdisk __P((char *, int, int, dev_t *));
static struct device *parsedisk __P((char *, int, int, dev_t *));
struct bootpath bootpath[8];
/* TDR -- this is a hack, and the entire file needs redoing */
extern int ufs_mountroot();
int (*mountroot)() = ufs_mountroot;
/*
* Most configuration on the SPARC is done by matching OPENPROM Forth
* device names with our internal names.
@ -439,11 +442,20 @@ mainbus_attach(parent, dev, aux)
struct romaux ra;
static const char *const special[] = {
/* find these first (end with empty string) */
"memory-error", "eeprom", "counter-timer", "",
"eeprom",
"counter-timer",
"memory-error",
"",
/* ignore these (end with NULL) */
"options", "packages", "openprom", "memory", "virtual-memory",
"interrupt-enable", NULL
"aliases",
"interrupt-enable",
"memory",
"openprom",
"options",
"packages",
"virtual-memory",
NULL
};
printf("\n");
@ -722,6 +734,7 @@ nextsibling(node)
return (promvec->pv_nodeops->no_nextnode(node));
}
#ifdef RCONSOLE
/* Pass a string to the FORTH PROM to be interpreted */
void
rominterpret(s)
@ -734,6 +747,35 @@ rominterpret(s)
promvec->pv_fortheval.v2_eval(s);
}
/*
* Try to figure out where the PROM stores the cursor row & column
* variables. Returns nonzero on error.
*/
int
romgetcursoraddr(rowp, colp)
register int **rowp, **colp;
{
char buf[100];
/*
* line# and column# are global in older proms (rom vector < 2)
* and in some newer proms. They are local in version 2.9. The
* correct cutoff point is unknown, as yet; we use 2.9 here.
*/
if (promvec->pv_romvec_vers < 2 || promvec->pv_printrev < 0x00020009)
sprintf(buf,
"' line# >body >user %x ! ' column# >body >user %x !",
rowp, colp);
else
sprintf(buf,
"stdout @ is my-self addr line# %x ! addr column# %x !",
rowp, colp);
*rowp = *colp = NULL;
rominterpret(buf);
return (*rowp == NULL || *colp == NULL);
}
#endif
volatile void
romhalt()
{
@ -798,7 +840,7 @@ findblkmajor(dv)
return (-1);
}
static struct device *
struct device *
getdisk(str, len, defpart, devp)
char *str;
int len, defpart;
@ -816,26 +858,27 @@ getdisk(str, len, defpart, devp)
return (dv);
}
static struct device *
struct device *
parsedisk(str, len, defpart, devp)
char *str;
int len, defpart;
dev_t *devp;
{
register struct device *dv;
register char *cp;
register char *cp, c;
int majdev, mindev, part;
if (len == 0)
return (NULL);
cp = str + len - 1;
if (*cp >= 'a' && *cp <= 'h') {
part = *cp - 'a';
*cp-- = '\0';
c = *cp;
if (c >= 'a' && c <= 'h') {
part = c - 'a';
*cp = '\0';
} else
part = defpart;
for (dv = alldevs; dv != NULL; dv = dv->dv_next)
for (dv = alldevs; dv != NULL; dv = dv->dv_next) {
if (dv->dv_class == DV_DISK &&
strcmp(str, dv->dv_xname) == 0) {
majdev = findblkmajor((struct dkdevice *)dv);
@ -843,10 +886,11 @@ parsedisk(str, len, defpart, devp)
panic("parsedisk");
mindev = (dv->dv_unit << PARTITIONSHIFT) + part;
*devp = makedev(majdev, mindev);
return (dv);
break;
}
}
return (NULL);
return (dv);
}
/*
@ -862,11 +906,12 @@ setroot()
register int len, majdev, mindev, part;
dev_t nrootdev, nswapdev;
char buf[128];
extern int (*mountroot)();
#ifdef DOSWAP
dev_t temp;
#endif
#ifdef NFS
extern int (*mountroot)(), nfs_mountroot();
#if defined(NFSCLIENT)
extern int nfs_mountroot();
#endif
if (boothowto & RB_ASKNAME) {
@ -918,12 +963,9 @@ gotswap:
switch (bootdv->dv_class) {
#ifdef NFS
#if defined(NFSCLIENT)
case DV_IFNET:
mountroot = nfs_mountroot;
#ifdef LBL
lbl_diskless_setup();
#endif
return;
#endif

View File

@ -42,7 +42,7 @@
* @(#)clock.c 8.1 (Berkeley) 6/11/93
*
* from: Header: clock.c,v 1.17 92/11/26 03:04:47 torek Exp (LBL)
* $Id: clock.c,v 1.1 1993/10/02 10:24:07 deraadt Exp $
* $Id: clock.c,v 1.2 1993/10/11 02:16:15 deraadt Exp $
*/
/*
@ -279,7 +279,7 @@ int
clockintr(cap)
void *cap;
{
register int discard;
volatile register int discard;
extern int rom_console_input;
/* read the limit register to clear the interrupt */
@ -298,7 +298,7 @@ int
statintr(cap)
void *cap;
{
register int discard;
volatile register int discard;
register u_long newint, r, var;
/* read the limit register to clear the interrupt */

View File

@ -42,7 +42,7 @@
* @(#)conf.c 8.1 (Berkeley) 6/11/93
*
* from: Header: conf.c,v 1.15 93/05/05 09:43:29 torek Exp (LBL)
* $Id: conf.c,v 1.1 1993/10/02 10:24:09 deraadt Exp $
* $Id: conf.c,v 1.2 1993/10/11 02:16:16 deraadt Exp $
*/
#include <sys/param.h>
@ -52,21 +52,21 @@
#include <sys/vnode.h>
#include <sys/tty.h>
#include <sys/conf.h>
#include <sys/systm.h>
int rawread __P((dev_t, struct uio *, int));
int rawwrite __P((dev_t, struct uio *, int));
int swstrategy __P((struct buf *));
void swstrategy __P((struct buf *));
int ttselect __P((dev_t, int, struct proc *));
#define dev_type_open(n) int n __P((dev_t, int, int, struct proc *))
#define dev_type_close(n) int n __P((dev_t, int, int, struct proc *))
#define dev_type_strategy(n) int n __P((struct buf *))
#define dev_type_strategy(n) void n __P((struct buf *))
#define dev_type_ioctl(n) \
int n __P((dev_t, int, caddr_t, int, struct proc *))
/* bdevsw-specific types */
/* dev_type_dump(n) int n __P((dev_t, daddr_t, caddr_t, int))*/
#define dev_type_dump(n) int n ()
#define dev_type_dump(n) int n __P((dev_t, daddr_t, caddr_t, int))
#define dev_type_size(n) int n __P((dev_t))
/* error/nullop functions */
@ -137,9 +137,9 @@ int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
dev_decl(n,open); dev_decl(n,close); dev_decl(n,read); \
dev_decl(n,write); dev_decl(n,ioctl); dev_decl(n,select); \
dev_decl(n,map); dev_decl(n,strategy); \
extern struct tty __CONCAT(n,_tty)[]
extern struct tty *__CONCAT(n,_tty)[];
#define dev_tty_init(c,n) (c > 0 ? __CONCAT(n,_tty) : 0)
#define dev_tty_init(c,n) (c > 0 ? __CONCAT(n,_tty) : (struct tty **)0)
/* open, close, read, write, ioctl, strategy */
#define cdev_disk_init(c,n) { \
@ -177,10 +177,10 @@ cdev_decl(no); /* dummy declarations */
cdev_decl(cn);
/* open, close, read, write, ioctl, select -- XXX should be a tty */
extern struct tty cons;
extern struct tty *constty[];
#define cdev_cn_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
dev_init(c,n,write), dev_init(c,n,ioctl), 0, 0, &cons, \
dev_init(c,n,write), dev_init(c,n,ioctl), 0, 0, constty, \
dev_init(c,n,select), 0, 0 }
cdev_decl(ctty);
@ -374,6 +374,8 @@ struct cdevsw cdevsw[] =
int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
int mem_no = 3; /* major device number of memory special file */
/*
* Swapdev is a fake device implemented
* in sw.c used only internally to get to swstrategy.

View File

@ -42,7 +42,7 @@
* @(#)cpu.c 8.1 (Berkeley) 6/11/93
*
* from: Header: cpu.c,v 1.12 93/05/03 09:47:57 torek Exp (LBL)
* $Id: cpu.c,v 1.1 1993/10/02 10:24:10 deraadt Exp $
* $Id: cpu.c,v 1.2 1993/10/11 02:16:17 deraadt Exp $
*/
#include <sys/param.h>
@ -51,22 +51,61 @@
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/reg.h>
#include <machine/trap.h>
#include <sparc/sparc/cache.h>
/* This is declared here so that you must include a CPU for the cache code. */
struct cacheinfo cacheinfo;
/* the following are used externally (sysctl_hw) */
/* the following are used externally (sysctl_hw). */
char machine[] = "sparc";
char cpu_model[80];
char cpu_model[100];
static char *psrtoname();
static char *fsrtoname();
/* The CPU configuration driver. */
static void cpu_attach __P((struct device *, struct device *, void *));
struct cfdriver cpucd =
{ NULL, "cpu", matchbyname, cpu_attach, DV_CPU, sizeof(struct device) };
static char *psrtoname __P((int, int, int, char *));
static char *fsrtoname __P((int, int, int, char *));
#define IU_IMPL(psr) ((u_int)(psr) >> 28)
#define IU_VERS(psr) (((psr) >> 24) & 0xf)
#ifdef notdef
/*
* IU implementations are parceled out to vendors (with some slight
* glitches). Printing these is cute but takes too much space.
*/
static char *iu_vendor[16] = {
"Fujitsu", /* and also LSI Logic */
"ROSS", /* ROSS (ex-Cypress) */
"BIT",
"LSIL", /* LSI Logic finally got their own */
"TI", /* Texas Instruments */
"Matsushita",
"Philips",
"Harvest", /* Harvest VLSI Design Center */
"SPEC", /* Systems and Processes Engineering Corporation */
"Weitek",
"vendor#10",
"vendor#11",
"vendor#12",
"vendor#13",
"vendor#14",
"vendor#15"
};
#endif
/*
* Attach the CPU.
* Discover interesting goop about the virtual address cache.
* Discover interesting goop about the virtual address cache
* (slightly funny place to do it, but this is where it is to be found).
*/
static void
cpu_attach(parent, dev, aux)
@ -75,9 +114,10 @@ cpu_attach(parent, dev, aux)
void *aux;
{
register int node, clk, i, l;
register u_int psr, fver;
register u_int impl, vers, fver;
register char *fpuname;
struct fpstate fpstate;
char iubuf[40], fpbuf[40];
/*
* Get the FSR and clear any exceptions. If we do not unload
@ -91,10 +131,12 @@ cpu_attach(parent, dev, aux)
fpstate.fs_fsr = 7 << FSR_VER_SHIFT; /* 7 is reserved for "none" */
savefpstate(&fpstate);
fver = (fpstate.fs_fsr >> FSR_VER_SHIFT) & (FSR_VER >> FSR_VER_SHIFT);
psr = getpsr();
i = getpsr();
impl = IU_IMPL(i);
vers = IU_VERS(i);
if (fver != 7) {
foundfpu = 1;
fpuname = fsrtoname(psr, fver);
fpuname = fsrtoname(impl, vers, fver, fpbuf);
} else
fpuname = "no";
@ -102,8 +144,8 @@ cpu_attach(parent, dev, aux)
node = ((struct romaux *)aux)->ra_node;
clk = getpropint(node, "clock-frequency", 0);
sprintf(cpu_model, "%s (%s @ %s MHz, %s FPU)",
getpropstring(node, "name"), psrtoname(psr),
clockfreq(clk), fpuname);
getpropstring(node, "name"),
psrtoname(impl, vers, fver, iubuf), clockfreq(clk), fpuname);
printf(": %s\n", cpu_model);
/*
@ -120,88 +162,133 @@ cpu_attach(parent, dev, aux)
panic("bad cache line size %d", l);
cacheinfo.c_l2linesize = i;
vactype = VAC_WRITETHROUGH; /* ??? */
vactype = VAC_WRITETHROUGH;
/*
* Machines with "buserr-type" 1 have a bug in the cache
* chip that affects traps. (I wish I knew more about this
* mysterious buserr-type variable....)
*/
if (getpropint(node, "buserr-type", 0) == 1) {
kvm_uncache((caddr_t)trapbase, 1);
printf("%s: cache chip bug; trap page uncached\n",
dev->dv_xname);
}
printf("%s: %d byte write-through, %d bytes/line, %cw flush ",
dev->dv_xname, cacheinfo.c_totalsize, l,
cacheinfo.c_hwflush ? 'h' : 's');
cache_enable();
}
struct cfdriver cpucd =
{ NULL, "cpu", matchbyname, cpu_attach, DV_CPU, sizeof(struct device) };
/*
* The following tables convert <IU impl, IU version, FPU version> triples
* into names for the CPU and FPU chip. In most cases we do not need to
* inspect the FPU version to name the IU chip, but there is one exception
* (for Tsunami), and this makes the tables the same.
*
* The table contents (and much of the structure here) are from Guy Harris.
*
* NOTE: we have Sun-4m cpu types here, even though this only runs on the
* Sun-4c (yet)...
*/
struct info {
u_char valid;
u_char iu_impl;
u_char iu_vers;
u_char fpu_vers;
char *name;
};
#define ANY 0xff /* match any FPU version (or, later, IU version) */
static struct info iu_types[] = {
{ 1, 0x0, 0x0, ANY, "MB86900/1A or L64801" },
{ 1, 0x1, 0x0, ANY, "RT601 or L64811 v1" },
{ 1, 0x1, 0x1, ANY, "RT601 or L64811 v2" },
{ 1, 0x1, 0x3, ANY, "RT611" },
{ 1, 0x1, 0xf, ANY, "RT620" },
{ 1, 0x2, 0x0, ANY, "B5010" },
{ 1, 0x4, 0x0, 0, "TMS390Z50 v0" },
{ 1, 0x4, 0x1, 0, "TMS390Z50 v1" },
{ 1, 0x4, 0x1, 4, "TMS390S10" },
{ 1, 0x5, 0x0, ANY, "MN10501" },
{ 1, 0x9, 0x0, ANY, "W8601/8701 or MB86903" },
{ 0 }
};
static char *
psrtoname(psr)
register u_int psr;
psrtoname(impl, vers, fver, buf)
register int impl, vers, fver;
char *buf;
{
int impl = psr >> 28, vers = (psr >> 24) & 15;
register struct info *p;
switch (impl) {
for (p = iu_types; p->valid; p++)
if (p->iu_impl == impl && p->iu_vers == vers &&
(p->fpu_vers == fver || p->fpu_vers == ANY))
return (p->name);
case 0:
if (vers == 0)
return ("MB86900/1A or L64801");
break;
case 1:
if (vers < 2)
return ("CY7C601 or L64811");
if (vers == 3)
return ("CY7C611");
break;
case 2:
if (vers == 0)
return ("B5010");
break;
case 5:
if (vers == 0)
return ("MN10501");
break;
}
return ("???");
/* Not found. */
sprintf(buf, "IU impl 0x%x vers 0x%x", impl, vers);
return (buf);
}
/* NB: table order matters here; specific numbers must appear before ANY. */
static struct info fpu_types[] = {
/*
* Vendor 0, IU Fujitsu0.
*/
{ 1, 0x0, ANY, 0, "MB86910 or WTL1164/5" },
{ 1, 0x0, ANY, 1, "MB86911 or WTL1164/5" },
{ 1, 0x0, ANY, 2, "L64802 or ACT8847" },
{ 1, 0x0, ANY, 3, "WTL3170/2" },
{ 1, 0x0, ANY, 4, "L64804" },
/*
* Vendor 1, IU ROSS0/1.
*/
{ 1, 0x1, ANY, 0, "L64812 or ACT8847" },
{ 1, 0x1, ANY, 1, "L64814" },
{ 1, 0x1, ANY, 2, "TMS390C602A" },
{ 1, 0x1, ANY, 3, "RT602 or WTL3171" },
/*
* Vendor 2, IU BIT0.
*/
{ 1, 0x2, ANY, 0, "B5010 or B5110/20 or B5210" },
/*
* Vendor 4, Texas Instruments.
*/
{ 1, 0x4, ANY, 0, "on-chip" }, /* Viking */
{ 1, 0x4, ANY, 4, "on-chip" }, /* Tsunami */
/*
* Vendor 5, IU Matsushita0.
*/
{ 1, 0x5, ANY, 0, "on-chip" },
/*
* Vendor 9, Weitek.
*/
{ 1, 0x9, ANY, 3, "on-chip" },
{ 0 }
};
static char *
fsrtoname(psr, fver)
register u_int psr, fver;
fsrtoname(impl, vers, fver, buf)
register int impl, vers, fver;
char *buf;
{
register struct info *p;
switch (psr >> 28) {
case 0:
switch (fver) {
case 0:
return ("MB86910 or WTL1164/5");
case 1:
return ("MB86911 or WTL1164/5");
case 2:
return ("L64802 or ACT8847");
case 3:
return ("WTL3170/2");
case 4:
return ("L64804");
}
break;
case 1:
switch (fver) {
case 0:
return ("L64812 or ACT8847");
case 1:
return ("L64814");
case 2:
return ("TMS390C602A");
case 3:
return ("WTL3171");
}
break;
case 2:
if (fver == 0)
return ("B5010 or B5110/20 or B5210");
break;
case 5:
if (fver == 0)
return ("MN10501");
}
return ("???");
for (p = fpu_types; p->valid; p++)
if (p->iu_impl == impl &&
(p->iu_vers == vers || p->iu_vers == ANY) &
p->fpu_vers == fver)
return (p->name);
sprintf(buf, "version %x", fver);
return (buf);
}

View File

@ -42,7 +42,7 @@
* @(#)genassym.c 8.1 (Berkeley) 6/11/93
*
* from: Header: genassym.c,v 1.15 93/04/21 06:09:30 torek Exp (LBL)
* $Id: genassym.c,v 1.1 1993/10/02 10:24:11 deraadt Exp $
* $Id: genassym.c,v 1.2 1993/10/11 02:16:17 deraadt Exp $
*/
#include <sys/param.h>
@ -54,6 +54,7 @@
#include <sys/msgbuf.h>
#include <sys/syscall.h>
#include <sys/user.h>
#include <sys/vmmeter.h>
#include <machine/pmap.h>
#include <machine/psl.h>

View File

@ -42,12 +42,14 @@
* @(#)intr.c 8.1 (Berkeley) 6/11/93
*
* from: Header: intr.c,v 1.20 92/11/26 03:04:53 torek Exp (LBL)
* $Id: intr.c,v 1.1 1993/10/02 10:24:13 deraadt Exp $
* $Id: intr.c,v 1.2 1993/10/11 02:16:18 deraadt Exp $
*/
#include <sys/param.h>
#include <sys/kernel.h>
#include <vm/vm.h>
#include <net/netisr.h>
#include <machine/cpu.h>
@ -73,7 +75,6 @@ strayintr(fp)
printf("stray interrupt ipl %x pc=%x npc=%x psr=%b\n",
fp->ipl, fp->pc, fp->npc, fp->psr, PSR_BITS);
timesince = time.tv_sec - straytime;
straytime = time.tv_sec;
if (timesince <= 10) {
if (++nstray > 9)
panic("crazy interrupts");
@ -119,8 +120,10 @@ soft01intr(fp)
splx(s);
sir.sir_which[SIR_NET] = 0;
#ifdef INET
#ifdef NETISR_ARP
if (n & (1 << NETISR_ARP))
arpintr();
#endif
if (n & (1 << NETISR_IP))
ipintr();
#endif
@ -251,9 +254,13 @@ intr_fasttrap(level, vec)
tv->tv_instr[0], tv->tv_instr[1], tv->tv_instr[2],
I_MOVi(I_L3, level), I_BA(0, displ), I_RDPSR(I_L0));
#endif
/* kernel text is write protected -- let us in for a moment */
pmap_changeprot(kernel_pmap, (vm_offset_t)tv,
VM_PROT_READ|VM_PROT_WRITE, 1);
tv->tv_instr[0] = I_SETHI(I_L3, hi22); /* sethi %hi(vec),%l3 */
tv->tv_instr[1] = I_JMPLri(I_G0, I_L3, lo10);/* jmpl %l3+%lo(vec),%g0 */
tv->tv_instr[2] = I_RDPSR(I_L0); /* mov %psr, %l0 */
pmap_changeprot(kernel_pmap, (vm_offset_t)tv, VM_PROT_READ, 1);
fastvec |= 1 << level;
splx(s);
}

View File

@ -42,7 +42,7 @@
* @(#)locore.s 8.2 (Berkeley) 8/12/93
*
* from: Header: locore.s,v 1.51 93/04/21 06:19:37 torek Exp
* $Id: locore.s,v 1.1 1993/10/02 10:24:18 deraadt Exp $
* $Id: locore.s,v 1.2 1993/10/11 02:16:20 deraadt Exp $
*/
#define LOCORE
@ -2411,7 +2411,7 @@ dostart:
* to return_from_trap.
*/
mov PSR_S, %l0 ! user psr
#define XADDR 0x2000 /* XXX */
#define XADDR 0
set XADDR, %l1 ! pc
add %l1, 4, %l2 ! npc
b return_from_trap
@ -4075,8 +4075,6 @@ ENTRY(loadfpstate)
* Set and clear bits in the interrupt register.
* Since there are no read-modify-write instructions for this,
* and one of the interrupts is nonmaskable, we must disable traps.
*
* NB: ___main is defined here for gcc-2 idiocy. Ignore it.
*/
ENTRY(ienab_bis)
! %o0 = bits to set
@ -4089,8 +4087,6 @@ ENTRY(ienab_bis)
stb %o4, [%o3 + %lo(IE_reg_addr)]
wr %o2, 0, %psr ! reenable traps
nop
.globl ___main
___main:
retl
nop

View File

@ -42,10 +42,12 @@
* @(#)machdep.c 8.1 (Berkeley) 6/11/93
*
* from: Header: machdep.c,v 1.41 93/05/27 04:39:05 torek Exp
* $Id: machdep.c,v 1.1 1993/10/02 10:24:20 deraadt Exp $
* $Id: machdep.c,v 1.2 1993/10/11 02:16:23 deraadt Exp $
*/
#include <sys/param.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/map.h>
@ -57,6 +59,7 @@
#include <sys/file.h>
#include <sys/clist.h>
#include <sys/callout.h>
#include <sys/vmmeter.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/mount.h>
@ -65,7 +68,7 @@
#include <sys/shm.h>
#endif
#include <sys/exec.h>
#include <sys/sysctl.h>
/*TDR #include <sys/sysctl.h>*/
#include <machine/autoconf.h>
#include <machine/frame.h>
@ -113,6 +116,7 @@ caddr_t allocsys();
/*
* Machine-dependent startup code
*/
void
cpu_startup()
{
register unsigned i;
@ -161,6 +165,11 @@ cpu_startup()
panic("startup: cannot allocate buffers");
base = bufpages / nbuf;
residual = bufpages % nbuf;
if (base >= MAXBSIZE) {
/* don't want to alloc more physical mem than needed */
base = MAXBSIZE;
residual = 0;
}
for (i = 0; i < nbuf; i++) {
vm_size_t curbufsize;
vm_offset_t curbuf;
@ -177,12 +186,16 @@ cpu_startup()
vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
vm_map_simplify(buffer_map, curbuf);
}
#ifdef notdef
/*
* Allocate a submap for exec arguments. This map effectively
* limits the number of processes exec'ing at any time.
*/
exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
16*NCARGS, TRUE);
#endif
/*
* Allocate a map for physio. Others use a submap of the kernel
* map, but we want one completely separate, even though it uses
@ -212,7 +225,7 @@ cpu_startup()
#ifdef DEBUG
pmapdebug = opmapdebug;
#endif
printf("avail mem = %d\n", ptoa(cnt.v_free_count));
printf("avail mem = %d\n", ptoa(vm_page_free_count));
printf("using %d buffers containing %d bytes of memory\n",
nbuf, bufpages * CLBYTES);
@ -222,15 +235,9 @@ cpu_startup()
bufinit();
/*
* Configure the system.
* Configure the system. The cpu code will turn on the cache.
*/
configure();
/*
* Turn on the cache (do after configuration due to a bug in
* some versions of the SPARC chips -- this info from Gilmore).
*/
cache_enable();
}
/*
@ -284,14 +291,16 @@ allocsys(v)
* XXX this entire mess must be fixed
*/
/* ARGSUSED */
setregs(p, entry, retval)
register struct proc *p;
void
setregs(p, entry, stack, retval)
struct proc *p;
u_long entry;
u_long stack;
int retval[2];
{
register struct trapframe *tf = p->p_md.md_tf;
register struct fpstate *fs;
register int psr, sp;
register int psr;
/*
* The syscall will ``return'' to npc or %g7 or %g2; set them all.
@ -299,7 +308,6 @@ setregs(p, entry, retval)
* built in exec()) and psr (retain CWP and PSR_S bits).
*/
psr = tf->tf_psr & (PSR_S | PSR_CWP);
sp = tf->tf_out[6];
if ((fs = p->p_md.md_fpstate) != NULL) {
/*
* We hold an FPU state. If we own *the* FPU chip state
@ -315,8 +323,9 @@ setregs(p, entry, retval)
}
bzero((caddr_t)tf, sizeof *tf);
tf->tf_psr = psr;
tf->tf_global[2] = tf->tf_global[7] = tf->tf_npc = entry & ~3;
tf->tf_out[6] = sp;
tf->tf_pc = entry & ~3;
tf->tf_global[2] = tf->tf_global[7] = tf->tf_npc = (entry+4) & ~3;
tf->tf_out[6] = stack + 64; /* TDR: this 64 EERK ACKK */
retval[1] = 0;
}
@ -373,6 +382,7 @@ sendsig(catcher, sig, mask, code)
int sig, mask;
unsigned code;
{
#ifdef notdef /* TDR: fix this */
register struct proc *p = curproc;
register struct sigacts *psp = p->p_sigacts;
register struct sigframe *fp;
@ -476,6 +486,7 @@ sendsig(catcher, sig, mask, code)
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
printf("sendsig: about to return to catcher\n");
#endif
#endif /* notdef */
}
/*
@ -496,6 +507,7 @@ sigreturn(p, uap, retval)
struct sigreturn_args *uap;
int *retval;
{
#ifdef notdef /* TDR: fix this */
register struct sigcontext *scp;
register struct trapframe *tf;
@ -532,10 +544,12 @@ sigreturn(p, uap, retval)
p->p_sigacts->ps_sigstk.ss_flags &= ~SA_ONSTACK;
p->p_sigmask = scp->sc_mask & ~sigcantmask;
return (EJUSTRETURN);
#endif /* notdef */
}
int waittime = -1;
void
boot(howto)
register int howto;
{
@ -608,7 +622,7 @@ boot(howto)
/*NOTREACHED*/
}
int dumpmag = 0x8fca0101; /* magic number for savecore */
u_long dumpmag = 0x8fca0101; /* magic number for savecore */
int dumpsize = 0; /* also for savecore */
long dumplo = 0;
@ -665,7 +679,7 @@ int
dumpmmu(blkno)
register daddr_t blkno;
{
register int (*dump)(/*dev_t, daddr_t, caddr_t, int*/);
register int (*dump) __P((dev_t, daddr_t, caddr_t, int));
register int pmeg;
register int addr; /* unused kernel virtual address */
register int i;
@ -761,7 +775,7 @@ dumpsys()
register unsigned bytes, i, n;
register int maddr, psize;
register daddr_t blkno;
register int (*dump)(/*dev_t, daddr_t, caddr_t, int, int*/);
register int (*dump) __P((dev_t, daddr_t, caddr_t, int));
int error = 0;
if (dumpdev == NODEV)
@ -872,3 +886,61 @@ mapdev(phys, virt, size)
} while ((size -= PAGE_SIZE) > 0);
return (ret);
}
cpu_exec_aout_makecmds(p, epp)
struct proc *p;
struct exec_package *epp;
{
return (ENOEXEC);
}
struct sysarch_args {
int op;
char *parms;
};
sysarch(p, uap, retval)
struct proc *p;
register struct sysarch_args *uap;
int *retval;
{
int error = 0;
switch(uap->op) {
default:
error = EINVAL;
break;
}
return(error);
}
int
ptrace_set_pc(p, addr)
struct proc *p;
u_long addr;
{
/* TDR: IMPLIMENT! */
}
int
ptrace_getregs(p, addr)
struct proc *p;
u_long addr;
{
/* TDR: IMPLIMENT! */
}
int
ptrace_setregs(p, addr)
struct proc *p;
u_long addr;
{
/* TDR: IMPLIMENT! */
}
int
ptrace_single_step(p)
struct proc *p;
{
/* TDR: IMPLIMENT! */
}

View File

@ -42,7 +42,7 @@
* @(#)pmap.c 8.1 (Berkeley) 6/11/93
*
* from: Header: pmap.c,v 1.39 93/04/20 11:17:12 torek Exp
* $Id: pmap.c,v 1.1 1993/10/02 10:24:26 deraadt Exp $
* $Id: pmap.c,v 1.2 1993/10/11 02:16:24 deraadt Exp $
*/
/*
@ -268,7 +268,8 @@ caddr_t vpage[2]; /* two reserved MD virtual pages */
caddr_t vmempage; /* one reserved MI vpage for /dev/mem */
caddr_t vdumppages; /* 32KB worth of reserved dump pages */
struct kpmap kernel_pmap_store; /* the kernel's pmap */
struct kpmap kernel_pmap_store; /* the kernel's pmap */
pmap_t kernel_pmap;
/*
* We need to know real physical memory ranges (for /dev/mem).
@ -344,6 +345,34 @@ int pmap_stod[BTSIZE]; /* sparse to dense */
#define HWTOSW(pg) (pmap_stod[(pg) >> BSHIFT] | ((pg) & BOFFSET))
#define SWTOHW(pg) (pmap_dtos[(pg) >> BSHIFT] | ((pg) & BOFFSET))
/*
* Sort a memory array by address.
*/
static void
sortm(mp, n)
register struct memarr *mp;
register int n;
{
register struct memarr *mpj;
register int i, j;
register u_int addr, len;
/* Insertion sort. This is O(n^2), but so what? */
for (i = 1; i < n; i++) {
/* save i'th entry */
addr = mp[i].addr;
len = mp[i].len;
/* find j such that i'th entry goes before j'th */
for (j = 0, mpj = mp; j < i; j++, mpj++)
if (addr < mpj->addr)
break;
/* slide up any additional entries */
ovbcopy(mpj, mpj + 1, (i - j) * sizeof(*mp));
mpj->addr = addr;
mpj->len = len;
}
}
#ifdef DEBUG
struct memarr pmap_ama[MA_SIZE];
int pmap_nama;
@ -366,6 +395,21 @@ init_translations()
#endif
nmem = makememarr(ama, MA_SIZE, MEMARR_AVAILPHYS);
/*
* Open Boot supposedly guarantees at least 3 MB free mem at 0;
* this is where the kernel has been loaded (we certainly hope the
* kernel is <= 3 MB). We need the memory array to be sorted, and
* to start at 0, so that `software page 0' and `hardware page 0'
* are the same (otherwise the VM reserves the wrong pages for the
* kernel).
*/
sortm(ama, nmem);
if (ama[0].addr != 0) {
/* cannot panic here; there's no real kernel yet. */
printf("init_translations: no kernel memory?!\n");
callrom();
}
#ifdef DEBUG
pmap_nama = nmem;
#endif
@ -1125,6 +1169,8 @@ pmap_bootstrap(nmmu, nctx)
extern char end[];
extern caddr_t reserve_dumppages(caddr_t);
kernel_pmap = (pmap_t)&kernel_pmap_store;
ncontext = nctx;
/*
@ -1276,13 +1322,14 @@ pmap_bootstrap(nmmu, nctx)
* set red zone at kernel base; enable cache on message buffer.
*/
{
extern char etext[], trapbase[];
extern char etext[];
#ifdef KGDB
register int mask = ~PG_NC; /* XXX chgkprot is busted */
#else
register int mask = ~(PG_W | PG_NC);
#endif
for (p = trapbase; p < etext; p += NBPG)
for (p = (caddr_t)trapbase; p < etext; p += NBPG)
setpte(p, getpte(p) & mask);
p = (caddr_t)KERNBASE;
setpte(p, 0);
@ -1312,10 +1359,7 @@ pmap_bootstrap_alloc(size)
int size;
{
register void *mem;
extern int vm_page_startup_initialized;
if (vm_page_startup_initialized)
panic("pmap_bootstrap_alloc: called after startup initialized");
size = round_page(size);
mem = (void *)virtual_avail;
virtual_avail = pmap_map(virtual_avail, avail_start,
@ -2530,6 +2574,17 @@ pmap_pageable(pm, start, end, pageable)
{
}
/*
* Routine: pmap_kernel
* Function:
* Returns the physical map handle for the kernel.
*/
pmap_t
pmap_kernel()
{
return (kernel_pmap);
}
/*
* Fill the given MI physical page with zero bytes.
*

View File

@ -2,12 +2,15 @@
* fake swapgeneric.c -- should do this differently.
*
* @(#)swapgeneric.c 8.1 (Berkeley) 7/19/93
* $Id: swapgeneric.c,v 1.1 1993/10/02 10:24:28 deraadt Exp $
* $Id: swapgeneric.c,v 1.2 1993/10/11 02:16:26 deraadt Exp $
*/
#include <sys/param.h>
#include <sys/conf.h>
extern int ufs_mountroot();
int (*mountroot)() = ufs_mountroot;
dev_t rootdev = NODEV;
dev_t dumpdev = NODEV;
@ -22,4 +25,3 @@ struct swdevt swdevt[] = {
{ makedev(7, 57), 0, 0 }, /* sd7b */
{ NODEV, 0, 0 }
};
* $Id: swapgeneric.c,v 1.1 1993/10/02 10:24:28 deraadt Exp $

View File

@ -42,7 +42,7 @@
* @(#)trap.c 8.1 (Berkeley) 6/16/93
*
* from: Header: trap.c,v 1.34 93/05/28 04:34:50 torek Exp
* $Id: trap.c,v 1.1 1993/10/02 10:24:30 deraadt Exp $
* $Id: trap.c,v 1.2 1993/10/11 02:16:26 deraadt Exp $
*/
#include <sys/param.h>
@ -56,6 +56,7 @@
#include <sys/wait.h>
#include <sys/syscall.h>
#include <sys/syslog.h>
#include <sys/vmmeter.h>
#ifdef KTRACE
#include <sys/ktrace.h>
#endif
@ -690,10 +691,10 @@ syscall(code, tf, pc, suncompat)
code &= ~(SYSCALL_G7RFLAG | SYSCALL_G2RFLAG);
#ifdef COMPAT_SUNOS
if (suncompat) {
extern int nsunsys;
extern struct sysent sunsys[];
extern int nsun_sysent;
extern struct sysent sun_sysent[];
callp = sunsys, nsys = nsunsys;
callp = sun_sysent, nsys = nsun_sysent;
} else
#endif
callp = sysent, nsys = nsysent;
@ -713,6 +714,10 @@ syscall(code, tf, pc, suncompat)
nap = 6;
switch (code) {
/* TDR: fix this */
#define SYS_syscall 0
#define SYS___syscall 100000
case SYS_syscall:
code = *ap++;
nap--;

View File

@ -42,7 +42,7 @@
* @(#)vm_machdep.c 8.1 (Berkeley) 6/11/93
*
* from: Header: vm_machdep.c,v 1.10 92/11/26 03:05:11 torek Exp (LBL)
* $Id: vm_machdep.c,v 1.1 1993/10/02 10:24:32 deraadt Exp $
* $Id: vm_machdep.c,v 1.2 1993/10/11 02:16:27 deraadt Exp $
*/
#include <sys/param.h>
@ -248,6 +248,7 @@ cpu_fork(p1, p2)
* Since the latter is also the interrupt stack, we release it
* from assembly code after switching to a temporary pcb+stack.
*/
void
cpu_exit(p)
struct proc *p;
{
@ -265,6 +266,7 @@ cpu_exit(p)
/* NOTREACHED */
}
#ifdef notdef
/*
* cpu_coredump is called to write a core dump header.
* (should this be defined elsewhere? machdep.c?)
@ -285,3 +287,4 @@ cpu_coredump(p, vp, cred)
return (vn_rdwr(UIO_WRITE, vp, (caddr_t)up, ctob(UPAGES), (off_t)0,
UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, (int *)NULL, p));
}
#endif