Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm Kill curpcb/ci_curpcb. Use device_t in cpu_info.
details: https://anonhg.NetBSD.org/src/rev/a6931678880a
branches: trunk
changeset: 781004:a6931678880a
user: matt <matt%NetBSD.org@localhost>
date: Tue Aug 14 20:42:33 2012 +0000
description:
Kill curpcb/ci_curpcb. Use device_t in cpu_info.
Add ci_softc (where ci_curpcb was so cpu_info doesn't change).
diffstat:
sys/arch/arm/arm32/arm32_machdep.c | 12 ++++++------
sys/arch/arm/arm32/cpuswitch.S | 14 ++++----------
sys/arch/arm/arm32/fault.c | 17 +++--------------
sys/arch/arm/arm32/genassym.cf | 3 +--
sys/arch/arm/include/cpu.h | 19 +++++++------------
sys/arch/arm/include/pcb.h | 11 -----------
6 files changed, 21 insertions(+), 55 deletions(-)
diffs (226 lines):
diff -r ac0880c4f558 -r a6931678880a sys/arch/arm/arm32/arm32_machdep.c
--- a/sys/arch/arm/arm32/arm32_machdep.c Tue Aug 14 20:39:49 2012 +0000
+++ b/sys/arch/arm/arm32/arm32_machdep.c Tue Aug 14 20:42:33 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm32_machdep.c,v 1.79 2012/07/29 00:07:10 matt Exp $ */
+/* $NetBSD: arm32_machdep.c,v 1.80 2012/08/14 20:42:33 matt Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.79 2012/07/29 00:07:10 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.80 2012/08/14 20:42:33 matt Exp $");
#include "opt_modular.h"
#include "opt_md.h"
@@ -251,11 +251,11 @@
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
printf("avail memory = %s\n", pbuf);
- curpcb = lwp_getpcb(&lwp0);
- curpcb->pcb_flags = 0;
- curpcb->pcb_un.un_32.pcb32_sp =
+ struct pcb * pcb = lwp_getpcb(&lwp0);
+ pcb->pcb_flags = 0;
+ pcb->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;
+ pcb->pcb_tf = (struct trapframe *)pcb->pcb_un.un_32.pcb32_sp - 1;
}
/*
diff -r ac0880c4f558 -r a6931678880a sys/arch/arm/arm32/cpuswitch.S
--- a/sys/arch/arm/arm32/cpuswitch.S Tue Aug 14 20:39:49 2012 +0000
+++ b/sys/arch/arm/arm32/cpuswitch.S Tue Aug 14 20:42:33 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpuswitch.S,v 1.64 2012/08/12 05:05:47 matt Exp $ */
+/* $NetBSD: cpuswitch.S,v 1.65 2012/08/14 20:42:33 matt Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -89,7 +89,7 @@
#include <machine/asm.h>
#include <machine/cpu.h>
- RCSID("$NetBSD: cpuswitch.S,v 1.64 2012/08/12 05:05:47 matt Exp $")
+ RCSID("$NetBSD: cpuswitch.S,v 1.65 2012/08/14 20:42:33 matt Exp $")
/* LINTSTUB: include <sys/param.h> */
@@ -173,10 +173,8 @@
str r6, [r7, #(CI_CURLWP)]
#endif
- /* Hook in a new pcb */
- ldr r0, [r6, #(L_PCB)]
- str r0, [r7, #(CI_CURPCB)]
- mov r7, r0
+ /* Get the new pcb */
+ ldr r7, [r6, #(L_PCB)]
/* At this point we can allow IRQ's again. */
#ifndef __HAVE_UNNESTED_INTRS
@@ -400,9 +398,6 @@
str r5, [r7, #(CI_CURLWP)] /* save new lwp */
#endif
- /* Hook in a new pcb */
- str r2, [r7, #(CI_CURPCB)]
-
/*
* Normally, we'd get {r8-r13} but since this is a softint lwp
* it's existing state doesn't matter. We start the stack just
@@ -437,7 +432,6 @@
#if !defined(PROCESS_ID_IS_CURLWP) || defined(MULTIPROCESSOR)
str r4, [r7, #(CI_CURLWP)] /* restore pinned lwp */
#endif
- str r2, [r7, #(CI_CURPCB)] /* restore the curpcb */
ldr sp, [r2, #(PCB_SP)] /* now running on the old stack. */
/* At this point we can allow IRQ's again. */
diff -r ac0880c4f558 -r a6931678880a sys/arch/arm/arm32/fault.c
--- a/sys/arch/arm/arm32/fault.c Tue Aug 14 20:39:49 2012 +0000
+++ b/sys/arch/arm/arm32/fault.c Tue Aug 14 20:42:33 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fault.c,v 1.81 2012/07/30 22:54:33 matt Exp $ */
+/* $NetBSD: fault.c,v 1.82 2012/08/14 20:42:33 matt Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
#include "opt_kgdb.h"
#include <sys/types.h>
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.81 2012/07/30 22:54:33 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.82 2012/08/14 20:42:33 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -895,19 +895,11 @@
uint16_t v2;
uint32_t v4;
} u;
- struct pcb *curpcb_save;
int rv, s;
cpu_drain_writebuf();
- /*
- * We might be called at interrupt time, so arrange to steal
- * lwp0's PCB temporarily, if required, so that pcb_onfault
- * handling works correctly.
- */
s = splhigh();
- if ((curpcb_save = curpcb) == NULL)
- curpcb = lwp_getpcb(&lwp0);
/* Read from the test address. */
switch (size) {
@@ -930,12 +922,9 @@
break;
default:
- curpcb = curpcb_save;
- panic("%s: invalid size (%lu)", __func__, (u_long)size);
+ panic("%s: invalid size (%zu)", __func__, size);
}
- /* Restore curpcb */
- curpcb = curpcb_save;
splx(s);
/* Return EFAULT if the address was invalid, else zero */
diff -r ac0880c4f558 -r a6931678880a sys/arch/arm/arm32/genassym.cf
--- a/sys/arch/arm/arm32/genassym.cf Tue Aug 14 20:39:49 2012 +0000
+++ b/sys/arch/arm/arm32/genassym.cf Tue Aug 14 20:42:33 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.47 2012/08/02 15:56:06 skrll Exp $
+# $NetBSD: genassym.cf,v 1.48 2012/08/14 20:42:33 matt Exp $
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@@ -156,7 +156,6 @@
ifndef PROCESS_ID_IS_CURLWP
define CI_CURLWP offsetof(struct cpu_info, ci_curlwp)
endif
-define CI_CURPCB offsetof(struct cpu_info, ci_curpcb)
define CI_CPL offsetof(struct cpu_info, ci_cpl)
define CI_ASTPENDING offsetof(struct cpu_info, ci_astpending)
define CI_WANT_RESCHED offsetof(struct cpu_info, ci_want_resched)
diff -r ac0880c4f558 -r a6931678880a sys/arch/arm/include/cpu.h
--- a/sys/arch/arm/include/cpu.h Tue Aug 14 20:39:49 2012 +0000
+++ b/sys/arch/arm/include/cpu.h Tue Aug 14 20:42:33 2012 +0000
@@ -114,16 +114,14 @@
#if defined (PROCESS_ID_IS_CURCPU)
#define GET_CURCPU(rX) mrc p15, 0, rX, c13, c0, 4
#define GET_CURLWP(rX) GET_CURCPU(rX); ldr rX, [rX, #CI_CURLWP]
-#define GET_CURPCB(rX) GET_CURCPU(rX); ldr rX, [rX, #CI_CURPCB]
#elif defined (PROCESS_ID_IS_CURLWP)
#define GET_CURLWP(rX) mrc p15, 0, rX, c13, c0, 4
#define GET_CURCPU(rX) GET_CURLWP(rX); ldr rX, [rX, #L_CPU]
-#define GET_CURPCB(rX) GET_CURLWP(rX); ldr rX, [rX, #L_PCB]
#elif !defined(MULTIPROCESSOR)
#define GET_CURCPU(rX) ldr rX, =_C_LABEL(cpu_info_store)
#define GET_CURLWP(rX) GET_CURCPU(rX); ldr rX, [rX, #CI_CURLWP]
-#define GET_CURPCB(rX) GET_CURCPU(rX); ldr rX, [rX, #CI_CURPCB]
#endif
+#define GET_CURPCB(rX) GET_CURLWP(rX); ldr rX, [rX, #L_PCB]
#else /* !_LOCORE */
@@ -231,17 +229,17 @@
#include <sys/cpu_data.h>
struct cpu_info {
struct cpu_data ci_data; /* MI per-cpu data */
- struct device *ci_dev; /* Device corresponding to this CPU */
+ device_t ci_dev; /* Device corresponding to this CPU */
cpuid_t ci_cpuid;
- u_int32_t ci_arm_cpuid; /* aggregate CPU id */
- u_int32_t ci_arm_cputype; /* CPU type */
- u_int32_t ci_arm_cpurev; /* CPU revision */
- u_int32_t ci_ctrl; /* The CPU control register */
+ uint32_t ci_arm_cpuid; /* aggregate CPU id */
+ uint32_t ci_arm_cputype; /* CPU type */
+ uint32_t ci_arm_cpurev; /* CPU revision */
+ uint32_t ci_ctrl; /* The CPU control register */
int ci_cpl; /* current processor level (spl) */
int ci_astpending; /* */
int ci_want_resched; /* resched() was called */
int ci_intr_depth; /* */
- struct pcb *ci_curpcb; /* current pcb */
+ struct cpu_softc *ci_softc; /* platform softc */
#ifdef __HAVE_FAST_SOFTINTS
lwp_t *ci_softlwps[SOFTINT_COUNT];
volatile uint32_t ci_softints;
@@ -295,9 +293,6 @@
#else
#define curcpu() (&cpu_info_store)
#endif /* !PROCESS_ID_IS_CURCPU && !PROCESS_ID_IS_CURLWP */
-#ifndef curpcb
-#define curpcb (curcpu()->ci_curpcb)
-#endif
#ifndef curlwp
#define curlwp (curcpu()->ci_curlwp)
#endif
diff -r ac0880c4f558 -r a6931678880a sys/arch/arm/include/pcb.h
--- a/sys/arch/arm/include/pcb.h Tue Aug 14 20:39:49 2012 +0000
+++ b/sys/arch/arm/include/pcb.h Tue Aug 14 20:42:33 2012 +0000
@@ -104,15 +104,4 @@
int md_empty;
};
-#ifdef _KERNEL
-#ifdef _KERNEL_OPT
-#include "opt_multiprocessor.h"
-#endif
-#ifdef MULTIPROCESSOR
-#define curpcb (curcpu()->ci_curpcb)
-#else
-extern struct pcb *curpcb;
-#endif
-#endif /* _KERNEL */
-
#endif /* _ARM_PCB_H_ */
Home |
Main Index |
Thread Index |
Old Index