Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Replace few USER_TO_UAREA/UAREA_TO_USER uses, reduce sys...



details:   https://anonhg.NetBSD.org/src/rev/bb075ea01a98
branches:  trunk
changeset: 750109:bb075ea01a98
user:      rmind <rmind%NetBSD.org@localhost>
date:      Thu Dec 17 01:25:10 2009 +0000

description:
Replace few USER_TO_UAREA/UAREA_TO_USER uses, reduce sys/user.h inclusions.

diffstat:

 sys/ddb/db_lwp.c       |   5 ++---
 sys/kern/init_main.c   |   5 ++---
 sys/kern/kern_lwp.c    |   7 +++----
 sys/kern/kern_proc.c   |   7 +++----
 sys/kern/subr_prof.c   |   5 ++---
 sys/kern/sys_process.c |   5 ++---
 sys/uvm/uvm_fault.c    |   5 ++---
 sys/uvm/uvm_glue.c     |  14 ++++++++------
 8 files changed, 24 insertions(+), 29 deletions(-)

diffs (248 lines):

diff -r 1662bb4d64bd -r bb075ea01a98 sys/ddb/db_lwp.c
--- a/sys/ddb/db_lwp.c  Thu Dec 17 00:29:46 2009 +0000
+++ b/sys/ddb/db_lwp.c  Thu Dec 17 01:25:10 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_lwp.c,v 1.4 2009/03/09 06:07:05 mrg Exp $   */
+/*     $NetBSD: db_lwp.c,v 1.5 2009/12/17 01:25:10 rmind Exp $ */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_lwp.c,v 1.4 2009/03/09 06:07:05 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_lwp.c,v 1.5 2009/12/17 01:25:10 rmind Exp $");
 
 #ifndef _KERNEL
 #include <stdbool.h>
@@ -39,7 +39,6 @@
 #include <sys/param.h>
 #include <sys/cpu.h>
 #include <sys/proc.h>
-#include <sys/user.h>
 
 #include <ddb/ddb.h>
 
diff -r 1662bb4d64bd -r bb075ea01a98 sys/kern/init_main.c
--- a/sys/kern/init_main.c      Thu Dec 17 00:29:46 2009 +0000
+++ b/sys/kern/init_main.c      Thu Dec 17 01:25:10 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_main.c,v 1.411 2009/11/27 16:43:51 pooka Exp $    */
+/*     $NetBSD: init_main.c,v 1.412 2009/12/17 01:25:10 rmind Exp $    */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.411 2009/11/27 16:43:51 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.412 2009/12/17 01:25:10 rmind Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ipsec.h"
@@ -152,7 +152,6 @@
 #include <sys/pset.h>
 #include <sys/sysctl.h>
 #include <sys/reboot.h>
-#include <sys/user.h>
 #include <sys/sysctl.h>
 #include <sys/event.h>
 #include <sys/mbuf.h>
diff -r 1662bb4d64bd -r bb075ea01a98 sys/kern/kern_lwp.c
--- a/sys/kern/kern_lwp.c       Thu Dec 17 00:29:46 2009 +0000
+++ b/sys/kern/kern_lwp.c       Thu Dec 17 01:25:10 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_lwp.c,v 1.136 2009/10/27 02:58:28 rmind Exp $     */
+/*     $NetBSD: kern_lwp.c,v 1.137 2009/12/17 01:25:10 rmind Exp $     */
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -209,7 +209,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.136 2009/10/27 02:58:28 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.137 2009/12/17 01:25:10 rmind Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -228,7 +228,6 @@
 #include <sys/syscall_stats.h>
 #include <sys/kauth.h>
 #include <sys/sleepq.h>
-#include <sys/user.h>
 #include <sys/lockdebug.h>
 #include <sys/kmem.h>
 #include <sys/pset.h>
@@ -632,7 +631,7 @@
        if (rnewlwpp != NULL)
                *rnewlwpp = l2;
 
-       l2->l_addr = UAREA_TO_USER(uaddr);
+       uvm_lwp_setuarea(l2, uaddr);
        uvm_lwp_fork(l1, l2, stack, stacksize, func,
            (arg != NULL) ? arg : l2);
 
diff -r 1662bb4d64bd -r bb075ea01a98 sys/kern/kern_proc.c
--- a/sys/kern/kern_proc.c      Thu Dec 17 00:29:46 2009 +0000
+++ b/sys/kern/kern_proc.c      Thu Dec 17 01:25:10 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_proc.c,v 1.158 2009/11/26 00:19:11 matt Exp $     */
+/*     $NetBSD: kern_proc.c,v 1.159 2009/12/17 01:25:10 rmind Exp $    */
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.158 2009/11/26 00:19:11 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.159 2009/12/17 01:25:10 rmind Exp $");
 
 #include "opt_kstack.h"
 #include "opt_maxuprc.h"
