update for new alpha_cpu.h definitions, -Wall cleanups, and make

things compile with the new work-in-progress pmap code.
This commit is contained in:
cgd 1996-07-11 03:53:23 +00:00
parent 192e4b94c0
commit 3e323f7a08
7 changed files with 138 additions and 107 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: genassym.c,v 1.5 1996/07/09 00:53:51 cgd Exp $ */
/* $NetBSD: genassym.c,v 1.6 1996/07/11 03:53:23 cgd Exp $ */
/*
* Copyright (c) 1982, 1990, 1993
@ -111,11 +111,11 @@ main(argc, argv)
def("FRAME_T12", FRAME_T12);
def("FRAME_AT", FRAME_AT);
def("FRAME_SP", FRAME_SP);
off("TF_PS", struct trapframe, tf_ps);
off("TF_PC", struct trapframe, tf_ps);
off("TF_A0", struct trapframe, tf_a0);
off("TF_A1", struct trapframe, tf_a1);
off("TF_A2", struct trapframe, tf_a2);
off("TF_AF_PS", struct trapframe, tf_af.af_ps);
off("TF_AF_PC", struct trapframe, tf_af.af_pc);
off("TF_AF_A0", struct trapframe, tf_af.af_a0);
off("TF_AF_A1", struct trapframe, tf_af.af_a1);
off("TF_AF_A2", struct trapframe, tf_af.af_a2);
/* bits of the PS register */
def("ALPHA_PSL_USERMODE", ALPHA_PSL_USERMODE);
@ -140,14 +140,16 @@ main(argc, argv)
off("PH_LINK", struct prochd, ph_link);
off("PH_RLINK", struct prochd, ph_rlink);
#ifdef OLD_PMAP
/* offsets needed by cpu_switch(), et al., to switch mappings. */
off("VM_PMAP_STPTE", struct vmspace, vm_pmap.pm_stpte);
def("USTP_OFFSET", kvtol1pte(VM_MIN_ADDRESS) * sizeof(pt_entry_t));
#endif /* OLD_PMAP */
/* Important offsets into the user struct & associated constants */
def("UPAGES", UPAGES);
off("U_PCB", struct user, u_pcb);
off("U_PCB_KSP", struct user, u_pcb.pcb_ksp);
off("U_PCB_HW_KSP", struct user, u_pcb.pcb_hw.apcb_ksp);
off("U_PCB_CONTEXT", struct user, u_pcb.pcb_context[0]);
off("U_PCB_ONFAULT", struct user, u_pcb.pcb_onfault);

View File

