Speed-up of pmap and trap.
Fixes due to uVAX support.
This commit is contained in:
parent
a95842832d
commit
80b5aa7c05
@ -1,4 +1,37 @@
|
||||
/* $NetBSD: clock.c,v 1.5 1995/02/23 17:53:48 ragge Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.6 1995/03/30 21:25:14 ragge Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 at Ludd, University of Lule}.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
*/
|
||||
|
||||
/* All bugs are subject to removal without further notice */
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
@ -18,29 +51,42 @@ extern int todrstopped;
|
||||
static unsigned long year; /* start of current year in seconds */
|
||||
static unsigned long year_len; /* length of current year in 100th of seconds */
|
||||
|
||||
/*
|
||||
* microtime() should return number of usecs in struct timeval.
|
||||
* We may get wrap-arounds, but that will be fixed with lasttime
|
||||
* check. This may fault within 10 msecs.
|
||||
*/
|
||||
void
|
||||
microtime(tvp)
|
||||
register struct timeval *tvp;
|
||||
{
|
||||
int s = splhigh(),i;
|
||||
u_int int_time=mfpr(PR_TODR),tmp_year;
|
||||
static struct timeval lasttime;
|
||||
|
||||
/*******
|
||||
|
||||
|
||||
*******/
|
||||
|
||||
void microtime(struct timeval *tod) {
|
||||
|
||||
unsigned long int_time=mfpr(PR_TODR);
|
||||
unsigned long tmp_year;
|
||||
|
||||
if(int_time>year_len) {
|
||||
mtpr(mfpr(PR_TODR)-year_len, PR_TODR);
|
||||
year+=year_len/100;
|
||||
tmp_year=year/SEC_PER_DAY/365+2;
|
||||
year_len=100*SEC_PER_DAY*((tmp_year%4&&tmp_year!=32)?365:366);
|
||||
}
|
||||
|
||||
tod->tv_sec=year+(int_time/100);
|
||||
tod->tv_usec=int_time%100;
|
||||
bcopy(&time,tvp,sizeof(struct timeval));
|
||||
i=mfpr(PR_ICR)+tick; /* Get current interval count */
|
||||
tvp->tv_usec += i;
|
||||
while (tvp->tv_usec > 1000000) {
|
||||
tvp->tv_sec++;
|
||||
tvp->tv_usec -= 1000000;
|
||||
}
|
||||
if (tvp->tv_sec == lasttime.tv_sec &&
|
||||
tvp->tv_usec <= lasttime.tv_usec &&
|
||||
(tvp->tv_usec = lasttime.tv_usec + 1) > 1000000) {
|
||||
tvp->tv_sec++;
|
||||
tvp->tv_usec -= 1000000;
|
||||
}
|
||||
bcopy(tvp,&lasttime,sizeof(struct timeval));
|
||||
if(int_time>year_len) {
|
||||
mtpr(mfpr(PR_TODR)-year_len, PR_TODR);
|
||||
year+=year_len/100;
|
||||
tmp_year=year/SEC_PER_DAY/365+2;
|
||||
year_len=100*SEC_PER_DAY*((tmp_year%4&&tmp_year!=32)?365:366);
|
||||
}
|
||||
splx(s);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sets year to the year in fs_time and then calculates the number of
|
||||
* 100th of seconds in the current year and saves that info in year_len.
|
||||
@ -93,10 +139,10 @@ void inittodr(time_t fs_time) {
|
||||
todrstopped=0;
|
||||
} else if(year_ticks/100>fs_time-year+SEC_PER_DAY*3) {
|
||||
printf("WARNING: Clock has gained %d days - CHECK AND RESET THE DATE.\n",
|
||||
(year_ticks/100-(fs_time-year))/SEC_PER_DAY);
|
||||
(year_ticks/100-(fs_time-year))/SEC_PER_DAY);
|
||||
sluttid=year+(year_ticks/100);
|
||||
} else if(year_ticks/100<fs_time-year) {
|
||||
printf("WARNING: Clock has lost time! CHECK AND RESET THE DATE.\n");
|
||||
printf("WARNING: Clock has lost time - CHECK AND RESET THE DATE.\n");
|
||||
} else sluttid=year+(year_ticks/100);
|
||||
time.tv_sec=sluttid;
|
||||
}
|
||||
@ -140,13 +186,13 @@ todr()
|
||||
static int todr_val;
|
||||
|
||||
if (cpunumber != VAX_78032)
|
||||
return (mfpr(PR_TODR));
|
||||
return (mfpr(PR_TODR));
|
||||
|
||||
/*
|
||||
* Loop for approximately 10msec and then return todr_val + 1.
|
||||
*/
|
||||
delaycnt = 5000;
|
||||
while (delaycnt > 0)
|
||||
delaycnt = delaycnt - x + 3 + y - 4;
|
||||
delaycnt = delaycnt - x + 3 + y - 4;
|
||||
return (++todr_val);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: conf.c,v 1.6 1995/02/23 17:53:49 ragge Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.7 1995/03/30 21:25:19 ragge Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986 The Regents of the University of California.
|
||||
@ -67,14 +67,6 @@ int rawread(), rawwrite(), swstrategy();
|
||||
(int(*)())mmap, \
|
||||
(void(*)(struct buf *))strat }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#include "hp.h"
|
||||
#if NHP > 0
|
||||
int hpopen(),hpclose();
|
||||
@ -607,6 +599,14 @@ int qdopen(), qdclose(), qdread(), qdwrite(), qdioctl(), qdstop(),
|
||||
#define qdcons_init enxio
|
||||
#endif
|
||||
|
||||
#ifdef LKM
|
||||
int lkmopen(),lkmclose(),lkmioctl();
|
||||
#else
|
||||
#define lkmopen enodev
|
||||
#define lkmclose enodev
|
||||
#define lkmioctl enodev
|
||||
#endif
|
||||
|
||||
#if defined(INGRES)
|
||||
int iiioctl(), iiclose(), iiopen();
|
||||
#else
|
||||
@ -700,28 +700,28 @@ struct cdevsw cdevsw[] =
|
||||
tsreset,NULL,seltrue,enodev,tsstrategy), /* 16 */
|
||||
CHARDEV(utopen,utclose,rawread,rawwrite,utioctl,enodev,
|
||||
utreset,NULL,seltrue,enodev,utstrategy), /* 17 */
|
||||
CHARDEV(ctopen,ctclose,enodev,ctwrite, enodev, enodev, nullop, NULL,
|
||||
seltrue,enodev, NULL), /*18*/
|
||||
CHARDEV(mtopen, mtclose,rawread,rawwrite, /*19*/ mtioctl,enodev,
|
||||
enodev, NULL, seltrue, enodev, mtstrategy),
|
||||
CHARDEV(ctopen,ctclose,enodev,ctwrite, enodev, enodev, nullop, NULL,
|
||||
seltrue,enodev, NULL), /* ct 18 */
|
||||
CHARDEV(mtopen, mtclose,rawread,rawwrite, mtioctl,enodev,
|
||||
enodev, NULL, seltrue, enodev, mtstrategy), /* TU78 19 */
|
||||
CHARDEV(ptsopen,ptsclose, ptsread,ptswrite, /*20*/ ptyioctl,
|
||||
ptsstop, nullop, pt_tty, ttselect,enodev, NULL),
|
||||
CHARDEV(ptcopen,ptcclose,ptcread,ptcwrite,/*21*/ ptyioctl,
|
||||
nullop, nullop, pt_tty, ptcselect,enodev,NULL),
|
||||
CHARDEV(dmfopen,dmfclose,dmfread,dmfwrite,/*22*/ dmfioctl,
|
||||
dmfstop,dmfreset, dmf_tty, ttselect,enodev,NULL),
|
||||
CHARDEV(dmfopen,dmfclose,dmfread,dmfwrite, dmfioctl, dmfstop,
|
||||
dmfreset, dmf_tty, ttselect,enodev,NULL), /* DMF32 22 */
|
||||
CHARDEV(idcopen,nullop, rawread,rawwrite, /*23*/ enodev, enodev,
|
||||
idcreset,NULL,seltrue, enodev, idcstrategy),
|
||||
CHARDEV(dnopen, dnclose,enodev, dnwrite,/*24*/ enodev, enodev,
|
||||
nullop, NULL, seltrue, enodev, NULL),
|
||||
CHARDEV(gencnopen,gencnclose,gencnread, gencnwrite,/*25*/ gencnioctl,
|
||||
nullop,nullop, gencntty, ttselect, enodev, NULL),
|
||||
CHARDEV(lpaopen,lpaclose,lparead,lpawrite, /*26*/ lpaioctl,
|
||||
enodev, nullop, NULL, seltrue, enodev, NULL),
|
||||
CHARDEV(psopen,psclose, psread, pswrite,/*27*/ psioctl, enodev,
|
||||
psreset,NULL, seltrue, enodev, NULL),
|
||||
CHARDEV(enodev, enodev, enodev, enodev, /*28*/ enodev,nullop,
|
||||
nullop, NULL, enodev,enodev,NULL),
|
||||
CHARDEV(dnopen,dnclose,enodev,dnwrite,enodev,enodev,
|
||||
nullop, NULL,seltrue,enodev,NULL), /* 24 */
|
||||
CHARDEV(gencnopen,gencnclose,gencnread,gencnwrite,gencnioctl,
|
||||
nullop,nullop,gencntty,ttselect,enodev,NULL), /* cons 25 */
|
||||
CHARDEV(lpaopen,lpaclose,lparead,lpawrite,lpaioctl,
|
||||
enodev,nullop,NULL,seltrue,enodev,NULL), /* 26 */
|
||||
CHARDEV(psopen,psclose, psread, pswrite, psioctl,
|
||||
enodev,psreset,NULL,seltrue,enodev,NULL), /* 27 */
|
||||
CHARDEV(lkmopen, lkmclose, enodev, enodev, lkmioctl,
|
||||
enodev, nullop, NULL, enodev,enodev,NULL), /* LKM 28 */
|
||||
CHARDEV(adopen, adclose,enodev, enodev, /*29*/ adioctl, enodev,
|
||||
adreset,NULL, seltrue, enodev, NULL),
|
||||
CHARDEV(rxopen, rxclose,rxread, rxwrite,/*30*/ rxioctl, enodev,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ka750.c,v 1.4 1995/02/13 00:46:09 ragge Exp $ */
|
||||
/* $NetBSD: ka750.c,v 1.5 1995/03/30 21:25:21 ragge Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1988 The Regents of the University of California.
|
||||
@ -187,7 +187,7 @@ ka750_memerr()
|
||||
}
|
||||
}
|
||||
|
||||
char mc750[]={"0","1","2","3","4","5","6","7","8","9","10","11","12","13",
|
||||
char *mc750[]={"0","1","2","3","4","5","6","7","8","9","10","11","12","13",
|
||||
"14","15"};
|
||||
|
||||
struct mc750frame {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.c,v 1.3 1995/02/23 17:53:54 ragge Exp $ */
|
||||
/* $NetBSD: locore.c,v 1.4 1995/03/30 21:25:22 ragge Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
|
||||
@ -106,6 +106,7 @@ asm(" movw $0xfff,_arithflt
|
||||
((struct pcb *)proc0paddr)->P0BR = 0;
|
||||
((struct pcb *)proc0paddr)->P1LR = 0;
|
||||
((struct pcb *)proc0paddr)->P1BR = (void *)0x80000000;
|
||||
((struct pcb *)proc0paddr)->iftrap = NULL;
|
||||
mtpr(0,PR_P0LR);
|
||||
mtpr(0,PR_P0BR);
|
||||
mtpr(0,PR_P1LR);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: machdep.c,v 1.7 1995/02/23 17:53:56 ragge Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.8 1995/03/30 21:25:23 ragge Exp $ */
|
||||
|
||||
/* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
|
||||
* Copyright (c) 1993 Adam Glass
|
||||
@ -72,6 +72,15 @@
|
||||
#include "vax/include/nexus.h"
|
||||
#include "vax/include/trap.h"
|
||||
#include "net/netisr.h"
|
||||
#ifdef SYSVMSG
|
||||
#include "sys/msg.h"
|
||||
#endif
|
||||
#ifdef SYSVSEM
|
||||
#include "sys/sem.h"
|
||||
#endif
|
||||
#ifdef SYSVSHM
|
||||
#include "sys/shm.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We do these external declarations here, maybe they should be done
|
||||
@ -142,7 +151,6 @@ cpu_startup() {
|
||||
mtpr(AST_NO,PR_ASTLVL);
|
||||
spl0();
|
||||
|
||||
boothowto=RB_SINGLE;
|
||||
dumpsize=physmem+1;
|
||||
|
||||
/*
|
||||
@ -228,25 +236,7 @@ cpu_startup() {
|
||||
/*
|
||||
* Configure the system.
|
||||
*/
|
||||
#if 1
|
||||
configure();
|
||||
#else
|
||||
(*cpu_calls[cpunumber].cpu_conf)();
|
||||
#if GENERIC
|
||||
if ((boothowto & RB_ASKNAME) == 0)
|
||||
setroot();
|
||||
setconf();
|
||||
#else
|
||||
setroot();
|
||||
#endif
|
||||
/*
|
||||
* Configure swap area and related system
|
||||
* parameter based on device(s) used.
|
||||
*/
|
||||
gencnslask(); /* XXX inte g|ras h{r */
|
||||
swapconf();
|
||||
cold=0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -312,10 +302,12 @@ allocsys(v)
|
||||
return v;
|
||||
}
|
||||
|
||||
int dumplo=0;
|
||||
|
||||
dumpconf()
|
||||
{
|
||||
int nblks;
|
||||
extern int dumpdev, dumplo;
|
||||
extern int dumpdev;
|
||||
|
||||
/*
|
||||
* XXX include the final RAM page which is not included in physmem.
|
||||
@ -515,9 +507,12 @@ boot(howto)
|
||||
}
|
||||
splhigh(); /* extreme priority */
|
||||
if (howto&RB_HALT) {
|
||||
asm("halt"); /* Always want halt */
|
||||
printf("halting (in tight loop); hit\n\t^P\n\tHALT\n\n");
|
||||
while(1);
|
||||
int *i;
|
||||
printf("halting (due to bad scbvector)\n");
|
||||
/* This should halt almost every known VAX cpu */
|
||||
i=(int *)0x80000008;
|
||||
*i+=2;
|
||||
asm("movl $0xf0000000,sp;pushl $0;chmk $3");
|
||||
} else {
|
||||
if (howto & RB_DUMP)
|
||||
dumpsys();
|
||||
@ -619,11 +614,51 @@ suswintr(){
|
||||
panic("suswintr: need to be implemented");
|
||||
}
|
||||
|
||||
process_set_pc(){
|
||||
panic("process_set_pc:need to be implemented");
|
||||
int
|
||||
process_set_pc(p, addr)
|
||||
struct proc *p;
|
||||
caddr_t addr;
|
||||
{
|
||||
void *ptr;
|
||||
struct trapframe *tf;
|
||||
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
|
||||
ptr = (char *)p->p_addr->u_pcb.framep;
|
||||
tf = ptr;
|
||||
|
||||
tf->pc = (u_int)addr;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
process_sstep(){
|
||||
panic("process_sstep: need to be implemented");
|
||||
int
|
||||
process_sstep(p, sstep)
|
||||
struct proc *p;
|
||||
{
|
||||
void *ptr;
|
||||
struct trapframe *tf;
|
||||
|
||||
if ((p->p_flag & P_INMEM) == 0)
|
||||
return (EIO);
|
||||
|
||||
ptr = p->p_addr->u_pcb.framep;
|
||||
tf = ptr;
|
||||
|
||||
if(sstep)
|
||||
tf->psl |= PSL_T;
|
||||
else
|
||||
tf->psl &= ~PSL_T;
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
#undef setsoftnet
|
||||
setsoftnet(){
|
||||
panic("setsoftnet");
|
||||
}
|
||||
|
||||
ns_cksum(){
|
||||
panic("ns_cksum");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mem.c,v 1.3 1995/02/13 00:46:12 ragge Exp $ */
|
||||
/* $NetBSD: mem.c,v 1.4 1995/03/30 21:25:25 ragge Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
|
||||
@ -34,15 +34,19 @@
|
||||
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/errno.h>
|
||||
#include "lib/libkern/libkern.h"
|
||||
#include "vm/vm.h"
|
||||
#include "vm/vm_kern.h"
|
||||
#include "vax/include/pte.h"
|
||||
#include "vax/include/mtpr.h"
|
||||
#include "machine/pte.h"
|
||||
#include "machine/mtpr.h"
|
||||
|
||||
#define TRUE 1
|
||||
|
||||
@ -53,6 +57,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) {
|
||||
|
||||
unsigned long b;
|
||||
unsigned long c,o;
|
||||
caddr_t zbuf = NULL;
|
||||
|
||||
int error = 0;
|
||||
register struct iovec *iov;
|
||||
@ -84,6 +89,17 @@ mmrw(dev_t dev, struct uio *uio, int flags) {
|
||||
pmap_remove(pmap_kernel(), v_cmap, v_cmap+NBPG);
|
||||
continue;
|
||||
|
||||
/* minor device 1 is kernel memory */
|
||||
case 1:
|
||||
c = iov->iov_len;
|
||||
if (!kernacc((caddr_t)(long)uio->uio_offset, c,
|
||||
uio->uio_rw == UIO_READ ? B_READ : B_WRITE))
|
||||
return(EFAULT);
|
||||
error = uiomove((caddr_t)(long)uio->uio_offset,
|
||||
(int)c, uio);
|
||||
continue;
|
||||
|
||||
|
||||
case 2: /* Minor dev 2 is EOF/RATHOLE ,ie /dev/null */
|
||||
if (uio->uio_rw == UIO_READ) {
|
||||
return (0);
|
||||
@ -91,6 +107,21 @@ mmrw(dev_t dev, struct uio *uio, int flags) {
|
||||
c = iov->iov_len;
|
||||
break;
|
||||
|
||||
/* minor device 12 (/dev/zero) is source of nulls on read, rathole on write */
|
||||
case 12:
|
||||
if (uio->uio_rw == UIO_WRITE) {
|
||||
c = iov->iov_len;
|
||||
break;
|
||||
}
|
||||
if (zbuf == NULL) {
|
||||
zbuf = (caddr_t)
|
||||
malloc(CLBYTES, M_TEMP, M_WAITOK);
|
||||
bzero(zbuf, CLBYTES);
|
||||
}
|
||||
c = min(iov->iov_len, CLBYTES);
|
||||
error = uiomove(zbuf, (int)c, uio);
|
||||
continue;
|
||||
|
||||
default:
|
||||
return (ENXIO);
|
||||
}
|
||||
@ -101,5 +132,7 @@ mmrw(dev_t dev, struct uio *uio, int flags) {
|
||||
uio->uio_offset += c;
|
||||
uio->uio_resid -= c;
|
||||
}
|
||||
if (zbuf)
|
||||
free(zbuf, M_TEMP);
|
||||
return (error);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* $NetBSD: pmap.c,v 1.7 1995/02/23 17:53:58 ragge Exp $ */
|
||||
|
||||
#undef DEBUG
|
||||
/* $NetBSD: pmap.c,v 1.8 1995/03/30 21:25:28 ragge Exp $ */
|
||||
#undef oldway
|
||||
#define DEBUG
|
||||
/*
|
||||
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
|
||||
* All rights reserved.
|
||||
@ -350,7 +350,7 @@ printf("pmap_enter: pmap: %x,virt %x, phys %x,pv %x prot %x\n",
|
||||
if(v<0x40000000){
|
||||
patch=(int *)pmap->pm_pcb->P0BR;
|
||||
i=(v>>PG_SHIFT);
|
||||
if(i>=(pmap->pm_pcb->P0LR&~AST_MASK)) pmap_expandp0(pmap);
|
||||
if(i>=(pmap->pm_pcb->P0LR&~AST_MASK)) pmap_expandp0(pmap,i);
|
||||
patch=(int *)pmap->pm_pcb->P0BR;
|
||||
} else if(v<(u_int)0x80000000){
|
||||
patch=(int *)pmap->pm_pcb->P1BR;
|
||||
@ -366,14 +366,22 @@ printf("pmap_enter: pmap: %x,virt %x, phys %x,pv %x prot %x\n",
|
||||
if((patch[i]&PG_W)!=(pte&PG_W)){ /* wiring change */
|
||||
pmap_change_wiring(pmap, v, wired);
|
||||
} else if((patch[i]&PG_PROT)!=(pte&PG_PROT)){
|
||||
#ifdef oldway
|
||||
VAXLOOP
|
||||
patch[i+vaxloop]&= ~PG_PROT; /* Protection */
|
||||
patch[i+vaxloop]|= prot_array[prot];
|
||||
mtpr(v+vaxloop*NBPG,PR_TBIS);
|
||||
/* mtpr(0,PR_TBIA); */
|
||||
mtpr(v+vaxloop*NBPG,PR_TBIS);
|
||||
VAXEND
|
||||
#else
|
||||
patch[i]&= ~PG_PROT;
|
||||
patch[i++]|= prot_array[prot];
|
||||
patch[i]&= ~PG_PROT;
|
||||
patch[i]|= prot_array[prot];
|
||||
mtpr(v,PR_TBIS);
|
||||
mtpr(v+NBPG,PR_TBIS);
|
||||
#endif
|
||||
} else if((patch[i]&PG_V)==0) {
|
||||
#ifdef oldway
|
||||
VAXLOOP
|
||||
if(patch[i+vaxloop]&PG_SREF){
|
||||
s=splhigh();
|
||||
@ -382,9 +390,21 @@ printf("pmap_enter: pmap: %x,virt %x, phys %x,pv %x prot %x\n",
|
||||
} else patch[i+vaxloop]|=PG_V;
|
||||
splx(s);
|
||||
mtpr(v+vaxloop*NBPG,PR_TBIS);
|
||||
/* mtpr(0,PR_TBIA); */
|
||||
VAXEND
|
||||
#else
|
||||
if(patch[i]&PG_SREF){
|
||||
patch[i]&=~PG_SREF;
|
||||
patch[i]|=PG_V|PG_REF;
|
||||
} else patch[i]|=PG_V;
|
||||
if(patch[++i]&PG_SREF){
|
||||
patch[i]&=~PG_SREF;
|
||||
patch[i]|=PG_V|PG_REF;
|
||||
} else patch[i]|=PG_V;
|
||||
mtpr(v,PR_TBIS);
|
||||
mtpr(v+NBPG,PR_TBIS);
|
||||
#endif
|
||||
} /* else nothing to do */
|
||||
splx(s);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -399,6 +419,7 @@ printf("pmap_enter: pmap: %x,virt %x, phys %x,pv %x prot %x\n",
|
||||
tmp->pv_va=v;
|
||||
pv->pv_next=tmp;
|
||||
}
|
||||
#ifdef oldway
|
||||
splhigh();
|
||||
VAXLOOP
|
||||
patch[i]=pte;
|
||||
@ -406,6 +427,12 @@ printf("pmap_enter: pmap: %x,virt %x, phys %x,pv %x prot %x\n",
|
||||
mtpr(v+NBPG*vaxloop,PR_TBIS);
|
||||
VAXEND
|
||||
mtpr(0,PR_TBIA);
|
||||
#else
|
||||
patch[i++]=pte++;
|
||||
patch[i]=pte;
|
||||
mtpr(v,PR_TBIS);
|
||||
mtpr(v+NBPG,PR_TBIS);
|
||||
#endif
|
||||
splx(s);
|
||||
}
|
||||
|
||||
@ -482,7 +509,7 @@ if(startpmapdebug) printf("pmap_protect: pmap %x, start %x, end %x, prot %x\n",
|
||||
|
||||
if(end<0x40000000){
|
||||
while((end>>PG_SHIFT)>(pmap->pm_pcb->P0LR&~AST_MASK))
|
||||
pmap_expandp0(pmap);
|
||||
pmap_expandp0(pmap,(end>>PG_SHIFT));
|
||||
} else if(end<(u_int)0x80000000){
|
||||
u_int i;
|
||||
i=(start&0x3fffffff)>>PG_SHIFT;
|
||||
@ -560,9 +587,8 @@ printf("pmap_remove: ptestart %x, pteslut %x, pv %x\n",ptestart, pteslut,pv);
|
||||
if(!remove_pmap_from_mapping(pv,pmap)){
|
||||
panic("pmap_remove: pmap not in pv_table");
|
||||
}
|
||||
*ptestart=0; /* XXX */
|
||||
*ptestart=0;
|
||||
*(ptestart+1)=0;
|
||||
/* mtpr(countup,PR_TBIS); */
|
||||
}
|
||||
mtpr(0,PR_TBIA);
|
||||
splx(s);
|
||||
@ -616,7 +642,7 @@ pmap_copy_page(src, dst)
|
||||
if(startpmapdebug)printf("pmap_copy_page: src %x, dst %x\n",src, dst);
|
||||
#endif
|
||||
s=splimp();
|
||||
|
||||
#ifdef oldway
|
||||
VAXLOOP
|
||||
pte_cmap[0]=((src>>PGSHIFT)+vaxloop)|PG_V|PG_RO;
|
||||
pte_cmap[1]=((dst>>PGSHIFT)+vaxloop)|PG_V|PG_KW;
|
||||
@ -625,7 +651,18 @@ if(startpmapdebug)printf("pmap_copy_page: src %x, dst %x\n",src, dst);
|
||||
mtpr(0,PR_TBIA);
|
||||
bcopy((void *)v_cmap, (void *)v_cmap+NBPG, NBPG);
|
||||
VAXEND
|
||||
|
||||
#else
|
||||
pte_cmap[0]=(src>>PGSHIFT)|PG_V|PG_RO;
|
||||
pte_cmap[1]=(dst>>PGSHIFT)|PG_V|PG_KW;
|
||||
mtpr(v_cmap,PR_TBIS);
|
||||
mtpr(v_cmap+NBPG,PR_TBIS);
|
||||
bcopy((void *)v_cmap, (void *)v_cmap+NBPG, NBPG);
|
||||
pte_cmap[0]=((src+NBPG)>>PGSHIFT)|PG_V|PG_RO;
|
||||
pte_cmap[1]=((dst+NBPG)>>PGSHIFT)|PG_V|PG_RW;
|
||||
mtpr(v_cmap,PR_TBIS);
|
||||
mtpr(v_cmap+NBPG,PR_TBIS);
|
||||
bcopy((void *)v_cmap, (void *)v_cmap+NBPG, NBPG);
|
||||
#endif
|
||||
splx(s);
|
||||
}
|
||||
|
||||
@ -635,7 +672,8 @@ alloc_pv_entry()
|
||||
pv_entry_t temporary;
|
||||
|
||||
if(!pv_head) {
|
||||
temporary=(pv_entry_t)malloc(sizeof(struct pv_entry), M_VMPVENT, M_NOWAIT);
|
||||
temporary=(pv_entry_t)malloc(sizeof(struct pv_entry),
|
||||
M_VMPVENT, M_NOWAIT);
|
||||
#ifdef DEBUG
|
||||
if(startpmapdebug) printf("alloc_pv_entry: %x\n",temporary);
|
||||
#endif
|
||||
@ -652,7 +690,7 @@ void
|
||||
free_pv_entry(entry)
|
||||
pv_entry_t entry;
|
||||
{
|
||||
if(pv_count>=50) { /* XXX Should be a define? */
|
||||
if(pv_count>=100) { /* Should be a define? */
|
||||
free(entry, M_VMPVENT);
|
||||
} else {
|
||||
entry->pv_next=pv_head;
|
||||
@ -673,11 +711,17 @@ pmap_is_referenced(pa)
|
||||
if(!pv->pv_pmap) return 0;
|
||||
|
||||
do {
|
||||
#ifdef oldway
|
||||
VAXLOOP
|
||||
pte=(u_int *)pmap_virt2pte(pv->pv_pmap,
|
||||
pv->pv_va+vaxloop*NBPG);
|
||||
spte|=*pte;
|
||||
VAXEND
|
||||
#else
|
||||
pte=(u_int *)pmap_virt2pte(pv->pv_pmap,pv->pv_va);
|
||||
spte|=*pte++;
|
||||
spte|=*pte;
|
||||
#endif
|
||||
} while(pv=pv->pv_next);
|
||||
return((spte&PG_REF)?1:0);
|
||||
}
|
||||
@ -692,11 +736,17 @@ pmap_is_modified(pa)
|
||||
pv=PHYS_TO_PV(pa);
|
||||
if(!pv->pv_pmap) return 0;
|
||||
do {
|
||||
#ifdef oldway
|
||||
VAXLOOP
|
||||
pte=(u_int *)pmap_virt2pte(pv->pv_pmap,
|
||||
pv->pv_va+vaxloop*NBPG);
|
||||
spte|=*pte;
|
||||
VAXEND
|
||||
#else
|
||||
pte=(u_int *)pmap_virt2pte(pv->pv_pmap,pv->pv_va);
|
||||
spte|=*pte++;
|
||||
spte|=*pte;
|
||||
#endif
|
||||
} while(pv=pv->pv_next);
|
||||
return((spte&PG_M)?1:0);
|
||||
}
|
||||
@ -724,6 +774,7 @@ if(startpmapdebug) printf("pmap_clear_reference: pa %x, pv %x\n",pa,pv);
|
||||
if(!pv->pv_pmap) return;
|
||||
|
||||
do {
|
||||
#ifdef oldway
|
||||
VAXLOOP
|
||||
pte=(int *)pmap_virt2pte(pv->pv_pmap,
|
||||
pv->pv_va+vaxloop*NBPG);
|
||||
@ -733,6 +784,13 @@ if(startpmapdebug) printf("pmap_clear_reference: pa %x, pv %x\n",pa,pv);
|
||||
*pte|=PG_SREF;
|
||||
splx(s);
|
||||
VAXEND
|
||||
#else
|
||||
pte=(int *)pmap_virt2pte(pv->pv_pmap,pv->pv_va);
|
||||
*pte&= ~(PG_REF|PG_V);
|
||||
*pte++|=PG_SREF;
|
||||
*pte&= ~(PG_REF|PG_V);
|
||||
*pte|=PG_SREF;
|
||||
#endif
|
||||
} while(pv=pv->pv_next);
|
||||
mtpr(0,PR_TBIA);
|
||||
}
|
||||
@ -747,6 +805,7 @@ pmap_clear_modify(pa)
|
||||
pv=PHYS_TO_PV(pa);
|
||||
if(!pv->pv_pmap) return;
|
||||
do {
|
||||
#ifdef oldway
|
||||
s=splclock();
|
||||
VAXLOOP
|
||||
pte=(u_int *)pmap_virt2pte(pv->pv_pmap,
|
||||
@ -754,6 +813,11 @@ pmap_clear_modify(pa)
|
||||
*pte&= ~PG_M;
|
||||
VAXEND
|
||||
splx(s);
|
||||
#else
|
||||
pte=(u_int *)pmap_virt2pte(pv->pv_pmap,pv->pv_va);
|
||||
*pte++&= ~PG_M;
|
||||
*pte&= ~PG_M;
|
||||
#endif
|
||||
} while(pv=pv->pv_next);
|
||||
}
|
||||
|
||||
@ -786,7 +850,7 @@ pmap_page_protect(pa, prot)
|
||||
vm_prot_t prot;
|
||||
{
|
||||
pv_entry_t pv,opv;
|
||||
u_int s,*pte,nyprot,kprot;
|
||||
u_int s,*pte,*pte1,nyprot,kprot;
|
||||
|
||||
#ifdef DEBUG
|
||||
if(startpmapdebug) printf("pmap_page_protect: pa %x, prot %x\n",pa, prot);
|
||||
@ -803,8 +867,9 @@ if(startpmapdebug) printf("pmap_page_protect: pa %x, prot %x\n",pa, prot);
|
||||
case VM_PROT_READ:
|
||||
case VM_PROT_READ|VM_PROT_EXECUTE:
|
||||
do {
|
||||
pte=(int *)pmap_virt2pte(pv->pv_pmap, pv->pv_va);
|
||||
pte=pte1=(int *)pmap_virt2pte(pv->pv_pmap, pv->pv_va);
|
||||
s=splimp();
|
||||
#ifdef oldway
|
||||
VAXLOOP
|
||||
*(pte+vaxloop)&=~PG_PROT;
|
||||
if(pv->pv_va>0x7fffffff)
|
||||
@ -812,6 +877,17 @@ if(startpmapdebug) printf("pmap_page_protect: pa %x, prot %x\n",pa, prot);
|
||||
else
|
||||
*(pte+vaxloop)|=nyprot;
|
||||
VAXEND
|
||||
#else
|
||||
*pte1++&=~PG_PROT;
|
||||
*pte1&=~PG_PROT;
|
||||
if(pv->pv_va>0x7fffffff){
|
||||
*pte|=kprot;
|
||||
*pte1|=kprot;
|
||||
} else{
|
||||
*pte|=nyprot;
|
||||
*pte1|=nyprot;
|
||||
}
|
||||
#endif
|
||||
splx(s);
|
||||
} while(pv=pv->pv_next);
|
||||
mtpr(0,PR_TBIA);
|
||||
@ -821,17 +897,27 @@ if(startpmapdebug) printf("pmap_page_protect: pa %x, prot %x\n",pa, prot);
|
||||
|
||||
pte=(int *)pmap_virt2pte(pv->pv_pmap, pv->pv_va);
|
||||
s = splimp();
|
||||
#ifdef oldway
|
||||
VAXLOOP
|
||||
*(pte+vaxloop)=0;
|
||||
VAXEND
|
||||
#else
|
||||
*pte++=0;
|
||||
*pte=0;
|
||||
#endif
|
||||
opv=pv;
|
||||
pv=pv->pv_next;
|
||||
bzero(opv,sizeof(struct pv_entry));
|
||||
while(pv){
|
||||
pte=(int *)pmap_virt2pte(pv->pv_pmap, pv->pv_va);
|
||||
#ifdef oldway
|
||||
VAXLOOP
|
||||
*(pte+vaxloop)=0;
|
||||
VAXEND
|
||||
#else
|
||||
*pte++=0;
|
||||
*pte=0;
|
||||
#endif
|
||||
opv=pv;
|
||||
pv=pv->pv_next;
|
||||
free_pv_entry(opv);
|
||||
@ -860,14 +946,22 @@ if(startpmapdebug)printf("pmap_zero_page(phys %x, v_cmap %x, pte_cmap %x\n",
|
||||
phys,v_cmap,pte_cmap);
|
||||
#endif
|
||||
s=splimp();
|
||||
#ifdef oldway
|
||||
VAXLOOP
|
||||
*pte_cmap=((phys+(NBPG*vaxloop))>>PG_SHIFT)|PG_V|PG_KW;
|
||||
mtpr(v_cmap,PR_TBIA);
|
||||
clearpage(v_cmap);
|
||||
bzero(v_cmap,NBPG);
|
||||
VAXEND
|
||||
*pte_cmap=0;
|
||||
mtpr(v_cmap,PR_TBIA);
|
||||
mtpr(0,PR_TBIA);
|
||||
#else
|
||||
pte_cmap[0]=(phys>>PG_SHIFT)|PG_V|PG_KW;
|
||||
pte_cmap[1]=pte_cmap[0]+1;
|
||||
mtpr(v_cmap,PR_TBIS);
|
||||
mtpr(v_cmap+NBPG,PR_TBIS);
|
||||
bzero(v_cmap,NBPG*2);
|
||||
#endif
|
||||
pte_cmap[0]=pte_cmap[1]=0;
|
||||
mtpr(v_cmap,PR_TBIS);
|
||||
mtpr(v_cmap+NBPG,PR_TBIS);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
@ -893,17 +987,23 @@ pmap_virt2pte(pmap,vaddr)
|
||||
return((pt_entry_t *)&pte[vaddr>>PG_SHIFT]);
|
||||
}
|
||||
|
||||
pmap_expandp0(pmap)
|
||||
pmap_expandp0(pmap,ny_storlek)
|
||||
struct pmap *pmap;
|
||||
{
|
||||
u_int tmp,s,size,osize,oaddr,astlvl;
|
||||
u_int tmp,s,size,osize,oaddr,astlvl,*i,j;
|
||||
|
||||
astlvl=pmap->pm_pcb->P0LR&AST_MASK;
|
||||
osize=(pmap->pm_pcb->P0LR&~AST_MASK)*4;
|
||||
size=osize+PAGE_SIZE;
|
||||
/* size=osize+PAGE_SIZE; */
|
||||
size=ny_storlek*4;
|
||||
tmp=kmem_alloc_wait(pte_map, size);
|
||||
s=splhigh();
|
||||
#if 0
|
||||
for(j=(u_int)tmp+size,i=tmp;i<j;i++)
|
||||
if(*i!=0)
|
||||
printf("Onollad pte\n");
|
||||
blkclr((void*)tmp,size); /* Sanity */
|
||||
#endif
|
||||
if(osize) blkcpy(pmap->pm_pcb->P0BR, (void*)tmp,osize);
|
||||
oaddr=(u_int)pmap->pm_pcb->P0BR;
|
||||
mtpr(tmp,PR_P0BR);
|
||||
@ -918,13 +1018,18 @@ pmap_expandp0(pmap)
|
||||
pmap_expandp1(pmap)
|
||||
struct pmap *pmap;
|
||||
{
|
||||
u_int tmp,s,size,osize,oaddr;
|
||||
u_int tmp,s,size,osize,oaddr,*i,j;
|
||||
|
||||
osize=0x800000-(pmap->pm_pcb->P1LR*4);
|
||||
size=osize+PAGE_SIZE;
|
||||
tmp=kmem_alloc_wait(pte_map, size);
|
||||
s=splhigh();
|
||||
#if 0
|
||||
for(j=(u_int)tmp+size,i=tmp;i<j;i++)
|
||||
if(*i!=0)
|
||||
printf("Onollad pte\n");
|
||||
blkclr((void*)tmp,size); /* Sanity */
|
||||
#endif
|
||||
if(osize) blkcpy((void*)pmap->pm_stack, (void*)tmp+PAGE_SIZE,osize);
|
||||
oaddr=pmap->pm_stack;
|
||||
pmap->pm_pcb->P1BR=(void*)(tmp+size-0x800000);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rootfil.c,v 1.4 1995/02/23 17:54:01 ragge Exp $ */
|
||||
/* $NetBSD: rootfil.c,v 1.5 1995/03/30 21:25:32 ragge Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -49,6 +49,7 @@
|
||||
#include "buf.h"
|
||||
#include "mbuf.h"
|
||||
#include "vax/include/pte.h"
|
||||
#include "uba.h"
|
||||
#include "uda.h"
|
||||
#include "reboot.h"
|
||||
#include "conf.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr.s,v 1.5 1995/02/23 17:54:05 ragge Exp $ */
|
||||
/* $NetBSD: subr.s,v 1.6 1995/03/30 21:25:36 ragge Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
|
||||
@ -107,14 +107,6 @@ _physcopypage: .word 0x7
|
||||
ret
|
||||
|
||||
|
||||
# _clearpage should be inline assembler
|
||||
|
||||
.globl _clearpage
|
||||
_clearpage: .word 0x0
|
||||
movc5 $0, (sp), $0, $NBPG, *4(ap)
|
||||
ret
|
||||
|
||||
|
||||
.globl _badaddr
|
||||
_badaddr: .word 0x0
|
||||
# Called with addr,b/w/l
|
||||
@ -145,7 +137,7 @@ _badaddr: .word 0x0
|
||||
5: mtpr (sp)+,$0x12
|
||||
movl r3,r0
|
||||
ret
|
||||
|
||||
#if 0
|
||||
.align 2
|
||||
_mba_0: .globl _mba_0
|
||||
movl $0,mbanum
|
||||
@ -166,13 +158,16 @@ _mba: pushr $0xffff
|
||||
calls $1,_mbainterrupt
|
||||
popr $0xffff
|
||||
rei
|
||||
|
||||
#endif
|
||||
#
|
||||
# copyin(from, to, len) copies from userspace to kernelspace.
|
||||
#
|
||||
|
||||
.globl _copyin
|
||||
_copyin:.word 0x1c
|
||||
.globl _locopyin
|
||||
_locopyin:.word 0x1c
|
||||
movl 16(ap),r0 # Get fault pointer flag
|
||||
movl $ci,(r0)
|
||||
|
||||
movl 4(ap),r0 # from
|
||||
movl 8(ap),r1 # to
|
||||
movl 12(ap),r2 # len
|
||||
@ -180,31 +175,26 @@ _copyin:.word 0x1c
|
||||
movl r0,r4
|
||||
movl r2,r3
|
||||
|
||||
/* 3: prober $3,r3,(r4) # Check access to all pages. */
|
||||
# beql 1f
|
||||
# cmpl r3,$NBPG
|
||||
# bleq 2f
|
||||
# subl2 $NBPG,r3
|
||||
# addl2 $NBPG,r4
|
||||
# brb 3b
|
||||
|
||||
tstl r2
|
||||
beql 3f
|
||||
2: movb (r0)+,(r1)+ # XXX Should be done in a faster way.
|
||||
decl r2
|
||||
bneq 2b
|
||||
3: clrl r0
|
||||
ret
|
||||
|
||||
1: movl $EFAULT,r0 # Didnt work...
|
||||
ret
|
||||
3: movl 16(ap),r0
|
||||
clrl (r0)
|
||||
clrl r0
|
||||
ci: ret
|
||||
|
||||
#
|
||||
# copyout(from, to, len) in the same manner as copyin()
|
||||
# locopyout(from, to, len, addr) in the same manner as copyin()
|
||||
# addr is iftrap addr for faulting.
|
||||
#
|
||||
|
||||
.globl _copyout
|
||||
_copyout:.word 0x1c
|
||||
.globl _locopyout
|
||||
_locopyout:.word 0x1c
|
||||
movl 16(ap),r0 # Get fault pointer flag
|
||||
movl $co,(r0) # and save ret addr
|
||||
|
||||
movl 4(ap),r0 # from
|
||||
movl 8(ap),r1 # to
|
||||
movl 12(ap),r2 # len
|
||||
@ -212,24 +202,18 @@ _copyout:.word 0x1c
|
||||
movl r1,r4
|
||||
movl r2,r3
|
||||
|
||||
/*3: probew $3,r3,(r4) # Check access to all pages. */
|
||||
# beql 1b
|
||||
# cmpl r3,$NBPG
|
||||
# bleq 2f
|
||||
# subl2 $NBPG,r3
|
||||
# addl2 $NBPG,r4
|
||||
# brb 3b
|
||||
|
||||
tstl r2
|
||||
beql 3f
|
||||
2: movb (r0)+,(r1)+ # XXX Should be done in a faster way.
|
||||
decl r2
|
||||
bneq 2b
|
||||
3: clrl r0
|
||||
ret
|
||||
3: movl 16(ap),r0
|
||||
clrl (r0)
|
||||
clrl r0
|
||||
co: ret
|
||||
|
||||
#
|
||||
# copystr(from, to, maxlen, *copied)
|
||||
# copystr(from, to, maxlen, *copied, addr)
|
||||
# Only used in kernel mode, doesnt check accessability.
|
||||
#
|
||||
|
||||
@ -239,7 +223,6 @@ _copystr: .word 0x7c
|
||||
movl 8(ap),r5 # to
|
||||
movl 12(ap),r2 # len
|
||||
movl 16(ap),r3 # copied
|
||||
# halt
|
||||
|
||||
#if VAX630
|
||||
movl r4, r1 # (3) string address == r1
|
||||
@ -259,35 +242,26 @@ Llocc_out:
|
||||
|
||||
subl3 r0, r2, r6 # Len to copy.
|
||||
incl r6
|
||||
tstl r3
|
||||
beql 7f
|
||||
movl r6,(r3)
|
||||
# pushl r6
|
||||
# pushl r5
|
||||
# pushl r4
|
||||
movc3 r6,(r4),(r5)
|
||||
# calls $3,_bcopy
|
||||
7: movc3 r6,(r4),(r5)
|
||||
movl $0,r0
|
||||
ret
|
||||
cs: ret
|
||||
|
||||
1:
|
||||
# pushl r2
|
||||
# pushl r5
|
||||
# pushl r4
|
||||
# calls $3,_bcopy
|
||||
movc3 r2,(r4),(r5)
|
||||
1: movc3 r2,(r4),(r5)
|
||||
movl $ENAMETOOLONG, r0
|
||||
ret
|
||||
|
||||
|
||||
_loswtch: .globl _loswtch
|
||||
# halt
|
||||
mtpr _curpcb,$PR_PCBB
|
||||
svpctx
|
||||
mtpr _nypcb,$PR_PCBB
|
||||
ldpctx
|
||||
# halt
|
||||
rei
|
||||
|
||||
mtpr _curpcb,$PR_PCBB
|
||||
svpctx
|
||||
mtpr _nypcb,$PR_PCBB
|
||||
ldpctx
|
||||
rei
|
||||
|
||||
#if 0
|
||||
.globl _savectx
|
||||
_savectx:
|
||||
clrl r0
|
||||
@ -306,7 +280,7 @@ _savectx:
|
||||
movl (sp),(r0)
|
||||
movl 4(sp),4(r0)
|
||||
rei
|
||||
|
||||
#endif
|
||||
|
||||
.data
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: swapgeneric.c,v 1.4 1995/02/13 00:46:18 ragge Exp $ */
|
||||
/* $NetBSD: swapgeneric.c,v 1.5 1995/03/30 21:25:41 ragge Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986 The Regents of the University of California.
|
||||
@ -187,7 +187,7 @@ gets(cp)
|
||||
|
||||
lp = cp;
|
||||
for (;;) {
|
||||
cnputc(c = cngetc());
|
||||
cnputc(c = (cngetc()&0x7f));
|
||||
switch (c) {
|
||||
case '\n':
|
||||
case '\r':
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trap.c,v 1.7 1995/02/23 17:54:08 ragge Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.8 1995/03/30 21:25:45 ragge Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
|
||||
@ -105,7 +105,7 @@ arithflt(frame)
|
||||
struct trapframe *frame;
|
||||
{
|
||||
u_int sig, type=frame->trap,trapsig=1,s;
|
||||
u_int rv, addr;
|
||||
u_int rv, addr,*i,j;
|
||||
struct proc *p=curproc;
|
||||
struct pmap *pm;
|
||||
vm_map_t map;
|
||||
@ -119,9 +119,29 @@ arithflt(frame)
|
||||
switch(type){
|
||||
|
||||
default:
|
||||
faulter:
|
||||
if(frame->trap<12)
|
||||
printf("\nKernel fault: %s. Stack dump:\n\n",
|
||||
traptypes[frame->trap]);
|
||||
else
|
||||
printf("\nKernel fault: %d. Stack dump:\n\n",
|
||||
frame->trap);
|
||||
printf("FP %8x AP %8x R0 %8x R1 %8x\n",frame->fp,
|
||||
frame->ap, frame->r0, frame->r1);
|
||||
printf("R2 %8x R3 %8x R4 %8x R5 %8x\n",frame->r2,frame->r3,
|
||||
frame->r4,frame->r5);
|
||||
printf("TRAP %2x CODE %6x PC %8x PSL %8x\n",frame->trap,
|
||||
frame->code, frame->pc, frame->psl);
|
||||
i=(u_int*)&(frame->psl);
|
||||
printf("(RET PC) %8x, (RET PSL) %8x\n",i[1],i[2]);
|
||||
for(j=3;j<15;j+=4)
|
||||
printf("%8x %8x %8x %8x\n",i[j],i[j+1],i[j+2],
|
||||
i[j+3]);
|
||||
asm("halt");
|
||||
printf("trap type %x, code %x, pc %x, psl %x\n",
|
||||
frame->trap, frame->code, frame->pc, frame->psl);
|
||||
showstate(curproc);
|
||||
asm("halt");
|
||||
panic("trap");
|
||||
|
||||
case T_TRANSFLT|T_USER:
|
||||
@ -227,7 +247,14 @@ if(faultdebug)printf("trap accflt type %x, code %x, pc %x, psl %x\n",
|
||||
|
||||
rv = vm_fault(map, addr, ftype, FALSE);
|
||||
if (rv != KERN_SUCCESS) {
|
||||
if(frame->pc>(u_int)0x80000000) panic("segv in kernel mode");
|
||||
if(frame->pc>(u_int)0x80000000){
|
||||
if(p->p_addr->u_pcb.iftrap){
|
||||
frame->pc=p->p_addr->u_pcb.iftrap;
|
||||
return;
|
||||
}
|
||||
printf("Segv in kernel mode: rv %d\n",rv);
|
||||
goto faulter;
|
||||
}
|
||||
sig=SIGSEGV;
|
||||
} else trapsig=0;
|
||||
break;
|
||||
@ -238,9 +265,9 @@ if(faultdebug)printf("trap accflt type %x, code %x, pc %x, psl %x\n",
|
||||
if(faultdebug)printf("trap ptelen type %x, code %x, pc %x, psl %x\n",
|
||||
frame->trap, frame->code, frame->pc, frame->psl);
|
||||
if(frame->code<0x40000000){ /* P0 */
|
||||
if((p->p_vmspace->vm_tsize+p->p_vmspace->vm_dsize)
|
||||
>(frame->code>>PAGE_SHIFT)){
|
||||
pmap_expandp0(pm);
|
||||
int i=p->p_vmspace->vm_tsize+p->p_vmspace->vm_dsize;
|
||||
if(i>(frame->code>>PAGE_SHIFT)){
|
||||
pmap_expandp0(pm,i<<1);
|
||||
trapsig=0;
|
||||
} else {
|
||||
sig=SIGSEGV;
|
||||
@ -248,7 +275,8 @@ if(faultdebug)printf("trap ptelen type %x, code %x, pc %x, psl %x\n",
|
||||
} else if(frame->code>0x7fffffff){ /* System, segv */
|
||||
sig=SIGSEGV;
|
||||
} else { /* P1 */
|
||||
if(frame->code<(u_int)(p->p_vmspace->vm_maxsaddr)){
|
||||
int i=(u_int)(p->p_vmspace->vm_maxsaddr);
|
||||
if(frame->code<i){
|
||||
sig=SIGSEGV;
|
||||
} else {
|
||||
pmap_expandp1(pm);
|
||||
@ -293,6 +321,8 @@ if(p){
|
||||
} else {
|
||||
printf("No process\n");
|
||||
}
|
||||
printf("kernel stack: %x, interrupt stack %x\n",
|
||||
mfpr(PR_KSP),mfpr(PR_ISP));
|
||||
printf("P0BR %x, P0LR %x, P1BR %x, P1LR %x\n",
|
||||
mfpr(PR_P0BR),mfpr(PR_P0LR),mfpr(PR_P1BR),mfpr(PR_P1LR));
|
||||
}
|
||||
@ -312,13 +342,28 @@ syscall(frame)
|
||||
struct trapframe *frame;
|
||||
{
|
||||
struct sysent *callp;
|
||||
int err,rval[2],args[8],narg,sig;
|
||||
int err,rval[2],args[8],sig;
|
||||
struct trapframe *exptr;
|
||||
struct proc *p=curproc;
|
||||
|
||||
if(startsysc)printf("trap syscall type %x, code %x, pc %x, psl %x\n",
|
||||
frame->trap, frame->code, frame->pc, frame->psl);
|
||||
if(startsysc)printf("trap syscall %s pc %x, psl %x, ap %x, pid %d\n",
|
||||
syscallnames[frame->code], frame->pc, frame->psl,frame->ap,
|
||||
curproc->p_pid);
|
||||
|
||||
p->p_addr->u_pcb.framep=frame;
|
||||
|
||||
if(frame->code==SYS___syscall){
|
||||
int g=*(int *)(frame->ap);
|
||||
|
||||
frame->code=*(int *)(frame->ap+4);
|
||||
frame->ap+=8;
|
||||
*(int *)(frame->ap)=g-2;
|
||||
if(startsysc){
|
||||
printf("SYS___syscall: ap %x\n",frame->ap);
|
||||
asm("halt");
|
||||
}
|
||||
}
|
||||
|
||||
if(frame->code<0||frame->code>=nsysent)
|
||||
callp= &sysent[0];
|
||||
else
|
||||
@ -326,13 +371,17 @@ if(startsysc)printf("trap syscall type %x, code %x, pc %x, psl %x\n",
|
||||
|
||||
rval[0]=0;
|
||||
rval[1]=frame->r1;
|
||||
narg=callp->sy_narg * sizeof(int);
|
||||
if((narg=callp->sy_narg*4)!=0)
|
||||
copyin((char*)frame->ap+4, args, narg);
|
||||
if(callp->sy_narg)
|
||||
copyin((char*)frame->ap+4, args, callp->sy_argsize);
|
||||
|
||||
err=(*callp->sy_call)(curproc,args,rval);
|
||||
exptr=curproc->p_addr->u_pcb.framep;
|
||||
|
||||
if(startsysc)
|
||||
printf("retur %s pc %x, psl %x, ap %x, pid %d, v{rde %d r0 %d, r1 %d\n",
|
||||
syscallnames[exptr->code], exptr->pc, exptr->psl,exptr->ap,
|
||||
curproc->p_pid,err,rval[0],rval[1]);
|
||||
|
||||
switch(err){
|
||||
case 0:
|
||||
exptr->r1=rval[1];
|
||||
@ -355,3 +404,28 @@ if(startsysc)printf("trap syscall type %x, code %x, pc %x, psl %x\n",
|
||||
stray(scb, vec){
|
||||
printf("stray interrupt scb %d, vec 0x%x\n", scb, vec);
|
||||
}
|
||||
|
||||
struct inta {
|
||||
char pushr[2]; /* pushr $3f */
|
||||
char pushl[2]; /* pushl $? */
|
||||
char nop; /* nop, for foolish gcc */
|
||||
char calls[3]; /* $1,? */
|
||||
u_int hoppaddr; /* jump for calls */
|
||||
char popr[2]; /* popr $0x3f */
|
||||
char rei; /* rei */
|
||||
} intasm = {0xbb, 0x3f, 0xdd, 0, 1, 0xfb, 1, 0xef, 0, 0xba, 0x3f, 2};
|
||||
|
||||
u_int
|
||||
settrap(plats, nyrut,arg)
|
||||
u_int plats; /* Pointer to place to copy interrupt routine */
|
||||
u_int nyrut; /* Pointer to new routine to jump to */
|
||||
u_int arg; /* arg number to pass to routine. */
|
||||
{
|
||||
struct inta *introut;
|
||||
|
||||
introut=(void *)((plats&0xfffffffc)+4);
|
||||
bcopy(&intasm, introut, sizeof(struct inta));
|
||||
introut->pushl[1]=arg;
|
||||
introut->hoppaddr=nyrut-(u_int)&introut->popr[0];
|
||||
return (u_int)introut;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vm_machdep.c,v 1.9 1995/03/09 12:05:32 mycroft Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.10 1995/03/30 21:25:51 ragge Exp $ */
|
||||
|
||||
#undef SWDEBUG
|
||||
/*
|
||||
@ -37,11 +37,13 @@
|
||||
#include "vm/vm.h"
|
||||
#include "vm/vm_kern.h"
|
||||
#include "vm/vm_page.h"
|
||||
#include "vax/include/vmparam.h"
|
||||
#include "vax/include/mtpr.h"
|
||||
#include "vax/include/pmap.h"
|
||||
#include "vax/include/pte.h"
|
||||
#include "vax/include/macros.h"
|
||||
#include "machine/vmparam.h"
|
||||
#include "machine/mtpr.h"
|
||||
#include "machine/pmap.h"
|
||||
#include "machine/pte.h"
|
||||
#include "machine/macros.h"
|
||||
#include "machine/pcb.h"
|
||||
#include "machine/trap.h"
|
||||
#include "sys/param.h"
|
||||
#include "sys/proc.h"
|
||||
#include "sys/user.h"
|
||||
@ -75,12 +77,12 @@ pagemove(from, to, size)
|
||||
(unsigned int)Sysmap))&0x1fffff)<<9)
|
||||
|
||||
|
||||
volatile unsigned int ustat,uofset,p0br,p0lr,p1br,p1lr,savpcb;
|
||||
volatile unsigned int ustat,p0br,p0lr,p1br,p1lr,savpcb;
|
||||
|
||||
cpu_fork(p1, p2)
|
||||
struct proc *p1, *p2;
|
||||
{
|
||||
unsigned int *i,ksp,uorig,uchld,j;
|
||||
unsigned int *i,ksp,uorig,uchld,j,uofset;
|
||||
struct pcb *nyproc;
|
||||
struct pte *ptep;
|
||||
extern int sigsida;
|
||||
@ -111,21 +113,41 @@ cpu_fork(p1, p2)
|
||||
*i = *i+(uchld-uorig);
|
||||
|
||||
|
||||
/* Set up page table registers, map sigreturn page into user space */
|
||||
|
||||
nyproc->P0BR=nyproc->P1BR=0;
|
||||
nyproc->P0LR=AST_PCB;
|
||||
nyproc->P1LR=0x200000;
|
||||
nyproc->USP = mfpr(PR_USP);
|
||||
nyproc->iftrap=NULL;
|
||||
(u_int)pmap->pm_pcb=uchld;
|
||||
/*
|
||||
* %0 is child pcb. %1 is diff parent - child.
|
||||
*/
|
||||
|
||||
asm("
|
||||
addl3 %1,sp,(%0) # stack offset
|
||||
addl2 $16,%0 # offset for r1
|
||||
movl $1,(%0)+
|
||||
movl r1,(%0)+
|
||||
movq r2,(%0)+
|
||||
movq r4,(%0)+
|
||||
movq r6,(%0)+
|
||||
movq r8,(%0)+
|
||||
movq r10,(%0)+
|
||||
movl ap,(%0)+
|
||||
movl fp,(%0)
|
||||
addl2 %1,(%0)+
|
||||
movl $Lre,(%0)+ # pc
|
||||
movpsl (%0)
|
||||
clrl r0
|
||||
Lre: mtpr $0,$18 # spl0();
|
||||
ret
|
||||
":: "r"(nyproc),"r"(uofset));
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* For the microvax, the stack registers PR_KSP,.. live in the PCB,
|
||||
* so we need to make sure they get copied to the new pcb.
|
||||
*/
|
||||
nyproc->KSP = mfpr(PR_KSP);
|
||||
nyproc->SSP = mfpr(PR_SSP);
|
||||
nyproc->USP = mfpr(PR_USP);
|
||||
mtpr(0, PR_ESP); /* Clear in this pcb, then flip and set it */
|
||||
(u_int)pmap->pm_pcb=uchld;
|
||||
asm("
|
||||
mfpr $8,_p0br
|
||||
mfpr $9,_p0lr
|
||||
@ -153,6 +175,7 @@ cpu_fork(p1, p2)
|
||||
}
|
||||
spl0();
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -239,10 +262,13 @@ idle:
|
||||
/* Should check that values is in bounds XXX */
|
||||
copyinstr(from, to, maxlen, lencopied)
|
||||
void *from, *to;
|
||||
size_t *lencopied,maxlen;
|
||||
u_int *lencopied,maxlen;
|
||||
{
|
||||
u_int i;
|
||||
void *addr=&curproc->p_addr->u_pcb.iftrap;
|
||||
char *gfrom=from, *gto=to;
|
||||
|
||||
asm("movl $Lstr,(%0)":: "r"(addr));
|
||||
for(i=0;i<maxlen;i++){
|
||||
*(gto+i)=*(gfrom+i);
|
||||
if(!(*(gto+i))) goto ok;
|
||||
@ -254,14 +280,18 @@ ok:
|
||||
return(0);
|
||||
}
|
||||
|
||||
asm("Lstr: ret");
|
||||
|
||||
/* Should check that values is in bounds XXX */
|
||||
copyoutstr(from, to, maxlen, lencopied)
|
||||
void *from, *to;
|
||||
size_t *lencopied,maxlen;
|
||||
u_int *lencopied,maxlen;
|
||||
{
|
||||
u_int i;
|
||||
char *gfrom=from, *gto=to;
|
||||
void *addr=&curproc->p_addr->u_pcb.iftrap;
|
||||
|
||||
asm("movl $Lstr,(%0)":: "r"(addr));
|
||||
for(i=0;i<maxlen;i++){
|
||||
*(gto+i)=*(gfrom+i);
|
||||
if(!(*(gto+i))) goto ok;
|
||||
@ -302,18 +332,7 @@ printf("Warning: reno_omagic\n");
|
||||
return(error);
|
||||
}
|
||||
|
||||
int
|
||||
sysarch(p, uap, retval)
|
||||
struct proc *p,
|
||||
struct sysarch_args /* {
|
||||
syscallarg(int) op;
|
||||
syscallarg(char *) parms;
|
||||
} */ *uap;
|
||||
register_t *retval;
|
||||
{
|
||||
|
||||
return(EINVAL);
|
||||
}
|
||||
sysarch(){return(EINVAL);}
|
||||
|
||||
/*
|
||||
* 4.3BSD Reno programs have an 1K header first in the executable
|
||||
@ -383,11 +402,18 @@ suword(ptr,val)
|
||||
void *ptr;
|
||||
int val;
|
||||
{
|
||||
void *addr=&curproc->p_addr->u_pcb.iftrap;
|
||||
|
||||
asm("movl $Lstr,(%0)":: "r"(addr));
|
||||
*(int *)ptr=val;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Dump the machine specific header information at the start of a core dump.
|
||||
* First put all regs in PCB for debugging purposes. This is not an good
|
||||
* way to do this, but good for my purposes so far.
|
||||
* XXX - registers r6-r11 are lost in coredump!
|
||||
*/
|
||||
int
|
||||
cpu_coredump(p, vp, cred)
|
||||
@ -395,7 +421,39 @@ cpu_coredump(p, vp, cred)
|
||||
struct vnode *vp;
|
||||
struct ucred *cred;
|
||||
{
|
||||
struct pcb *pb=&p->p_addr->u_pcb;
|
||||
struct trapframe *exptr=pb->framep;
|
||||
|
||||
pb->R[0]=exptr->r0;
|
||||
pb->R[1]=exptr->r1;
|
||||
pb->R[2]=exptr->r2;
|
||||
pb->R[3]=exptr->r3;
|
||||
pb->R[4]=exptr->r4;
|
||||
pb->R[5]=exptr->r5;
|
||||
pb->FP=exptr->fp;
|
||||
pb->AP=exptr->ap;
|
||||
pb->PC=exptr->pc;
|
||||
pb->PSL=exptr->psl;
|
||||
pb->ESP=exptr->trap;
|
||||
pb->SSP=exptr->code;
|
||||
|
||||
return (vn_rdwr(UIO_WRITE, vp, (caddr_t) p->p_addr, ctob(UPAGES),
|
||||
(off_t)0, UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, (int *) NULL,
|
||||
p));
|
||||
}
|
||||
|
||||
copyout(from, to, len)
|
||||
void *from, *to;
|
||||
{
|
||||
void *addr=&curproc->p_addr->u_pcb.iftrap;
|
||||
|
||||
return locopyout(from, to, len, addr);
|
||||
}
|
||||
|
||||
copyin(from, to, len)
|
||||
void *from, *to;
|
||||
{
|
||||
void *addr=&curproc->p_addr->u_pcb.iftrap;
|
||||
|
||||
return locopyin(from, to, len, addr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user