@@ -365,7 +365,7 @@
        pg = &pgrp0;
        l = &lwp0;
 
-       KASSERT(l->l_addr != NULL);
+       KASSERT((void *)uvm_lwp_getuarea(l) != NULL);
        KASSERT(l->l_lid == p->p_nlwpid);
 
        mutex_init(&p->p_stmutex, MUTEX_DEFAULT, IPL_HIGH);
@@ -1149,7 +1149,6 @@
 #endif /* DDB */
 
 #ifdef KSTACK_CHECK_MAGIC
-#include <sys/user.h>
 
 #define        KSTACK_MAGIC    0xdeadbeaf
 
diff -r 1662bb4d64bd -r bb075ea01a98 sys/kern/subr_prof.c
--- a/sys/kern/subr_prof.c      Thu Dec 17 00:29:46 2009 +0000
+++ b/sys/kern/subr_prof.c      Thu Dec 17 01:25:10 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_prof.c,v 1.44 2009/12/12 17:48:54 dsl Exp $       */
+/*     $NetBSD: subr_prof.c,v 1.45 2009/12/17 01:25:10 rmind Exp $     */
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -32,13 +32,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_prof.c,v 1.44 2009/12/12 17:48:54 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prof.c,v 1.45 2009/12/17 01:25:10 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/proc.h>
-#include <sys/user.h>
 #include <sys/mount.h>
 #include <sys/syscallargs.h>
 #include <sys/sysctl.h>
diff -r 1662bb4d64bd -r bb075ea01a98 sys/kern/sys_process.c
--- a/sys/kern/sys_process.c    Thu Dec 17 00:29:46 2009 +0000
+++ b/sys/kern/sys_process.c    Thu Dec 17 01:25:10 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_process.c,v 1.152 2009/12/14 00:48:35 matt Exp $   */
+/*     $NetBSD: sys_process.c,v 1.153 2009/12/17 01:25:10 rmind Exp $  */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_process.c,v 1.152 2009/12/14 00:48:35 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_process.c,v 1.153 2009/12/17 01:25:10 rmind Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_ktrace.h"
@@ -129,7 +129,6 @@
 #include <sys/errno.h>
 #include <sys/ptrace.h>
 #include <sys/uio.h>
-#include <sys/user.h>
 #include <sys/ras.h>
 #include <sys/kmem.h>
 #include <sys/kauth.h>
diff -r 1662bb4d64bd -r bb075ea01a98 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c       Thu Dec 17 00:29:46 2009 +0000
+++ b/sys/uvm/uvm_fault.c       Thu Dec 17 01:25:10 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_fault.c,v 1.128 2009/12/05 22:34:43 pooka Exp $    */
+/*     $NetBSD: uvm_fault.c,v 1.129 2009/12/17 01:25:10 rmind Exp $    */
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.128 2009/12/05 22:34:43 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.129 2009/12/17 01:25:10 rmind Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -49,7 +49,6 @@
 #include <sys/proc.h>
 #include <sys/malloc.h>
 #include <sys/mman.h>
-#include <sys/user.h>
 
 #include <uvm/uvm.h>
 
diff -r 1662bb4d64bd -r bb075ea01a98 sys/uvm/uvm_glue.c
--- a/sys/uvm/uvm_glue.c        Thu Dec 17 00:29:46 2009 +0000
+++ b/sys/uvm/uvm_glue.c        Thu Dec 17 01:25:10 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_glue.c,v 1.142 2009/11/21 17:45:02 rmind Exp $     */
+/*     $NetBSD: uvm_glue.c,v 1.143 2009/12/17 01:25:11 rmind Exp $     */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.142 2009/11/21 17:45:02 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.143 2009/12/17 01:25:11 rmind Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_kstack.h"
@@ -335,14 +335,14 @@
 uvm_lwp_getuarea(lwp_t *l)
 {
 
-       return USER_TO_UAREA(l->l_addr);
+       return (vaddr_t)l->l_addr - UAREA_USER_OFFSET;
 }
 
 void
 uvm_lwp_setuarea(lwp_t *l, vaddr_t addr)
 {
 
-       l->l_addr = UAREA_TO_USER(addr);
+       l->l_addr = (void *)(addr + UAREA_USER_OFFSET);
 }
 
 /*
@@ -376,10 +376,12 @@
 void
 uvm_lwp_exit(struct lwp *l)
 {
-       vaddr_t va = USER_TO_UAREA(l->l_addr);
+       vaddr_t va = uvm_lwp_getuarea(l);
 
        uvm_uarea_free(va);
-       l->l_addr = NULL;
+#ifdef DIAGNOSTIC
+       uvm_lwp_setuarea(l, (vaddr_t)NULL);
+#endif
 }
 
 /*



Home | Main Index | Thread Index | Old Index