Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc Get rid of MDLWP_USED{FPU,VEC}
details: https://anonhg.NetBSD.org/src/rev/88c877b3da20
branches: trunk
changeset: 789577:88c877b3da20
user: matt <matt%NetBSD.org@localhost>
date: Fri Aug 23 06:19:46 2013 +0000
description:
Get rid of MDLWP_USED{FPU,VEC}
diffstat:
sys/arch/powerpc/booke/spe.c | 11 +++++------
sys/arch/powerpc/booke/trap.c | 8 ++++----
sys/arch/powerpc/ibm4xx/trap.c | 8 ++++----
sys/arch/powerpc/include/proc.h | 4 +---
sys/arch/powerpc/oea/altivec.c | 10 +++++-----
sys/arch/powerpc/powerpc/fpu.c | 10 ++++------
6 files changed, 23 insertions(+), 28 deletions(-)
diffs (216 lines):
diff -r 5abbecfe9be1 -r 88c877b3da20 sys/arch/powerpc/booke/spe.c
--- a/sys/arch/powerpc/booke/spe.c Fri Aug 23 06:18:14 2013 +0000
+++ b/sys/arch/powerpc/booke/spe.c Fri Aug 23 06:19:46 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: spe.c,v 1.6 2012/12/26 19:05:04 matt Exp $ */
+/* $NetBSD: spe.c,v 1.7 2013/08/23 06:19:46 matt Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: spe.c,v 1.6 2012/12/26 19:05:04 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spe.c,v 1.7 2013/08/23 06:19:46 matt Exp $");
#include "opt_altivec.h"
@@ -63,13 +63,13 @@
bool
vec_used_p(lwp_t *l)
{
- return (l->l_md.md_flags & MDLWP_USEDVEC) != 0;
+ return pcu_used_p(&vec_ops);
}
void
vec_mark_used(lwp_t *l)
{
- l->l_md.md_flags |= MDLWP_USEDVEC;
+ pcu_discard(&vec_ops, true);
}
void
@@ -103,9 +103,8 @@
__asm volatile ("isync");
/*
- * Note that vector has now been used.
+ * Set PSL_SPV so vectors will be enabled on return to user.
*/
- l->l_md.md_flags |= MDLWP_USEDVEC;
l->l_md.md_utf->tf_srr1 |= PSL_SPV;
}
diff -r 5abbecfe9be1 -r 88c877b3da20 sys/arch/powerpc/booke/trap.c
--- a/sys/arch/powerpc/booke/trap.c Fri Aug 23 06:18:14 2013 +0000
+++ b/sys/arch/powerpc/booke/trap.c Fri Aug 23 06:19:46 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.22 2012/08/02 14:07:47 matt Exp $ */
+/* $NetBSD: trap.c,v 1.23 2013/08/23 06:19:46 matt Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.22 2012/08/02 14:07:47 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.23 2013/08/23 06:19:46 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -480,9 +480,9 @@
if (tf->tf_esr & ESR_PIL) {
struct pcb * const pcb = lwp_getpcb(curlwp);
- if (__predict_false(!(curlwp->l_md.md_flags & MDLWP_USEDFPU))) {
+ if (__predict_false(!fpu_used_p(curlwp))) {
memset(&pcb->pcb_fpu, 0, sizeof(pcb->pcb_fpu));
- curlwp->l_md.md_flags |= MDLWP_USEDFPU;
+ fpu_mark_used(curlwp);
}
if (fpu_emulate(tf, &pcb->pcb_fpu, ksi)) {
if (ksi->ksi_signo == 0) {
diff -r 5abbecfe9be1 -r 88c877b3da20 sys/arch/powerpc/ibm4xx/trap.c
--- a/sys/arch/powerpc/ibm4xx/trap.c Fri Aug 23 06:18:14 2013 +0000
+++ b/sys/arch/powerpc/ibm4xx/trap.c Fri Aug 23 06:19:46 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.65 2012/07/23 04:13:06 matt Exp $ */
+/* $NetBSD: trap.c,v 1.66 2013/08/23 06:19:46 matt Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.65 2012/07/23 04:13:06 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.66 2013/08/23 06:19:46 matt Exp $");
#include "opt_altivec.h"
#include "opt_ddb.h"
@@ -298,9 +298,9 @@
curcpu()->ci_data.cpu_ntrap++;
pcb = lwp_getpcb(l);
- if (!(l->l_md.md_flags & MDLWP_USEDFPU)) {
+ if (__predict_false(!fpu_used_p(l))) {
memset(&pcb->pcb_fpu, 0, sizeof(pcb->pcb_fpu));
- l->l_md.md_flags |= MDLWP_USEDFPU;
+ fpu_mark_used(l);
}
if (fpu_emulate(tf, &pcb->pcb_fpu, &ksi)) {
diff -r 5abbecfe9be1 -r 88c877b3da20 sys/arch/powerpc/include/proc.h
--- a/sys/arch/powerpc/include/proc.h Fri Aug 23 06:18:14 2013 +0000
+++ b/sys/arch/powerpc/include/proc.h Fri Aug 23 06:19:46 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.h,v 1.12 2011/06/05 16:52:25 matt Exp $ */
+/* $NetBSD: proc.h,v 1.13 2013/08/23 06:19:46 matt Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -42,8 +42,6 @@
volatile int md_astpending;
struct trapframe *md_utf; /* user trampframe */
};
-#define MDLWP_USEDFPU __BIT(PCU_FPU) /* this thread has used the FPU */
-#define MDLWP_USEDVEC __BIT(PCU_VEC) /* this thread has used the VEC */
struct trapframe;
diff -r 5abbecfe9be1 -r 88c877b3da20 sys/arch/powerpc/oea/altivec.c
--- a/sys/arch/powerpc/oea/altivec.c Fri Aug 23 06:18:14 2013 +0000
+++ b/sys/arch/powerpc/oea/altivec.c Fri Aug 23 06:19:46 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: altivec.c,v 1.27 2013/08/22 19:50:54 drochner Exp $ */
+/* $NetBSD: altivec.c,v 1.28 2013/08/23 06:21:33 matt Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.27 2013/08/22 19:50:54 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.28 2013/08/23 06:21:33 matt Exp $");
#include "opt_multiprocessor.h"
@@ -63,13 +63,13 @@
bool
vec_used_p(lwp_t *l)
{
- return (l->l_md.md_flags & MDLWP_USEDVEC) != 0;
+ return pcu_used_p(&vec_ops);
}
void
vec_mark_used(lwp_t *l)
{
- l->l_md.md_flags |= MDLWP_USEDVEC;
+ return pcu_discard(&vec_ops, true);
}
void
@@ -109,7 +109,7 @@
/*
* Mark vector registers as modified.
*/
- l->l_md.md_flags |= MDLWP_USEDVEC|PSL_VEC;
+ l->l_md.md_flags |= PSL_VEC;
l->l_md.md_utf->tf_srr1 |= PSL_VEC;
}
diff -r 5abbecfe9be1 -r 88c877b3da20 sys/arch/powerpc/powerpc/fpu.c
--- a/sys/arch/powerpc/powerpc/fpu.c Fri Aug 23 06:18:14 2013 +0000
+++ b/sys/arch/powerpc/powerpc/fpu.c Fri Aug 23 06:19:46 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu.c,v 1.33 2013/08/22 19:50:54 drochner Exp $ */
+/* $NetBSD: fpu.c,v 1.34 2013/08/23 06:19:46 matt Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.33 2013/08/22 19:50:54 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.34 2013/08/23 06:19:46 matt Exp $");
#include "opt_multiprocessor.h"
@@ -65,13 +65,13 @@
bool
fpu_used_p(lwp_t *l)
{
- return (l->l_md.md_flags & MDLWP_USEDFPU) != 0;
+ return pcu_used_p(&fpu_ops);
}
void
fpu_mark_used(lwp_t *l)
{
- l->l_md.md_flags |= MDLWP_USEDFPU;
+ pcu_discard(&fpu_ops, true);
}
#ifdef PPC_HAVE_FPU
@@ -82,7 +82,6 @@
if (__predict_false(!fpu_used_p(l))) {
memset(&pcb->pcb_fpu, 0, sizeof(pcb->pcb_fpu));
- fpu_mark_used(l);
}
const register_t msr = mfmsr();
@@ -97,7 +96,6 @@
curcpu()->ci_ev_fpusw.ev_count++;
l->l_md.md_utf->tf_srr1 |= PSL_FP|(pcb->pcb_flags & (PCB_FE0|PCB_FE1));
- l->l_md.md_flags |= MDLWP_USEDFPU;
}
/*
Home |
Main Index |
Thread Index |
Old Index