-/* $NetBSD: intvec.s,v 1.12 1995/11/10 19:05:46 ragge Exp $ */
+/* $NetBSD: intvec.s,v 1.13 1996/01/28 12:22:55 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
.long label+stack;
.text
- .globl _kernbase,_rpb
+ .globl _kernbase, _rpb
_kernbase:
_rpb:
/*
syscall:
pushl $T_SYSCALL
pushr $0xfff
+ mfpr $PR_USP, -(sp)
pushl ap
pushl fp
pushl sp # pointer to syscall frame; defined in trap.h
- calls $1,_syscall
- movl (sp)+,fp
- movl (sp)+,ap
+ calls $1, _syscall
+ movl (sp)+, fp
+ movl (sp)+, ap
+ mtpr (sp)+, $PR_USP
popr $0xfff
- addl2 $8,sp
- mtpr $0x1f,$PR_IPL # Be sure we can REI
+ addl2 $8, sp
+ mtpr $0x1f, $PR_IPL # Be sure we can REI
rei
STRAY(0, 44)
STRAY(0, B4)
STRAY(0, B8)
- TRAPCALL(ddbtrap,T_KDBTRAP)
+ TRAPCALL(ddbtrap, T_KDBTRAP)
.align 2
.globl hardclock
FASTINTR(consrint, gencnrint)
FASTINTR(constint, gencntint)
+/*
+ * Main routine for traps; all go through this.
+ * Note that we put USP on the frame here, which sometimes should
+ * be KSP to be correct, but because we only alters it when we are
+ * called from user space it doesn't care.
+ * _sret is used in cpu_set_kpc to jump out to user space first time.
+ */
+ .globl _sret
trap: pushr $0xfff
+ mfpr $PR_USP, -(sp)
pushl ap
pushl fp
pushl sp
- calls $1,_arithflt
- movl (sp)+,fp
- movl (sp)+,ap
- popr $0xfff
- addl2 $8,sp
- mtpr $0x1f,$PR_IPL # Be sure we can REI
+ calls $1, _arithflt
+_sret: movl (sp)+, fp
+ movl (sp)+, ap
+ mtpr (sp)+, $PR_USP
+ popr $0xfff
+ addl2 $8, sp
+ mtpr $0x1f, $PR_IPL # Be sure we can REI
rei
#if VAX630 || VAX650
-/* $NetBSD: machdep.c,v 1.22 1996/01/04 22:22:58 jtc Exp $ */
+/* $NetBSD: machdep.c,v 1.23 1996/01/28 12:22:54 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
consinit()
{
#ifdef DDB
- db_machine_init();
+/* db_machine_init(); */
ddb_init();
+#ifdef donotworkbyunknownreason
+ if (boothowto & RB_KDB)
+ Debugger();
+#endif
#endif
}
scf->fp = cntx->sc_fp;
scf->ap = cntx->sc_ap;
scf->pc = cntx->sc_pc;
+ scf->sp = cntx->sc_sp;
scf->psl = cntx->sc_ps;
- mtpr(cntx->sc_sp, PR_USP);
return (EJUSTRETURN);
}
struct trampframe {
- u_int sig; /* Signal number */
- u_int code; /* Info code */
- u_int scp; /* Pointer to struct sigcontext */
- u_int r0, r1, r2, r3, r4, r5; /* Registers saved when
+ unsigned sig; /* Signal number */
+ unsigned code; /* Info code */
+ unsigned scp; /* Pointer to struct sigcontext */
+ unsigned r0, r1, r2, r3, r4, r5; /* Registers saved when
* interrupt */
- u_int pc; /* Address of signal handler */
- u_int arg; /* Pointer to first (and only) sigreturn
+ unsigned pc; /* Address of signal handler */
+ unsigned arg; /* Pointer to first (and only) sigreturn
* argument */
};
int sig, mask;
u_long code;
{
- struct proc *p = curproc;
- struct sigacts *psp = p->p_sigacts;
- struct trapframe *syscf;
- struct sigcontext *sigctx;
- struct trampframe *trampf;
- u_int *cursp;
- int oonstack;
- extern char sigcode[], esigcode[];
+ struct proc *p = curproc;
+ struct sigacts *psp = p->p_sigacts;
+ struct trapframe *syscf;
+ struct sigcontext *sigctx;
+ struct trampframe *trampf;
+ unsigned cursp;
+ int oonstack;
+ extern char sigcode[], esigcode[];
/*
* Allocate and validate space for the signal handler context. Note
* that if the stack is in P0 space, the call to grow() is a nop, and
* allocated the space with a `brk'. We shall allocate space on the
* stack for both struct sigcontext and struct calls...
*/
+ syscf = p->p_addr->u_pcb.framep;
+
/* First check what stack to work on */
if ((psp->ps_flags & SAS_ALTSTACK) && !oonstack &&
(psp->ps_sigonstack & sigmask(sig))) {
- cursp = (u_int *) (psp->ps_sigstk.ss_sp +
- psp->ps_sigstk.ss_size);
+ cursp = (int)(psp->ps_sigstk.ss_sp + psp->ps_sigstk.ss_size);
psp->ps_sigstk.ss_flags |= SS_ONSTACK;
} else
- cursp = (u_int *) mfpr(PR_USP);
- if ((u_int) cursp <= USRSTACK - ctob(p->p_vmspace->vm_ssize))
- (void) grow(p, (u_int) cursp);
+ cursp = syscf->sp;
+ if (cursp <= USRSTACK - ctob(p->p_vmspace->vm_ssize))
+ (void) grow(p, cursp);
/* Set up positions for structs on stack */
- sigctx = (struct sigcontext *) ((u_int) cursp -
- sizeof(struct sigcontext));
- trampf = (struct trampframe *) ((u_int) sigctx -
+ sigctx = (struct sigcontext *) (cursp - sizeof(struct sigcontext));
+ trampf = (struct trampframe *) ((unsigned)sigctx -
sizeof(struct trampframe));
- cursp = (u_int *) sigctx - 2; /* Place for pointer to arg list in
- * sigreturn */
- syscf = p->p_addr->u_pcb.framep;
+ /* Place for pointer to arg list in sigreturn */
+ cursp = (unsigned)sigctx - 8;
+
if (useracc((caddr_t) cursp, sizeof(struct sigcontext) +
sizeof(struct trampframe), B_WRITE) == 0) {
/*
}
/* Set up pointers for sigreturn args */
trampf->arg = (int) sigctx;
- trampf->pc = (u_int) catcher;
+ trampf->pc = (unsigned) catcher;
trampf->scp = (int) sigctx;
trampf->code = code;
trampf->sig = sig;
sigctx->sc_ps = syscf->psl;
sigctx->sc_ap = syscf->ap;
sigctx->sc_fp = syscf->fp;
- sigctx->sc_sp = mfpr(PR_USP);
+ sigctx->sc_sp = syscf->sp;
sigctx->sc_onstack = oonstack;
sigctx->sc_mask = mask;
- syscf->pc = (u_int) (((char *) PS_STRINGS) - (esigcode - sigcode));
+ syscf->pc = (unsigned) (((char *) PS_STRINGS) - (esigcode - sigcode));
syscf->psl = PSL_U | PSL_PREVU;
- syscf->ap = (u_int) cursp;
- mtpr(cursp, PR_USP);
+ syscf->ap = cursp;
+ syscf->sp = cursp;
}
int waittime = -1;
{
struct trapframe *tf = p->p_addr->u_pcb.framep;
- regs->r0 = tf->r0;
- regs->r1 = tf->r1;
- regs->r2 = tf->r2;
- regs->r3 = tf->r3;
- regs->r4 = tf->r4;
- regs->r5 = tf->r5;
- regs->r6 = tf->r6;
- regs->r7 = tf->r7;
- regs->r8 = tf->r8;
- regs->r9 = tf->r9;
- regs->r10 = tf->r10;
- regs->r11 = tf->r11;
+ bcopy(&tf->r0, ®s->r0, 12 * sizeof(int));
regs->ap = tf->ap;
regs->fp = tf->fp;
- regs->sp = mfpr(PR_USP);
+ regs->sp = tf->sp;
regs->pc = tf->pc;
regs->psl = tf->psl;
return 0;
{
struct trapframe *tf = p->p_addr->u_pcb.framep;
- tf->r0 = regs->r0;
- tf->r1 = regs->r1;
- tf->r2 = regs->r2;
- tf->r3 = regs->r3;
- tf->r4 = regs->r4;
- tf->r5 = regs->r5;
- tf->r6 = regs->r6;
- tf->r7 = regs->r7;
- tf->r8 = regs->r8;
- tf->r9 = regs->r9;
- tf->r10 = regs->r10;
- tf->r11 = regs->r11;
+ bcopy(®s->r0, &tf->r0, 12 * sizeof(int));
tf->ap = regs->ap;
tf->fp = regs->fp;
- mtpr(regs->sp, PR_USP);
+ tf->sp = regs->sp;
tf->pc = regs->pc;
tf->psl = regs->psl;
return 0;
int
process_set_pc(p, addr)
- struct proc *p;
- caddr_t addr;
+ struct proc *p;
+ caddr_t addr;
{
- void *ptr;
- struct trapframe *tf;
+ struct trapframe *tf;
+ void *ptr;
if ((p->p_flag & P_INMEM) == 0)
return (EIO);
ptr = (char *) p->p_addr->u_pcb.framep;
tf = ptr;
- tf->pc = (u_int) addr;
+ tf->pc = (unsigned) addr;
return (0);
}
return (0);
}
-#undef setsoftnet
-setsoftnet()
-{
- panic("setsoftnet");
-}
-
ns_cksum()
{
panic("ns_cksum");
cmrerr()
{
+#if 0
switch (cpunumber) {
case VAX_750:
ka750_memerr();
}
+#endif
}
-/* $NetBSD: vm_machdep.c,v 1.18 1995/12/13 18:47:59 ragge Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.19 1996/01/28 12:22:49 ragge Exp $ */
#undef SWDEBUG
/*
#include "machine/macros.h"
#include "machine/trap.h"
#include "machine/pcb.h"
+#include "machine/frame.h"
#include <sys/syscallargs.h>
nyproc->P0LR = AST_PCB;
nyproc->P1LR = 0x200000;
#endif
- nyproc->USP = mfpr(PR_USP);
nyproc->iftrap = NULL;
nyproc->KSP = (u_int)p2->p_addr + USPACE;
bcopy(&tf->r2,&nyproc->R[2],10*sizeof(int));
nyproc->AP = tf->ap;
nyproc->FP = tf->fp;
+ nyproc->USP = tf->sp;
nyproc->PC = tf->pc;
nyproc->PSL = tf->psl & ~PSL_C;
nyproc->R[0] = p1->p_pid; /* parent pid. (shouldn't be needed) */
{
struct pcb *nyproc;
struct {
- u_int chand;
- u_int mask;
- u_int ap;
- u_int fp;
- u_int pc;
- u_int nargs;
- u_int pp;
- u_int rpc;
- u_int rpsl;
+ struct callsframe cf;
+ struct trapframe tf;
} *kc;
- extern int rei;
-
- kc = (void *)p->p_addr + USPACE - sizeof(*kc);
- kc->chand = 0;
- kc->mask = 0x20000000;
- kc->pc = (u_int)&rei;
- kc->nargs = 1;
- kc->pp = (u_int)p;
- kc->rpsl = 0x3c00000;
+ extern int sret, boothowto;
nyproc = &p->p_addr->u_pcb;
- nyproc->framep = (void *)p->p_addr + USPACE - sizeof(struct trapframe);
- nyproc->AP = (u_int)&kc->nargs;
- nyproc->FP = nyproc->KSP = (u_int)kc;
+ (unsigned)kc = nyproc->FP = nyproc->KSP =
+ (unsigned)p->p_addr + USPACE - sizeof(*kc);
+ kc->cf.ca_cond = 0;
+ kc->cf.ca_maskpsw = 0x20000000;
+ kc->cf.ca_pc = (unsigned)&sret;
+ kc->cf.ca_argno = 1;
+ kc->cf.ca_arg1 = (unsigned)p;
+ kc->tf.r11 = boothowto; /* If we have old init */
+ kc->tf.psl = 0x3c00000;
+
+ nyproc->framep = (void *)&kc->tf;
+ nyproc->AP = (unsigned)&kc->cf.ca_argno;
+ nyproc->FP = nyproc->KSP = (unsigned)kc;
nyproc->PC = pc + 2;
}
chdr->c_cpusize = sizeof(struct md_coredump);
bcopy(tf, &state, sizeof(struct md_coredump));
- state.md_tf.code = mfpr(PR_USP); /* XXX */
CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_VAX, CORE_CPU);
cseg.c_addr = 0;
uarea = (u_int)p->p_addr;
- for(i = uarea;i < uarea + USPACE;i += PAGE_SIZE) {
+ for (i = uarea;i < uarea + USPACE;i += PAGE_SIZE) {
j = (u_int *)kvtopte(i);
if ((*j & PG_V) == 0) {
rv = vm_fault(kernel_map, i,