Module Name: src Committed By: matt Date: Fri Jan 7 02:01:57 UTC 2011
Modified Files: src/sys/arch/powerpc/powerpc [matt-nb5-pq3]: compat_13_machdep.c compat_16_machdep.c sig_machdep.c Log Message: Adapt to new trapframe. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.14.20.1 \ src/sys/arch/powerpc/powerpc/compat_13_machdep.c cvs rdiff -u -r1.11 -r1.11.20.1 \ src/sys/arch/powerpc/powerpc/compat_16_machdep.c cvs rdiff -u -r1.32 -r1.32.20.1 src/sys/arch/powerpc/powerpc/sig_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/powerpc/powerpc/compat_13_machdep.c diff -u src/sys/arch/powerpc/powerpc/compat_13_machdep.c:1.14 src/sys/arch/powerpc/powerpc/compat_13_machdep.c:1.14.20.1 --- src/sys/arch/powerpc/powerpc/compat_13_machdep.c:1.14 Thu Apr 24 18:39:21 2008 +++ src/sys/arch/powerpc/powerpc/compat_13_machdep.c Fri Jan 7 02:01:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_13_machdep.c,v 1.14 2008/04/24 18:39:21 ad Exp $ */ +/* $NetBSD: compat_13_machdep.c,v 1.14.20.1 2011/01/07 02:01:57 matt Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.14 2008/04/24 18:39:21 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.14.20.1 2011/01/07 02:01:57 matt Exp $"); #include "opt_ppcarch.h" @@ -74,16 +74,16 @@ return (EINVAL); /* Restore register context. */ - memcpy(tf->fixreg, sc.sc_frame.fixreg, sizeof(tf->fixreg)); - tf->lr = sc.sc_frame.lr; - tf->cr = sc.sc_frame.cr; - tf->xer = sc.sc_frame.xer; - tf->ctr = sc.sc_frame.ctr; - tf->srr0 = sc.sc_frame.srr0; - tf->srr1 = sc.sc_frame.srr1; + memcpy(tf->tf_fixreg, sc.sc_frame.fixreg, sizeof(tf->tf_fixreg)); + tf->tf_lr = sc.sc_frame.lr; + tf->tf_cr = sc.sc_frame.cr; + tf->tf_xer = sc.sc_frame.xer; + tf->tf_ctr = sc.sc_frame.ctr; + tf->tf_srr0 = sc.sc_frame.srr0; + tf->tf_srr1 = sc.sc_frame.srr1; #ifdef PPC_OEA - tf->tf_xtra[TF_VRSAVE] = sc.sc_frame.vrsave; - tf->tf_xtra[TF_MQ] = sc.sc_frame.mq; + tf->tf_vrsave = sc.sc_frame.vrsave; + tf->tf_mq = sc.sc_frame.mq; #endif mutex_enter(p->p_lock); Index: src/sys/arch/powerpc/powerpc/compat_16_machdep.c diff -u src/sys/arch/powerpc/powerpc/compat_16_machdep.c:1.11 src/sys/arch/powerpc/powerpc/compat_16_machdep.c:1.11.20.1 --- src/sys/arch/powerpc/powerpc/compat_16_machdep.c:1.11 Thu Apr 24 18:39:21 2008 +++ src/sys/arch/powerpc/powerpc/compat_16_machdep.c Fri Jan 7 02:01:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_16_machdep.c,v 1.11 2008/04/24 18:39:21 ad Exp $ */ +/* $NetBSD: compat_16_machdep.c,v 1.11.20.1 2011/01/07 02:01:57 matt Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.11 2008/04/24 18:39:21 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.11.20.1 2011/01/07 02:01:57 matt Exp $"); #include "opt_compat_netbsd.h" #include "opt_altivec.h" @@ -78,17 +78,18 @@ fp = (struct sigcontext *)((char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size); else - fp = (struct sigcontext *)tf->fixreg[1]; + fp = (struct sigcontext *)tf->tf_fixreg[1]; fp = (struct sigcontext *)((uintptr_t)(fp - 1) & ~0xf); /* Save register context. */ - memcpy(utf->fixreg, tf->fixreg, sizeof(utf->fixreg)); - utf->lr = tf->lr; - utf->cr = tf->cr; - utf->xer = tf->xer; - utf->ctr = tf->ctr; - utf->srr0 = tf->srr0; - utf->srr1 = tf->srr1 & PSL_USERSRR1; + memcpy(utf->fixreg, tf->tf_fixreg, sizeof(utf->fixreg)); + utf->lr = tf->tf_lr; + utf->cr = tf->tf_cr; + utf->xer = tf->tf_xer; + utf->ctr = tf->tf_ctr; + utf->srr0 = tf->tf_srr0; + utf->srr1 = tf->tf_srr1 & PSL_USERSRR1; + #ifdef PPC_HAVE_FPU utf->srr1 |= l->l_addr->u_pcb.pcb_flags & (PCB_FE0|PCB_FE1); #endif @@ -96,8 +97,8 @@ utf->srr1 |= l->l_addr->u_pcb.pcb_flags & PCB_ALTIVEC ? PSL_VEC : 0; #endif #ifdef PPC_OEA - utf->vrsave = tf->tf_xtra[TF_VRSAVE]; - utf->mq = tf->tf_xtra[TF_MQ]; + utf->vrsave = tf->tf_vrsave; + utf->mq = tf->tf_mq; #endif /* Save signal stack. */ @@ -136,22 +137,22 @@ switch (ps->sa_sigdesc[sig].sd_vers) { #if 1 /* COMPAT_16 */ case 0: /* legacy on-stack sigtramp */ - tf->fixreg[1] = (register_t)fp; - tf->lr = (register_t)catcher; - tf->fixreg[3] = (register_t)sig; - tf->fixreg[4] = (register_t)code; - tf->fixreg[5] = (register_t)fp; - tf->srr0 = (register_t)p->p_sigctx.ps_sigcode; + tf->tf_fixreg[1] = (register_t)fp; + tf->tf_lr = (register_t)catcher; + tf->tf_fixreg[3] = (register_t)sig; + tf->tf_fixreg[4] = (register_t)code; + tf->tf_fixreg[5] = (register_t)fp; + tf->tf_srr0 = (register_t)p->p_sigctx.ps_sigcode; break; #endif /* COMPAT_16 */ case 1: - tf->fixreg[1] = (register_t)fp; - tf->lr = (register_t)catcher; - tf->fixreg[3] = (register_t)sig; - tf->fixreg[4] = (register_t)code; - tf->fixreg[5] = (register_t)fp; - tf->srr0 = (register_t)ps->sa_sigdesc[sig].sd_tramp; + tf->tf_fixreg[1] = (register_t)fp; + tf->tf_lr = (register_t)catcher; + tf->tf_fixreg[3] = (register_t)sig; + tf->tf_fixreg[4] = (register_t)code; + tf->tf_fixreg[5] = (register_t)fp; + tf->tf_srr0 = (register_t)ps->sa_sigdesc[sig].sd_tramp; break; default: @@ -197,20 +198,20 @@ return (EINVAL); /* Restore register context. */ - memcpy(tf->fixreg, utf->fixreg, sizeof(tf->fixreg)); - tf->lr = utf->lr; - tf->cr = utf->cr; - tf->xer = utf->xer; - tf->ctr = utf->ctr; - tf->srr0 = utf->srr0; - tf->srr1 = utf->srr1; + memcpy(tf->tf_fixreg, utf->fixreg, sizeof(tf->tf_fixreg)); + tf->tf_lr = utf->lr; + tf->tf_cr = utf->cr; + tf->tf_xer = utf->xer; + tf->tf_ctr = utf->ctr; + tf->tf_srr0 = utf->srr0; + tf->tf_srr1 = utf->srr1; #ifdef PPC_HAVE_FPU l->l_addr->u_pcb.pcb_flags &= ~(PCB_FE0|PCB_FE1); l->l_addr->u_pcb.pcb_flags |= utf->srr1 & (PCB_FE0|PCB_FE1); #endif #ifdef PPC_OEA - tf->tf_xtra[TF_VRSAVE] = utf->vrsave; - tf->tf_xtra[TF_MQ] = utf->mq; + tf->tf_vrsave = utf->vrsave; + tf->tf_mq = utf->mq; #endif mutex_enter(p->p_lock); Index: src/sys/arch/powerpc/powerpc/sig_machdep.c diff -u src/sys/arch/powerpc/powerpc/sig_machdep.c:1.32 src/sys/arch/powerpc/powerpc/sig_machdep.c:1.32.20.1 --- src/sys/arch/powerpc/powerpc/sig_machdep.c:1.32 Thu Apr 24 18:39:21 2008 +++ src/sys/arch/powerpc/powerpc/sig_machdep.c Fri Jan 7 02:01:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: sig_machdep.c,v 1.32 2008/04/24 18:39:21 ad Exp $ */ +/* $NetBSD: sig_machdep.c,v 1.32.20.1 2011/01/07 02:01:57 matt Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.32 2008/04/24 18:39:21 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sig_machdep.c,v 1.32.20.1 2011/01/07 02:01:57 matt Exp $"); #include "opt_compat_netbsd.h" #include "opt_ppcarch.h" @@ -79,7 +79,7 @@ (sd->sd_sigact.sa_flags & SA_ONSTACK) != 0; /* Find top of stack. */ - sp = (onstack ? (vaddr_t)ss->ss_sp + ss->ss_size : tf->fixreg[1]); + sp = (onstack ? (vaddr_t)ss->ss_sp + ss->ss_size : tf->tf_fixreg[1]); sp &= ~(CALLFRAMELEN-1); /* Allocate space for the ucontext. */ @@ -123,14 +123,14 @@ */ switch (sd->sd_vers) { case 2: /* siginfo sigtramp */ - tf->fixreg[1] = (register_t)sp - CALLFRAMELEN; - tf->fixreg[3] = (register_t)ksi->ksi_signo; - tf->fixreg[4] = (register_t)sip; - tf->fixreg[5] = (register_t)ucp; + tf->tf_fixreg[1] = (register_t)sp - CALLFRAMELEN; + tf->tf_fixreg[3] = (register_t)ksi->ksi_signo; + tf->tf_fixreg[4] = (register_t)sip; + tf->tf_fixreg[5] = (register_t)ucp; /* Preserve ucp across call to signal function */ - tf->fixreg[30] = (register_t)ucp; - tf->lr = (register_t)sd->sd_tramp; - tf->srr0 = (register_t)sd->sd_sigact.sa_handler; + tf->tf_fixreg[30] = (register_t)ucp; + tf->tf_lr = (register_t)sd->sd_tramp; + tf->tf_srr0 = (register_t)sd->sd_sigact.sa_handler; break; default: @@ -160,24 +160,25 @@ #endif /* Save GPR context. */ - (void)memcpy(gr, &tf->fixreg, 32 * sizeof (gr[0])); /* GR0-31 */ - gr[_REG_CR] = tf->cr; - gr[_REG_LR] = tf->lr; - gr[_REG_PC] = tf->srr0; - gr[_REG_MSR] = tf->srr1 & PSL_USERSRR1; + (void)memcpy(gr, &tf->tf_fixreg, 32 * sizeof (gr[0])); /* GR0-31 */ + gr[_REG_CR] = tf->tf_cr; + gr[_REG_LR] = tf->tf_lr; + gr[_REG_PC] = tf->tf_srr0; + gr[_REG_MSR] = tf->tf_srr1 & PSL_USERSRR1; #ifdef PPC_HAVE_FPU gr[_REG_MSR] |= pcb->pcb_flags & (PCB_FE0|PCB_FE1); #endif #ifdef ALTIVEC gr[_REG_MSR] |= pcb->pcb_flags & PCB_ALTIVEC ? PSL_VEC : 0; #endif - gr[_REG_CTR] = tf->ctr; - gr[_REG_XER] = tf->xer; + gr[_REG_CTR] = tf->tf_ctr; + gr[_REG_XER] = tf->tf_xer; #ifdef PPC_OEA - gr[_REG_MQ] = tf->tf_xtra[TF_MQ]; + gr[_REG_MQ] = tf->tf_mq; #else gr[_REG_MQ] = 0; #endif + *flagp |= _UC_CPU; #ifdef PPC_HAVE_FPU @@ -234,20 +235,20 @@ pcb->pcb_flags |= gr[_REG_MSR] & (PCB_FE0|PCB_FE1); #endif - (void)memcpy(&tf->fixreg, gr, 32 * sizeof (gr[0])); - tf->cr = gr[_REG_CR]; - tf->lr = gr[_REG_LR]; - tf->srr0 = gr[_REG_PC]; + (void)memcpy(&tf->tf_fixreg, gr, 32 * sizeof (gr[0])); + tf->tf_cr = gr[_REG_CR]; + tf->tf_lr = gr[_REG_LR]; + tf->tf_srr0 = gr[_REG_PC]; /* * Accept all user-settable bits without complaint; * userland should not need to know the machine-specific * MSR value. */ - tf->srr1 = (gr[_REG_MSR] & PSL_USERMOD) | PSL_USERSET; - tf->ctr = gr[_REG_CTR]; - tf->xer = gr[_REG_XER]; + tf->tf_srr1 = (gr[_REG_MSR] & PSL_USERMOD) | PSL_USERSET; + tf->tf_ctr = gr[_REG_CTR]; + tf->tf_xer = gr[_REG_XER]; #ifdef PPC_OEA - tf->tf_xtra[TF_MQ] = gr[_REG_MQ]; + tf->tf_mq = gr[_REG_MQ]; #endif }