Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Replace l_addr with uvm_lwp_getuarea() in various M...
details: https://anonhg.NetBSD.org/src/rev/53a20bb20b05
branches: trunk
changeset: 749412:53a20bb20b05
user: rmind <rmind%NetBSD.org@localhost>
date: Sun Nov 29 04:15:42 2009 +0000
description:
Replace l_addr with uvm_lwp_getuarea() in various MD code, mostly cpu_lwp_fork().
diffstat:
sys/arch/acorn26/acorn26/vm_machdep.c | 8 +++-----
sys/arch/alpha/alpha/vm_machdep.c | 6 +++---
sys/arch/amd64/amd64/machdep.c | 12 +++++-------
sys/arch/arm/arm32/arm32_machdep.c | 11 +++++------
sys/arch/arm/arm32/vm_machdep.c | 12 +++++++-----
sys/arch/hppa/hppa/vm_machdep.c | 13 ++++++++-----
sys/arch/i386/i386/machdep.c | 17 +++++++----------
sys/arch/ia64/ia64/vm_machdep.c | 4 ++--
sys/arch/m68k/m68k/vm_machdep.c | 6 +++---
sys/arch/sh3/sh3/vm_machdep.c | 15 ++++++---------
sys/arch/vax/vax/vm_machdep.c | 13 ++++++++-----
sys/arch/x86/x86/vm_machdep.c | 18 ++++++++++++------
12 files changed, 69 insertions(+), 66 deletions(-)
diffs (truncated from 519 to 300 lines):
diff -r 9d0d3af4b840 -r 53a20bb20b05 sys/arch/acorn26/acorn26/vm_machdep.c
--- a/sys/arch/acorn26/acorn26/vm_machdep.c Sun Nov 29 04:11:51 2009 +0000
+++ b/sys/arch/acorn26/acorn26/vm_machdep.c Sun Nov 29 04:15:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.25 2009/11/27 03:23:03 rmind Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.26 2009/11/29 04:15:42 rmind Exp $ */
/*-
* Copyright (c) 2000, 2001 Ben Harris
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.25 2009/11/27 03:23:03 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.26 2009/11/29 04:15:42 rmind Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@@ -106,7 +106,6 @@
struct pcb *pcb1, *pcb2;
struct trapframe *tf;
struct switchframe *sf;
- char *stacktop;
#if 0
printf("cpu_lwp_fork: %p -> %p\n", p1, p2);
@@ -120,8 +119,7 @@
/* pmap_activate(l2); XXX Other ports do. Why? */
/* Set up the kernel stack */
- stacktop = (char *)l2->l_addr + USPACE;
- tf = (struct trapframe *)stacktop - 1;
+ tf = (struct trapframe *)(uvm_lwp_getuarea(l2) + USPACE) - 1;
sf = (struct switchframe *)tf - 1;
/* Duplicate old process's trapframe (if it had one) */
if (pcb1->pcb_tf == NULL)
diff -r 9d0d3af4b840 -r 53a20bb20b05 sys/arch/alpha/alpha/vm_machdep.c
--- a/sys/arch/alpha/alpha/vm_machdep.c Sun Nov 29 04:11:51 2009 +0000
+++ b/sys/arch/alpha/alpha/vm_machdep.c Sun Nov 29 04:15:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.103 2009/11/26 00:19:11 matt Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.104 2009/11/29 04:15:42 rmind Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.103 2009/11/26 00:19:11 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.104 2009/11/29 04:15:42 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -143,7 +143,7 @@
* will be to right address, with correct registers.
*/
l2tf = l2->l_md.md_tf = (struct trapframe *)
- ((char *)l2->l_addr + USPACE - sizeof(struct trapframe));
+ (uvm_lwp_getuarea(l2) + USPACE - sizeof(struct trapframe));
memcpy(l2->l_md.md_tf, l1->l_md.md_tf,
sizeof(struct trapframe));
diff -r 9d0d3af4b840 -r 53a20bb20b05 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c Sun Nov 29 04:11:51 2009 +0000
+++ b/sys/arch/amd64/amd64/machdep.c Sun Nov 29 04:15:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.138 2009/11/26 00:19:12 matt Exp $ */
+/* $NetBSD: machdep.c,v 1.139 2009/11/29 04:15:42 rmind Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008
@@ -107,7 +107,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.138 2009/11/26 00:19:12 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.139 2009/11/29 04:15:42 rmind Exp $");
/* #define XENDEBUG_LOW */
@@ -403,15 +403,13 @@
void
x86_64_proc0_tss_ldt_init(void)
{
- struct lwp *l;
- struct pcb *pcb;
+ struct lwp *l = &lwp0;
+ struct pcb *pcb = lwp_getpcb(l);
- l = &lwp0;
- pcb = lwp_getpcb(l);
pcb->pcb_flags = 0;
pcb->pcb_fs = 0;
pcb->pcb_gs = 0;
- pcb->pcb_rsp0 = (USER_TO_UAREA(l->l_addr) + KSTACK_SIZE - 16) & ~0xf;
+ pcb->pcb_rsp0 = (uvm_lwp_getuarea(l) + KSTACK_SIZE - 16) & ~0xf;
pcb->pcb_iopl = SEL_KPL;
pmap_kernel()->pm_ldt_sel = GSYSSEL(GLDT_SEL, SEL_KPL);
diff -r 9d0d3af4b840 -r 53a20bb20b05 sys/arch/arm/arm32/arm32_machdep.c
--- a/sys/arch/arm/arm32/arm32_machdep.c Sun Nov 29 04:11:51 2009 +0000
+++ b/sys/arch/arm/arm32/arm32_machdep.c Sun Nov 29 04:15:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm32_machdep.c,v 1.70 2009/11/27 03:23:05 rmind Exp $ */
+/* $NetBSD: arm32_machdep.c,v 1.71 2009/11/29 04:15:42 rmind Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.70 2009/11/27 03:23:05 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.71 2009/11/29 04:15:42 rmind Exp $");
#include "opt_md.h"
#include "opt_pmap_debug.h"
@@ -254,10 +254,9 @@
curpcb = lwp_getpcb(&lwp0);
curpcb->pcb_flags = 0;
- curpcb->pcb_un.un_32.pcb32_sp = (u_int)lwp0.l_addr +
- USPACE_SVC_STACK_TOP;
-
- curpcb->pcb_tf = (struct trapframe *)curpcb->pcb_un.un_32.pcb32_sp - 1;
+ curpcb->pcb_un.un_32.pcb32_sp =
+ uvm_lwp_getuarea(&lwp0) + USPACE_SVC_STACK_TOP;
+ curpcb->pcb_tf = (struct trapframe *)curpcb->pcb_un.un_32.pcb32_sp - 1;
}
/*
diff -r 9d0d3af4b840 -r 53a20bb20b05 sys/arch/arm/arm32/vm_machdep.c
--- a/sys/arch/arm/arm32/vm_machdep.c Sun Nov 29 04:11:51 2009 +0000
+++ b/sys/arch/arm/arm32/vm_machdep.c Sun Nov 29 04:15:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.52 2009/11/26 00:19:12 matt Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.53 2009/11/29 04:15:42 rmind Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.52 2009/11/26 00:19:12 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.53 2009/11/29 04:15:42 rmind Exp $");
#include "opt_armfpe.h"
#include "opt_pmap_debug.h"
@@ -133,6 +133,7 @@
{
struct pcb *pcb1, *pcb2;
struct trapframe *tf;
+ vaddr_t uv;
pcb1 = lwp_getpcb(l1);
pcb2 = lwp_getpcb(l2);
@@ -164,14 +165,15 @@
*pcb2 = *pcb1;
/*
- * Set up the stack for the process.
+ * Set up the kernel stack for the process.
* Note: this stack is not in use if we are forking from p1
*/
- pcb2->pcb_un.un_32.pcb32_sp = (u_int)l2->l_addr + USPACE_SVC_STACK_TOP;
+ uv = uvm_lwp_getuarea(l2);
+ pcb2->pcb_un.un_32.pcb32_sp = uv + USPACE_SVC_STACK_TOP;
#ifdef STACKCHECKS
/* Fill the kernel stack with a known pattern */
- memset(((u_char *)l2->l_addr) + USPACE_SVC_STACK_BOTTOM, 0xdd,
+ memset((void *)(uv + USPACE_SVC_STACK_BOTTOM), 0xdd,
(USPACE_SVC_STACK_TOP - USPACE_SVC_STACK_BOTTOM));
#endif /* STACKCHECKS */
diff -r 9d0d3af4b840 -r 53a20bb20b05 sys/arch/hppa/hppa/vm_machdep.c
--- a/sys/arch/hppa/hppa/vm_machdep.c Sun Nov 29 04:11:51 2009 +0000
+++ b/sys/arch/hppa/hppa/vm_machdep.c Sun Nov 29 04:15:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.38 2009/11/21 15:36:34 rmind Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.39 2009/11/29 04:15:42 rmind Exp $ */
/* $OpenBSD: vm_machdep.c,v 1.64 2008/09/30 18:54:26 miod Exp $ */
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.38 2009/11/21 15:36:34 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.39 2009/11/29 04:15:42 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -84,6 +84,7 @@
struct pcb *pcb1, *pcb2;
struct trapframe *tf;
register_t sp, osp;
+ vaddr_t uv;
KASSERT(round_page(sizeof(struct pcb)) <= PAGE_SIZE);
@@ -105,7 +106,8 @@
pcb2->pcb_fpregs[2] = 0;
pcb2->pcb_fpregs[3] = 0;
- sp = (register_t)l2->l_addr + PAGE_SIZE;
+ uv = uvm_lwp_getuarea(l2);
+ sp = (register_t)uv + PAGE_SIZE;
l2->l_md.md_regs = tf = (struct trapframe *)sp;
sp += sizeof(struct trapframe);
@@ -166,13 +168,14 @@
*/
sp += HPPA_FRAME_SIZE + 16*4;
pcb2->pcb_ksp = sp;
- fdcache(HPPA_SID_KERNEL, (vaddr_t)l2->l_addr, sp - (vaddr_t)l2->l_addr);
+ fdcache(HPPA_SID_KERNEL, uv, sp - uv);
}
void
cpu_setfunc(struct lwp *l, void (*func)(void *), void *arg)
{
struct pcb *pcb = lwp_getpcb(l);
+ vaddr_t uv = uvm_lwp_getuarea(l);
struct trapframe *tf;
register_t sp, osp;
@@ -202,7 +205,7 @@
*/
sp += HPPA_FRAME_SIZE + 16*4;
pcb->pcb_ksp = sp;
- fdcache(HPPA_SID_KERNEL, (vaddr_t)l->l_addr, sp - (vaddr_t)l->l_addr);
+ fdcache(HPPA_SID_KERNEL, uv, sp - uv);
}
void
diff -r 9d0d3af4b840 -r 53a20bb20b05 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c Sun Nov 29 04:11:51 2009 +0000
+++ b/sys/arch/i386/i386/machdep.c Sun Nov 29 04:15:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.679 2009/11/27 03:23:10 rmind Exp $ */
+/* $NetBSD: machdep.c,v 1.680 2009/11/29 04:15:42 rmind Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.679 2009/11/27 03:23:10 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.680 2009/11/29 04:15:42 rmind Exp $");
#include "opt_beep.h"
#include "opt_compat_ibcs2.h"
@@ -522,15 +522,12 @@
void
i386_proc0_tss_ldt_init(void)
{
- struct lwp *l;
- struct pcb *pcb;
-
- l = &lwp0;
- pcb = lwp_getpcb(l);
+ struct lwp *l = &lwp0;
+ struct pcb *pcb = lwp_getpcb(l);
pmap_kernel()->pm_ldt_sel = GSEL(GLDT_SEL, SEL_KPL);
pcb->pcb_cr0 = rcr0() & ~CR0_TS;
- pcb->pcb_esp0 = USER_TO_UAREA(l->l_addr) + KSTACK_SIZE - 16;
+ pcb->pcb_esp0 = uvm_lwp_getuarea(l) + KSTACK_SIZE - 16;
pcb->pcb_iopl = SEL_KPL;
l->l_md.md_regs = (struct trapframe *)pcb->pcb_esp0 - 1;
memcpy(pcb->pcb_fsd, &gdt[GUDATA_SEL], sizeof(pcb->pcb_fsd));
@@ -1321,8 +1318,8 @@
pcb->pcb_cr3 = PDPpaddr - KERNBASE;
__PRINTK(("pcb_cr3 0x%lx cr3 0x%lx\n",
PDPpaddr - KERNBASE, xpmap_ptom(PDPpaddr - KERNBASE)));
- XENPRINTK(("lwp0.l_addr %p first_avail %p\n",
- lwp0.l_addr, (void *)(long)first_avail));
+ XENPRINTK(("lwp0uarea %p first_avail %p\n",
+ lwp0uarea, (void *)(long)first_avail));
XENPRINTK(("ptdpaddr %p atdevbase %p\n", (void *)PDPpaddr,
(void *)atdevbase));
#endif
diff -r 9d0d3af4b840 -r 53a20bb20b05 sys/arch/ia64/ia64/vm_machdep.c
--- a/sys/arch/ia64/ia64/vm_machdep.c Sun Nov 29 04:11:51 2009 +0000
+++ b/sys/arch/ia64/ia64/vm_machdep.c Sun Nov 29 04:15:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.9 2009/11/21 15:36:34 rmind Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.10 2009/11/29 04:15:42 rmind Exp $ */
/*
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -103,7 +103,7 @@
*pcb2 = *pcb1;
l2->l_md.md_flags = l1->l_md.md_flags;
- l2->l_md.md_tf = (struct trapframe *)((vaddr_t)l2->l_addr + USPACE) - 1;
Home |
Main Index |
Thread Index |
Old Index