@ -1,4 +1,4 @@
/* $NetBSD: interrupt.c,v 1.6 1996/07/09 00:53:53 cgd Exp $ */
/* $NetBSD: interrupt.c,v 1.7 1996/07/11 03:53:25 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -130,7 +130,7 @@ machine_check(framep, logoutp, vec)
if (!mc_expected)
panic("machine check: vec 0x%lx, pc = 0x%lx, ra = 0x%lx",
vec, framep->tf_pc, framep->tf_regs[FRAME_RA]);
vec, framep->tf_af.af_pc, framep->tf_regs[FRAME_RA]);
mc_expected = 0;
mc_received = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.s,v 1.16 1996/07/09 04:18:13 cgd Exp $ */
/* $NetBSD: locore.s,v 1.17 1996/07/11 03:53:26 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -186,7 +186,7 @@ LEAF(rei, 1) /* XXX should be NESTED */
br pv, 1f
1: SETGP(pv)
ldq s1, TF_PS(sp) /* get the saved PS */
ldq s1, TF_AF_PS(sp) /* get the saved PS */
and s1, ALPHA_PSL_IPL_MASK, t0 /* look at the saved IPL */
bne t0, Lrestoreregs /* != 0: can't do AST or SIR */
@ -366,7 +366,7 @@ LEAF(XentIF, 1) /* XXX should be NESTED */
or s0, T_IFLT, a0 /* type = T_IFLT|type*/
mov s0, a1 /* code = type */
ldq a2, TF_PC(sp) /* v = frame's pc */
ldq a2, TF_AF_PC(sp) /* v = frame's pc */
mov sp, a3 /* frame */
CALL(trap)
@ -505,9 +505,9 @@ LEAF(XentSys, 0) /* XXX should be NESTED */
stq s4,(FRAME_S4*8)(sp)
stq s5,(FRAME_S5*8)(sp)
stq s6,(FRAME_S6*8)(sp)
stq a0,TF_A0(sp)
stq a1,TF_A1(sp)
stq a2,TF_A2(sp)
stq a0,TF_AF_A0(sp)
stq a1,TF_AF_A1(sp)
stq a2,TF_AF_A2(sp)
stq a3,(FRAME_A3*8)(sp)
stq a4,(FRAME_A4*8)(sp)
stq a5,(FRAME_A5*8)(sp)
@ -720,7 +720,7 @@ LEAF(restorefpstate, 1)
LEAF(savectx, 1)
br pv, 1f
1: SETGP(pv)
stq sp, U_PCB_KSP(a0) /* store sp */
stq sp, U_PCB_HW_KSP(a0) /* store sp */
stq s0, U_PCB_CONTEXT+(0 * 8)(a0) /* store s0 - s6 */
stq s1, U_PCB_CONTEXT+(1 * 8)(a0)
stq s2, U_PCB_CONTEXT+(2 * 8)(a0)
@ -841,6 +841,7 @@ sw1:
ldq t5, P_MD_PCBPADDR(t4) /* t5 = p->p_md.md_pcbpaddr */
stq t5, curpcb /* and store it in curpcb */
#ifdef OLD_PMAP
/*
* Do the context swap, and invalidate old TLB entries (XXX).
* XXX should do the ASN thing, and therefore not have to invalidate.
@ -849,10 +850,13 @@ sw1:
ldq t2, VM_PMAP_STPTE(t2) /* = p_vmspace.vm_pmap.pm_ste */
ldq t3, Lev1map /* and store pte into Lev1map */
stq t2, USTP_OFFSET(t3)
#endif /* OLD_PMAP */
mov t5, a0 /* swap the context */
call_pal PAL_OSF1_swpctx
#ifdef OLD_PMAP
CONST(-1, a0) /* & invalidate old TLB ents */
call_pal PAL_OSF1_tbi
#endif /* OLD_PMAP */
/*
* Now running on the new u struct.
@ -914,14 +918,18 @@ LEAF(switch_exit, 1)
* Do the context swap, and invalidate old TLB entries (XXX).
* XXX should do the ASN thing, and therefore not have to invalidate.
*/
#ifdef OLD_PMAP
ldq t2, P_VMSPACE(t4) /* t2 = p->p_vmspace */
ldq t2, VM_PMAP_STPTE(t2) /* = p_vmspace.vm_pmap.pm_ste */
ldq t3, Lev1map /* and store pte into Lev1map */
stq t2, USTP_OFFSET(t3)
#endif /* OLD_PMAP */
mov t5, a0 /* swap the context */
call_pal PAL_OSF1_swpctx
#ifdef OLD_PMAP
CONST(-1, a0) /* & invalidate old TLB ents */
call_pal PAL_OSF1_tbi
#endif /* OLD_PMAP */
/*
* Now running as proc0, except for the value of 'curproc' and
@ -1623,3 +1631,23 @@ EXPORT(eintrcnt)
.text
/**************************************************************************/
/*
* Object:
* swpctxt EXPORTED function
*
* Change HW process context
*
* Arguments:
* pcb PHYSICAL struct pcb_hw *
* old_ksp VIRTUAL long *
*
* If old_ksp is non-zero it saves the current KSP in it.
* Execute the PAL call.
*/
LEAF(swpctxt,2)
beq a1,1f
stq sp,0(a1)
1: call_pal PAL_OSF1_swpctx
RET
END(swpctxt)

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.32 1996/07/09 00:54:00 cgd Exp $ */
/* $NetBSD: machdep.c,v 1.33 1996/07/11 03:53:29 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -92,7 +92,11 @@
#include <alpha/alpha/dec_21000.h>
#endif
#include <net/if.h>
#include <net/netisr.h>
#include <netinet/in.h>
#include <netinet/ip_var.h>
#include <netinet/if_arp.h>
#include "ether.h"
#include "le_ioasic.h" /* for le_iomem creation */
@ -184,6 +188,8 @@ char boot_flags[64];
/* for cpu_sysctl() */
char root_device[17];
void identifycpu();
int
alpha_init(pfn, ptb)
u_long pfn; /* first free PFN number */
@ -253,13 +259,13 @@ alpha_init(pfn, ptb)
#define cnt mddtp->mddt_cluster_cnt
#define usage(n) mddtp->mddt_clusters[(n)].mddt_usage
if (cnt != 2 && cnt != 3) {
printf("WARNING: weird number (%d) of mem clusters\n", cnt);
printf("WARNING: weird number (%ld) of mem clusters\n", cnt);
mddtweird = 1;
} else if (usage(0) != MDDT_PALCODE ||
usage(1) != MDDT_SYSTEM ||
(cnt == 3 && usage(2) != MDDT_PALCODE)) {
mddtweird = 1;
printf("WARNING: %d mem clusters, but weird config\n", cnt);
printf("WARNING: %ld mem clusters, but weird config\n", cnt);
}
for (i = 0; i < cnt; i++) {
@ -545,9 +551,9 @@ alpha_init(pfn, ptb)
* Set the kernel sp, reserving space for an (empty) trapframe,
* and make proc0's trapframe pointer point to it for sanity.
*/
proc0paddr->u_pcb.pcb_ksp =
proc0paddr->u_pcb.pcb_hw.apcb_ksp =
(u_int64_t)proc0paddr + USPACE - sizeof(struct trapframe);
proc0.p_md.md_tf = (struct trapframe *)proc0paddr->u_pcb.pcb_ksp;
proc0.p_md.md_tf = (struct trapframe *)proc0paddr->u_pcb.pcb_hw.apcb_ksp;
/*
* Look at arguments passed to us and compute boothowto.
@ -615,11 +621,10 @@ void
cpu_startup()
{
register unsigned i;
register caddr_t v;
int base, residual;
vm_offset_t minaddr, maxaddr;
vm_size_t size;
#ifdef DEBUG
#if defined(DEBUG) && defined(OLD_PMAP)
extern int pmapdebug;
int opmapdebug = pmapdebug;
@ -699,7 +704,7 @@ cpu_startup()
callout[i-1].c_next = &callout[i];
callout[i-1].c_next = NULL;
#ifdef DEBUG
#if defined(DEBUG) && defined(OLD_PMAP)
pmapdebug = opmapdebug;
#endif
printf("avail mem = %ld\n", (long)ptoa(cnt.v_free_count));
@ -717,15 +722,16 @@ cpu_startup()
configure();
}
void
identifycpu()
{
/*
* print out CPU identification information.
*/
printf("%s, %dMHz\n", cpu_model,
printf("%s, %ldMHz\n", cpu_model,
hwrpb->rpb_cc_freq / 1000000); /* XXX true for 21164? */
printf("%d byte page size, %d processor%s.\n",
printf("%ld byte page size, %d processor%s.\n",
hwrpb->rpb_page_size, ncpus, ncpus == 1 ? "" : "s");
#if 0
/* this isn't defined for any systems that we run on? */
@ -852,7 +858,7 @@ dumpsys()
if (dumpsize == 0)
return;
}
printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo);
printf("\ndumping to dev %x, offset %ld\n", dumpdev, dumplo);
printf("dump ");
switch ((*bdevsw[major(dumpdev)].d_dump)(dumpdev)) {
@ -907,9 +913,9 @@ frametoreg(framep, regp)
regp->r_regs[R_S4] = framep->tf_regs[FRAME_S4];
regp->r_regs[R_S5] = framep->tf_regs[FRAME_S5];
regp->r_regs[R_S6] = framep->tf_regs[FRAME_S6];
regp->r_regs[R_A0] = framep->tf_a0;
regp->r_regs[R_A1] = framep->tf_a1;
regp->r_regs[R_A2] = framep->tf_a2;
regp->r_regs[R_A0] = framep->tf_af.af_a0;
regp->r_regs[R_A1] = framep->tf_af.af_a1;
regp->r_regs[R_A2] = framep->tf_af.af_a2;
regp->r_regs[R_A3] = framep->tf_regs[FRAME_A3];
regp->r_regs[R_A4] = framep->tf_regs[FRAME_A4];
regp->r_regs[R_A5] = framep->tf_regs[FRAME_A5];
@ -920,7 +926,7 @@ frametoreg(framep, regp)
regp->r_regs[R_RA] = framep->tf_regs[FRAME_RA];
regp->r_regs[R_T12] = framep->tf_regs[FRAME_T12];
regp->r_regs[R_AT] = framep->tf_regs[FRAME_AT];
regp->r_regs[R_GP] = framep->tf_gp;
regp->r_regs[R_GP] = framep->tf_af.af_gp;
regp->r_regs[R_SP] = framep->tf_regs[FRAME_SP];
regp->r_regs[R_ZERO] = 0;
}
@ -947,9 +953,9 @@ regtoframe(regp, framep)
framep->tf_regs[FRAME_S4] = regp->r_regs[R_S4];
framep->tf_regs[FRAME_S5] = regp->r_regs[R_S5];
framep->tf_regs[FRAME_S6] = regp->r_regs[R_S6];
framep->tf_a0 = regp->r_regs[R_A0];
framep->tf_a1 = regp->r_regs[R_A1];
framep->tf_a2 = regp->r_regs[R_A2];
framep->tf_af.af_a0 = regp->r_regs[R_A0];
framep->tf_af.af_a1 = regp->r_regs[R_A1];
framep->tf_af.af_a2 = regp->r_regs[R_A2];
framep->tf_regs[FRAME_A3] = regp->r_regs[R_A3];
framep->tf_regs[FRAME_A4] = regp->r_regs[R_A4];
framep->tf_regs[FRAME_A5] = regp->r_regs[R_A5];
@ -960,7 +966,7 @@ regtoframe(regp, framep)
framep->tf_regs[FRAME_RA] = regp->r_regs[R_RA];
framep->tf_regs[FRAME_T12] = regp->r_regs[R_T12];
framep->tf_regs[FRAME_AT] = regp->r_regs[R_AT];
framep->tf_gp = regp->r_regs[R_GP];
framep->tf_af.af_gp = regp->r_regs[R_GP];
framep->tf_regs[FRAME_SP] = regp->r_regs[R_SP];
/* ??? = regp->r_regs[R_ZERO]; */
}
@ -1034,7 +1040,7 @@ sendsig(catcher, sig, mask, code)
(void)grow(p, (u_long)scp);
#ifdef DEBUG
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
printf("sendsig(%d): sig %d ssp %lx usp %lx\n", p->p_pid,
printf("sendsig(%d): sig %d ssp %p usp %p\n", p->p_pid,
sig, &oonstack, scp);
#endif
if (useracc((caddr_t)scp, fsize, B_WRITE) == 0) {
@ -1061,8 +1067,8 @@ sendsig(catcher, sig, mask, code)
*/
ksc.sc_onstack = oonstack;
ksc.sc_mask = mask;
ksc.sc_pc = frame->tf_pc;
ksc.sc_ps = frame->tf_ps;
ksc.sc_pc = frame->tf_af.af_pc;
ksc.sc_ps = frame->tf_af.af_ps;
/* copy the registers. */
frametoreg(frame, (struct reg *)ksc.sc_regs);
@ -1095,24 +1101,24 @@ sendsig(catcher, sig, mask, code)
(void) copyout((caddr_t)&ksc, (caddr_t)scp, fsize);
#ifdef DEBUG
if (sigdebug & SDB_FOLLOW)
printf("sendsig(%d): sig %d scp %lx code %lx\n", p->p_pid, sig,
printf("sendsig(%d): sig %d scp %p code %lx\n", p->p_pid, sig,
scp, code);
#endif
/*
* Set up the registers to return to sigcode.
*/
frame->tf_pc = (u_int64_t)PS_STRINGS - (esigcode - sigcode);
frame->tf_af.af_pc = (u_int64_t)PS_STRINGS - (esigcode - sigcode);
frame->tf_regs[FRAME_SP] = (u_int64_t)scp;
frame->tf_a0 = sig;
frame->tf_a1 = code;
frame->tf_a2 = (u_int64_t)scp;
frame->tf_af.af_a0 = sig;
frame->tf_af.af_a1 = code;
frame->tf_af.af_a2 = (u_int64_t)scp;
frame->tf_regs[FRAME_T12] = (u_int64_t)catcher; /* t12 is pv */
#ifdef DEBUG
if (sigdebug & SDB_FOLLOW)
printf("sendsig(%d): pc %lx, catcher %lx\n", p->p_pid,
frame->tf_pc, frame->tf_regs[FRAME_A3]);
frame->tf_af.af_pc, frame->tf_regs[FRAME_A3]);
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
printf("sendsig(%d): sig %d returns\n",
p->p_pid, sig);
@ -1145,7 +1151,7 @@ sys_sigreturn(p, v, retval)
scp = SCARG(uap, sigcntxp);
#ifdef DEBUG
if (sigdebug & SDB_FOLLOW)
printf("sigreturn: pid %d, scp %lx\n", p->p_pid, scp);
printf("sigreturn: pid %d, scp %p\n", p->p_pid, scp);
#endif
if (ALIGN(scp) != (u_int64_t)scp)
@ -1170,8 +1176,8 @@ sys_sigreturn(p, v, retval)
p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK;
p->p_sigmask = ksc.sc_mask &~ sigcantmask;
p->p_md.md_tf->tf_pc = ksc.sc_pc;
p->p_md.md_tf->tf_ps =
p->p_md.md_tf->tf_af.af_pc = ksc.sc_pc;
p->p_md.md_tf->tf_af.af_ps =
(ksc.sc_ps | ALPHA_PSL_USERSET) & ~ALPHA_PSL_USERCLR;
regtoframe((struct reg *)ksc.sc_regs, p->p_md.md_tf);
@ -1193,6 +1199,7 @@ sys_sigreturn(p, v, retval)
/*
* machine dependent system variables.
*/
int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
@ -1243,25 +1250,25 @@ setregs(p, pack, stack, retval)
#ifdef DEBUG
for (i = 0; i < FRAME_NSAVEREGS; i++)
tfp->tf_regs[i] = 0xbabefacedeadbeef;
tfp->tf_gp = 0xbabefacedeadbeef;
tfp->tf_a0 = 0xbabefacedeadbeef;
tfp->tf_a1 = 0xbabefacedeadbeef;
tfp->tf_a2 = 0xbabefacedeadbeef;
tfp->tf_af.af_gp = 0xbabefacedeadbeef;
tfp->tf_af.af_a0 = 0xbabefacedeadbeef;
tfp->tf_af.af_a1 = 0xbabefacedeadbeef;
tfp->tf_af.af_a2 = 0xbabefacedeadbeef;
#else
bzero(tfp->tf_regs, FRAME_NSAVEREGS * sizeof tfp->tf_regs[0]);
tfp->tf_gp = 0;
tfp->tf_a0 = 0;
tfp->tf_a1 = 0;
tfp->tf_a2 = 0;
tfp->tf_af.af_gp = 0;
tfp->tf_af.af_a0 = 0;
tfp->tf_af.af_a1 = 0;
tfp->tf_af.af_a2 = 0;
#endif
bzero(&p->p_addr->u_pcb.pcb_fp, sizeof p->p_addr->u_pcb.pcb_fp);
#define FP_RN 2 /* XXX */
p->p_addr->u_pcb.pcb_fp.fpr_cr = (long)FP_RN << 58;
tfp->tf_regs[FRAME_SP] = stack; /* restored to usp in trap return */
tfp->tf_ps = ALPHA_PSL_USERSET;
tfp->tf_pc = pack->ep_entry & ~3;
tfp->tf_af.af_ps = ALPHA_PSL_USERSET;
tfp->tf_af.af_pc = pack->ep_entry & ~3;
p->p_md.md_flags & ~MDP_FPUSED;
p->p_md.md_flags &= ~MDP_FPUSED;
if (fpcurproc == p)
fpcurproc = NULL;
@ -1448,7 +1455,7 @@ cpu_exec_ecoff_setregs(p, epp, stack, retval)
struct ecoff_exechdr *execp = (struct ecoff_exechdr *)epp->ep_hdr;
setregs(p, epp, stack, retval);
p->p_md.md_tf->tf_gp = execp->a.gp_value;
p->p_md.md_tf->tf_af.af_gp = execp->a.gp_value;
}
/*
@ -1486,24 +1493,3 @@ cpu_exec_ecoff_hook(p, epp)
return 0;
}
#endif
vm_offset_t
vtophys(vaddr)
vm_offset_t vaddr;
{
vm_offset_t paddr;
if (vaddr < ALPHA_K0SEG_BASE) {
printf("vtophys: invalid vaddr 0x%lx", vaddr);
paddr = vaddr;
} else if (vaddr <= ALPHA_K0SEG_END)
paddr = ALPHA_K0SEG_TO_PHYS(vaddr);
else
paddr = vatopa(vaddr);
#if 0
printf("vtophys(0x%lx) -> %lx\n", vaddr, paddr);
#endif
return (paddr);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: process_machdep.c,v 1.4 1996/07/09 00:54:10 cgd Exp $ */
/* $NetBSD: process_machdep.c,v 1.5 1996/07/11 03:53:31 cgd Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
@ -72,7 +72,7 @@ process_read_regs(p, regs)
{
frametoreg(process_frame(p), regs);
regs->r_regs[R_ZERO] = process_frame(p)->tf_pc;
regs->r_regs[R_ZERO] = process_frame(p)->tf_af.af_pc;
return (0);
}
@ -82,7 +82,7 @@ process_write_regs(p, regs)
struct reg *regs;
{
process_frame(p)->tf_pc = regs->r_regs[R_ZERO];
process_frame(p)->tf_af.af_pc = regs->r_regs[R_ZERO];
regtoframe(regs, process_frame(p));
return (0);
}
@ -106,7 +106,7 @@ process_set_pc(p, addr)
{
struct trapframe *frame = process_frame(p);
frame->tf_pc = (u_int64_t)addr;
frame->tf_af.af_pc = (u_int64_t)addr;
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.6 1996/07/09 00:54:15 cgd Exp $ */
/* $NetBSD: trap.c,v 1.7 1996/07/11 03:53:33 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -113,7 +113,7 @@ trap(type, code, v, framep)
cnt.v_trap++;
p = curproc;
ucode = 0;
if ((framep->tf_ps & ALPHA_PSL_USERMODE) != 0) {
if ((framep->tf_af.af_ps & ALPHA_PSL_USERMODE) != 0) {
type |= T_USER;
sticks = p->p_sticks;
p->p_md.md_tf = framep;
@ -130,7 +130,7 @@ trap(type, code, v, framep)
dopanic:
printf("trap type %ld, code = 0x%lx, v = 0x%lx\n", type,
code, v);
printf("pc = 0x%lx\n", framep->tf_pc);
printf("pc = 0x%lx\n", framep->tf_af.af_pc);
printf("curproc = 0x%lx\n", curproc);
if (curproc != NULL)
printf("curproc->p_pid = 0x%d\n", curproc->p_pid);
@ -164,7 +164,7 @@ dopanic:
if (p == NULL || p->p_addr->u_pcb.pcb_onfault == NULL)
goto dopanic;
else {
framep->tf_pc = (u_int64_t)p->p_addr->u_pcb.pcb_onfault;
framep->tf_af.af_pc = (u_int64_t)p->p_addr->u_pcb.pcb_onfault;
p->p_addr->u_pcb.pcb_onfault = NULL;
}
goto out;
@ -198,7 +198,7 @@ sigfpe: i = SIGFPE;
goto out;
case T_GENTRAP|T_USER:
if (framep->tf_a0 == -2) /* weird! */
if (framep->tf_af.af_a0 == -2) /* weird! */
goto sigfpe;
case T_BPT|T_USER:
case T_BUGCHK|T_USER:
@ -227,7 +227,7 @@ sigfpe: i = SIGFPE;
/* if it was caused by fuswintr or suswintr, just punt. */
if ((type & T_USER) == 0 && p != NULL &&
p->p_addr->u_pcb.pcb_onfault == (caddr_t)fswintrberr) {
framep->tf_pc = (u_int64_t)p->p_addr->u_pcb.pcb_onfault;
framep->tf_af.af_pc = (u_int64_t)p->p_addr->u_pcb.pcb_onfault;
p->p_addr->u_pcb.pcb_onfault = NULL;
goto out;
}
@ -263,7 +263,7 @@ sigfpe: i = SIGFPE;
#ifdef VMFAULT_TRACE
printf("vm_fault(0x%lx (pmap 0x%lx), 0x%lx (0x%lx), 0x%lx, %d) -> 0x%lx at pc 0x%lx\n",
map, map == kernel_map ? pmap_kernel() : &vm->vm_pmap,
va, v, ftype, FALSE, rv, framep->tf_pc);
va, v, ftype, FALSE, rv, framep->tf_af.af_pc);
#endif
/*
* If this was a stack access we keep track of the maximum
@ -284,10 +284,10 @@ sigfpe: i = SIGFPE;
}
if (rv == KERN_SUCCESS)
goto out;
if ((framep->tf_ps & ALPHA_PSL_USERMODE) == 0) {
if ((framep->tf_af.af_ps & ALPHA_PSL_USERMODE) == 0) {
if (p != NULL &&
p->p_addr->u_pcb.pcb_onfault != NULL) {
framep->tf_pc =
framep->tf_af.af_pc =
(u_int64_t)p->p_addr->u_pcb.pcb_onfault;
p->p_addr->u_pcb.pcb_onfault = NULL;
goto out;
@ -316,7 +316,7 @@ sigfpe: i = SIGFPE;
out:
if ((type & T_USER) == 0)
return;
userret(p, framep->tf_pc, sticks);
userret(p, framep->tf_af.af_pc, sticks);
}
/*
@ -350,13 +350,13 @@ syscall(code, framep)
#endif
#if notdef /* can't happen, ever. */
if ((framep->tf_ps & ALPHA_PSL_USERMODE) == 0) {
if ((framep->tf_af.af_ps & ALPHA_PSL_USERMODE) == 0) {
panic("syscall");
#endif
cnt.v_syscall++;
p = curproc;
p->p_md.md_tf = framep;
opc = framep->tf_pc - 4;
opc = framep->tf_af.af_pc - 4;
sticks = p->p_sticks;
callp = p->p_emul->e_sysent;
@ -368,7 +368,7 @@ syscall(code, framep)
switch (code) {
case OSF1_SYS_syscall:
/* OSF/1 syscall() */
code = framep->tf_a0;
code = framep->tf_af.af_a0;
hidden = 1;
break;
default:
@ -383,7 +383,7 @@ syscall(code, framep)
* syscall() and __syscall() are handled the same on
* the alpha, as everything is 64-bit aligned, anyway.
*/
code = framep->tf_a0;
code = framep->tf_af.af_a0;
hidden = 1;
break;
default:
@ -410,11 +410,11 @@ syscall(code, framep)
case 4:
args[3] = framep->tf_regs[FRAME_A3];
case 3:
args[2] = framep->tf_a2;
args[2] = framep->tf_af.af_a2;
case 2:
args[1] = framep->tf_a1;
args[1] = framep->tf_af.af_a1;
case 1:
args[0] = framep->tf_a0;
args[0] = framep->tf_af.af_a0;
case 0:
break;
}
@ -438,7 +438,7 @@ syscall(code, framep)
framep->tf_regs[FRAME_A3] = 0;
break;
case ERESTART:
framep->tf_pc = opc;
framep->tf_af.af_pc = opc;
break;
case EJUSTRETURN:
break;
@ -457,7 +457,7 @@ syscall(code, framep)
scdebug_ret(p, code, error, rval);
#endif
userret(p, framep->tf_pc, sticks);
userret(p, framep->tf_af.af_pc, sticks);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p->p_tracep, code, error, rval[0]);
@ -476,7 +476,7 @@ child_return(p)
* Return values in the frame set by cpu_fork().
*/
userret(p, p->p_md.md_tf->tf_pc, 0);
userret(p, p->p_md.md_tf->tf_af.af_pc, 0);
#ifdef KTRACE
if (KTRPOINT(p, KTR_SYSRET))
ktrsysret(p->p_tracep, SYS_fork, 0, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.10 1996/07/09 00:54:17 cgd Exp $ */
/* $NetBSD: vm_machdep.c,v 1.11 1996/07/11 03:53:34 cgd Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -147,9 +147,13 @@ cpu_fork(p1, p2)
* Cache the physical address of the pcb, so we can
* swap to it easily.
*/
#ifdef OLD_PMAP
ptep = kvtopte(up);
p2->p_md.md_pcbpaddr =
&((struct user *)(PG_PFNUM(*ptep) << PGSHIFT))->u_pcb;
#else
p2->p_md.md_pcbpaddr = (void *)vtophys((vm_offset_t)&up->u_pcb);
#endif
/*
* Simulate a write to the process's U-area pages,
@ -177,7 +181,9 @@ cpu_fork(p1, p2)
* part of the stack. The stack and pcb need to agree;
*/
p2->p_addr->u_pcb = p1->p_addr->u_pcb;
#ifdef OLD_PMAP
PMAP_ACTIVATE(&p2->p_vmspace->vm_pmap, 0);
#endif
/*
* Arrange for a non-local goto when the new process
@ -186,7 +192,7 @@ cpu_fork(p1, p2)
#ifdef DIAGNOSTIC
if (p1 != curproc)
panic("cpu_fork: curproc");
if (up->u_pcb.pcb_fen != 0)
if ((up->u_pcb.pcb_hw.apcb_flags & ALPHA_PCB_FLAGS_FEN) != 0)
printf("DANGER WILL ROBINSON: FEN SET IN cpu_fork!\n");
#endif
@ -221,7 +227,7 @@ cpu_fork(p1, p2)
*
* This is an inlined version of cpu_set_kpc.
*/
up->u_pcb.pcb_ksp = (u_int64_t)p2tf;
up->u_pcb.pcb_hw.apcb_ksp = (u_int64_t)p2tf;
up->u_pcb.pcb_context[0] =
(u_int64_t)child_return; /* s0: pc */
up->u_pcb.pcb_context[1] =
@ -276,9 +282,13 @@ cpu_swapin(p)
* Cache the physical address of the pcb, so we can swap to
* it easily.
*/
#ifdef OLD_PMAP
ptep = kvtopte(up);
p->p_md.md_pcbpaddr =
&((struct user *)(PG_PFNUM(*ptep) << PGSHIFT))->u_pcb;
#else
p->p_md.md_pcbpaddr = (void *)vtophys((vm_offset_t)&up->u_pcb);
#endif
/*
* Simulate a write to the process's U-area pages,
@ -328,8 +338,13 @@ pagemove(from, to, size)
if (size % CLBYTES)
panic("pagemove");
#ifdef OLD_PMAP
fpte = kvtopte(from);
tpte = kvtopte(to);
#else
fpte = pmap_pte(kernel_pmap, (vm_offset_t)from);
tpte = pmap_pte(kernel_pmap, (vm_offset_t)to);
#endif
todo = size; /* if testing > 0, need sign... */
while (todo > 0) {
TBIS((vm_offset_t)from);