Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Use lwp_getpcb() on x86 MD code, clean from struct ...
details: https://anonhg.NetBSD.org/src/rev/2ee5f4e5989e
branches: trunk
changeset: 749187:2ee5f4e5989e
user: rmind <rmind%NetBSD.org@localhost>
date: Sat Nov 21 03:11:00 2009 +0000
description:
Use lwp_getpcb() on x86 MD code, clean from struct user usage.
diffstat:
sys/arch/amd64/amd64/db_trace.c | 11 +++---
sys/arch/amd64/amd64/fpu.c | 40 ++++++++++++++----------
sys/arch/amd64/amd64/gdt.c | 5 +-
sys/arch/amd64/amd64/genassym.cf | 3 +-
sys/arch/amd64/amd64/linux32_syscall.c | 5 +-
sys/arch/amd64/amd64/linux_syscall.c | 5 +-
sys/arch/amd64/amd64/machdep.c | 31 ++++++++++++-------
sys/arch/amd64/amd64/netbsd32_machdep.c | 27 ++++++++++------
sys/arch/amd64/amd64/netbsd32_syscall.c | 5 +-
sys/arch/amd64/amd64/process_machdep.c | 8 ++--
sys/arch/amd64/amd64/trap.c | 7 +--
sys/arch/i386/i386/apmbios.c | 5 +-
sys/arch/i386/i386/autoconf.c | 9 +++--
sys/arch/i386/i386/compat_13_machdep.c | 5 +-
sys/arch/i386/i386/compat_16_machdep.c | 5 +-
sys/arch/i386/i386/db_trace.c | 11 +++---
sys/arch/i386/i386/freebsd_machdep.c | 7 +--
sys/arch/i386/i386/freebsd_syscall.c | 5 +-
sys/arch/i386/i386/gdt.c | 5 +-
sys/arch/i386/i386/genassym.cf | 3 +-
sys/arch/i386/i386/ibcs2_machdep.c | 7 +--
sys/arch/i386/i386/ibcs2_syscall.c | 5 +-
sys/arch/i386/i386/kvm86.c | 5 +-
sys/arch/i386/i386/linux_syscall.c | 5 +-
sys/arch/i386/i386/mach_machdep.c | 5 +-
sys/arch/i386/i386/mach_syscall.c | 5 +-
sys/arch/i386/i386/machdep.c | 52 ++++++++++++++++++--------------
sys/arch/i386/i386/process_machdep.c | 18 +++++++---
sys/arch/i386/i386/svr4_machdep.c | 7 +--
sys/arch/i386/i386/svr4_syscall.c | 5 +-
sys/arch/i386/i386/trap.c | 13 ++++---
sys/arch/i386/i386/vm86.c | 13 ++++---
sys/arch/i386/include/vm86.h | 14 ++++----
sys/arch/i386/isa/npx.c | 50 +++++++++++++++++-------------
sys/arch/x86/include/cpu.h | 4 +-
sys/arch/x86/x86/core_machdep.c | 5 +-
sys/arch/x86/x86/cpu.c | 20 +++++++-----
sys/arch/x86/x86/lapic.c | 5 +-
sys/arch/x86/x86/linux_trap.c | 5 +-
sys/arch/x86/x86/mtrr_i686.c | 5 +-
sys/arch/x86/x86/pmap.c | 18 +++++-----
sys/arch/x86/x86/sys_machdep.c | 30 ++++++++++--------
sys/arch/x86/x86/syscall.c | 5 +-
sys/arch/x86/x86/vm_machdep.c | 14 ++++----
sys/arch/x86/x86/x86_machdep.c | 12 +++++--
45 files changed, 277 insertions(+), 252 deletions(-)
diffs (truncated from 2205 to 300 lines):
diff -r 5e9ad8f338b6 -r 2ee5f4e5989e sys/arch/amd64/amd64/db_trace.c
--- a/sys/arch/amd64/amd64/db_trace.c Sat Nov 21 02:40:54 2009 +0000
+++ b/sys/arch/amd64/amd64/db_trace.c Sat Nov 21 03:11:00 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.16 2009/10/21 21:11:58 rmind Exp $ */
+/* $NetBSD: db_trace.c,v 1.17 2009/11/21 03:11:01 rmind Exp $ */
/*
* Mach Operating System
@@ -27,12 +27,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.16 2009/10/21 21:11:58 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.17 2009/11/21 03:11:01 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
-#include <sys/user.h>
#include <machine/db_machdep.h>
#include <machine/frame.h>
@@ -338,7 +337,7 @@
} else {
if (trace_thread) {
struct proc *p;
- struct user *u;
+ struct pcb *pcb;
struct lwp *l;
if (lwpaddr) {
l = (struct lwp *)addr;
@@ -355,13 +354,13 @@
KASSERT(l != NULL);
}
(*pr)("lid %d ", l->l_lid);
- u = l->l_addr;
+ pcb = lwp_getpcb(l);
if (p == curproc && l == curlwp) {
frame = (long *)ddb_regs.tf_rbp;
callpc = (db_addr_t)ddb_regs.tf_rip;
(*pr)("at %p\n", frame);
} else {
- frame = (long *)u->u_pcb.pcb_rbp;
+ frame = (long *)pcb->pcb_rbp;
callpc = (db_addr_t)
db_get_value((long)(frame + 1), 8, false);
(*pr)("at %p\n", frame);
diff -r 5e9ad8f338b6 -r 2ee5f4e5989e sys/arch/amd64/amd64/fpu.c
--- a/sys/arch/amd64/amd64/fpu.c Sat Nov 21 02:40:54 2009 +0000
+++ b/sys/arch/amd64/amd64/fpu.c Sat Nov 21 03:11:00 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fpu.c,v 1.31 2009/03/14 15:36:00 dsl Exp $ */
+/* $NetBSD: fpu.c,v 1.32 2009/11/21 03:11:01 rmind Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc. All
@@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.31 2009/03/14 15:36:00 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.32 2009/11/21 03:11:01 rmind Exp $");
#include "opt_multiprocessor.h"
@@ -109,7 +109,6 @@
#include <sys/conf.h>
#include <sys/file.h>
#include <sys/proc.h>
-#include <sys/user.h>
#include <sys/ioctl.h>
#include <sys/device.h>
#include <sys/vmmeter.h>
@@ -183,7 +182,8 @@
fputrap(struct trapframe *frame)
{
register struct lwp *l = curcpu()->ci_fpcurlwp;
- struct savefpu *sfp = &l->l_addr->u_pcb.pcb_savefpu;
+ struct pcb *pcb = lwp_getpcb(l);
+ struct savefpu *sfp = &pcb->pcb_savefpu;
uint32_t mxcsr, statbits;
uint16_t cw;
ksiginfo_t ksi;
@@ -257,6 +257,7 @@
uint16_t cw;
uint32_t mxcsr;
struct lwp *l, *fl;
+ struct pcb *pcb;
int s;
if (ci->ci_fpsaving) {
@@ -271,6 +272,7 @@
/* Save state on current CPU. */
l = ci->ci_curlwp;
+ pcb = lwp_getpcb(l);
fl = ci->ci_fpcurlwp;
if (fl != NULL) {
/*
@@ -278,7 +280,7 @@
* switch lwp. In this case do nothing
*/
if (fl == l) {
- KASSERT(l->l_addr->u_pcb.pcb_fpcpu == ci);
+ KASSERT(pcb->pcb_fpcpu == ci);
clts();
splx(s);
return;
@@ -289,12 +291,12 @@
}
/* Save our state if on a remote CPU. */
- if (l->l_addr->u_pcb.pcb_fpcpu != NULL) {
+ if (pcb->pcb_fpcpu != NULL) {
/* Explicitly disable preemption before dropping spl. */
KPREEMPT_DISABLE(l);
splx(s);
fpusave_lwp(l, true);
- KASSERT(l->l_addr->u_pcb.pcb_fpcpu == NULL);
+ KASSERT(pcb->pcb_fpcpu == NULL);
s = splhigh();
KPREEMPT_ENABLE(l);
}
@@ -305,12 +307,12 @@
*/
clts();
ci->ci_fpcurlwp = l;
- l->l_addr->u_pcb.pcb_fpcpu = ci;
+ pcb->pcb_fpcpu = ci;
if ((l->l_md.md_flags & MDP_USEDFPU) == 0) {
fninit();
- cw = l->l_addr->u_pcb.pcb_savefpu.fp_fxsave.fx_fcw;
+ cw = pcb->pcb_savefpu.fp_fxsave.fx_fcw;
fldcw(&cw);
- mxcsr = l->l_addr->u_pcb.pcb_savefpu.fp_fxsave.fx_mxcsr;
+ mxcsr = pcb->pcb_savefpu.fp_fxsave.fx_mxcsr;
x86_ldmxcsr(&mxcsr);
l->l_md.md_flags |= MDP_USEDFPU;
} else {
@@ -334,7 +336,7 @@
* fxrstor() anyway.
*/
fldummy(&zero);
- fxrstor(&l->l_addr->u_pcb.pcb_savefpu);
+ fxrstor(&pcb->pcb_savefpu);
}
KASSERT(ci == curcpu());
@@ -348,14 +350,17 @@
fpusave_cpu(bool save)
{
struct cpu_info *ci;
+ struct pcb *pcb;
struct lwp *l;
KASSERT(curcpu()->ci_ilevel == IPL_HIGH);
ci = curcpu();
l = ci->ci_fpcurlwp;
- if (l == NULL)
+ if (l == NULL) {
return;
+ }
+ pcb = lwp_getpcb(l);
if (save) {
/*
@@ -366,12 +371,12 @@
KASSERT(ci->ci_fpsaving == 0);
clts();
ci->ci_fpsaving = 1;
- fxsave(&l->l_addr->u_pcb.pcb_savefpu);
+ fxsave(&pcb->pcb_savefpu);
ci->ci_fpsaving = 0;
}
stts();
- l->l_addr->u_pcb.pcb_fpcpu = NULL;
+ pcb->pcb_fpcpu = NULL;
ci->ci_fpcurlwp = NULL;
}
@@ -385,13 +390,15 @@
fpusave_lwp(struct lwp *l, bool save)
{
struct cpu_info *oci;
+ struct pcb *pcb;
int s, spins, ticks;
spins = 0;
ticks = hardclock_ticks;
for (;;) {
s = splhigh();
- oci = l->l_addr->u_pcb.pcb_fpcpu;
+ pcb = lwp_getpcb(l);
+ oci = pcb->pcb_fpcpu;
if (oci == NULL) {
splx(s);
break;
@@ -404,8 +411,7 @@
}
splx(s);
x86_send_ipi(oci, X86_IPI_SYNCH_FPU);
- while (l->l_addr->u_pcb.pcb_fpcpu == oci &&
- ticks == hardclock_ticks) {
+ while (pcb->pcb_fpcpu == oci && ticks == hardclock_ticks) {
x86_pause();
spins++;
}
diff -r 5e9ad8f338b6 -r 2ee5f4e5989e sys/arch/amd64/amd64/gdt.c
--- a/sys/arch/amd64/amd64/gdt.c Sat Nov 21 02:40:54 2009 +0000
+++ b/sys/arch/amd64/amd64/gdt.c Sat Nov 21 03:11:00 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gdt.c,v 1.22 2009/11/07 07:27:40 cegger Exp $ */
+/* $NetBSD: gdt.c,v 1.23 2009/11/21 03:11:01 rmind Exp $ */
/*-
* Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.22 2009/11/07 07:27:40 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.23 2009/11/21 03:11:01 rmind Exp $");
#include "opt_multiprocessor.h"
#include "opt_xen.h"
@@ -46,7 +46,6 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/mutex.h>
-#include <sys/user.h>
#include <sys/cpu.h>
#include <uvm/uvm.h>
diff -r 5e9ad8f338b6 -r 2ee5f4e5989e sys/arch/amd64/amd64/genassym.cf
--- a/sys/arch/amd64/amd64/genassym.cf Sat Nov 21 02:40:54 2009 +0000
+++ b/sys/arch/amd64/amd64/genassym.cf Sat Nov 21 03:11:00 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.40 2008/12/30 13:15:49 pooka Exp $
+# $NetBSD: genassym.cf,v 1.41 2009/11/21 03:11:01 rmind Exp $
#
# Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -76,7 +76,6 @@
include <sys/proc.h>
include <sys/resourcevar.h>
include <sys/device.h>
-include <sys/user.h>
include <sys/mbuf.h>
include <sys/mutex.h>
include <sys/rwlock.h>
diff -r 5e9ad8f338b6 -r 2ee5f4e5989e sys/arch/amd64/amd64/linux32_syscall.c
--- a/sys/arch/amd64/amd64/linux32_syscall.c Sat Nov 21 02:40:54 2009 +0000
+++ b/sys/arch/amd64/amd64/linux32_syscall.c Sat Nov 21 03:11:00 2009 +0000
@@ -1,12 +1,11 @@
-/* $NetBSD: linux32_syscall.c,v 1.28 2009/03/14 15:36:00 dsl Exp $ */
+/* $NetBSD: linux32_syscall.c,v 1.29 2009/11/21 03:11:01 rmind Exp $ */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_syscall.c,v 1.28 2009/03/14 15:36:00 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_syscall.c,v 1.29 2009/11/21 03:11:01 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
-#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
diff -r 5e9ad8f338b6 -r 2ee5f4e5989e sys/arch/amd64/amd64/linux_syscall.c
--- a/sys/arch/amd64/amd64/linux_syscall.c Sat Nov 21 02:40:54 2009 +0000
+++ b/sys/arch/amd64/amd64/linux_syscall.c Sat Nov 21 03:11:00 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_syscall.c,v 1.29 2008/10/21 12:16:59 ad Exp $ */
+/* $NetBSD: linux_syscall.c,v 1.30 2009/11/21 03:11:01 rmind Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.29 2008/10/21 12:16:59 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.30 2009/11/21 03:11:01 rmind Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_linux.h"
@@ -39,7 +39,6 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
-#include <sys/user.h>
#include <sys/signal.h>
#include <sys/syscall.h>
#include <sys/syscallvar.h>
diff -r 5e9ad8f338b6 -r 2ee5f4e5989e sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c Sat Nov 21 02:40:54 2009 +0000
+++ b/sys/arch/amd64/amd64/machdep.c Sat Nov 21 03:11:00 2009 +0000
Home |
Main Index |
Thread Index |
Old Index