Module Name: src Committed By: matt Date: Tue Aug 14 20:42:33 UTC 2012
Modified Files: src/sys/arch/arm/arm32: arm32_machdep.c cpuswitch.S fault.c genassym.cf src/sys/arch/arm/include: cpu.h pcb.h Log Message: Kill curpcb/ci_curpcb. Use device_t in cpu_info. Add ci_softc (where ci_curpcb was so cpu_info doesn't change). To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/arch/arm/arm32/arm32_machdep.c cvs rdiff -u -r1.64 -r1.65 src/sys/arch/arm/arm32/cpuswitch.S cvs rdiff -u -r1.81 -r1.82 src/sys/arch/arm/arm32/fault.c cvs rdiff -u -r1.47 -r1.48 src/sys/arch/arm/arm32/genassym.cf cvs rdiff -u -r1.66 -r1.67 src/sys/arch/arm/include/cpu.h cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/include/pcb.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/arm/arm32/arm32_machdep.c diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.79 src/sys/arch/arm/arm32/arm32_machdep.c:1.80 --- src/sys/arch/arm/arm32/arm32_machdep.c:1.79 Sun Jul 29 00:07:10 2012 +++ src/sys/arch/arm/arm32/arm32_machdep.c Tue Aug 14 20:42:33 2012 @@ -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 @@ cpu_startup(void) 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; } /* Index: src/sys/arch/arm/arm32/cpuswitch.S diff -u src/sys/arch/arm/arm32/cpuswitch.S:1.64 src/sys/arch/arm/arm32/cpuswitch.S:1.65 --- src/sys/arch/arm/arm32/cpuswitch.S:1.64 Sun Aug 12 05:05:47 2012 +++ src/sys/arch/arm/arm32/cpuswitch.S Tue Aug 14 20:42:33 2012 @@ -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 @@ ENTRY(cpu_switchto) 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 @@ ENTRY_NP(softint_switch) 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 @@ ENTRY_NP(softint_switch) #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. */ Index: src/sys/arch/arm/arm32/fault.c diff -u src/sys/arch/arm/arm32/fault.c:1.81 src/sys/arch/arm/arm32/fault.c:1.82 --- src/sys/arch/arm/arm32/fault.c:1.81 Mon Jul 30 22:54:33 2012 +++ src/sys/arch/arm/arm32/fault.c Tue Aug 14 20:42:33 2012 @@ -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 @@ badaddr_read(void *addr, size_t size, vo 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 @@ badaddr_read(void *addr, size_t size, vo 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 */ Index: src/sys/arch/arm/arm32/genassym.cf diff -u src/sys/arch/arm/arm32/genassym.cf:1.47 src/sys/arch/arm/arm32/genassym.cf:1.48 --- src/sys/arch/arm/arm32/genassym.cf:1.47 Thu Aug 2 15:56:06 2012 +++ src/sys/arch/arm/arm32/genassym.cf Tue Aug 14 20:42:33 2012 @@ -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 @@ define CI_CURPRIORITY offsetof(struct c 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) Index: src/sys/arch/arm/include/cpu.h diff -u src/sys/arch/arm/include/cpu.h:1.66 src/sys/arch/arm/include/cpu.h:1.67 --- src/sys/arch/arm/include/cpu.h:1.66 Sun Aug 12 05:05:47 2012 +++ src/sys/arch/arm/include/cpu.h Tue Aug 14 20:42:33 2012 @@ -114,16 +114,14 @@ extern int cpu_do_powersave; #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 @@ static inline void cpu_dosoftints(void); #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 @@ curcpu(void) #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 Index: src/sys/arch/arm/include/pcb.h diff -u src/sys/arch/arm/include/pcb.h:1.22 src/sys/arch/arm/include/pcb.h:1.23 --- src/sys/arch/arm/include/pcb.h:1.22 Sun Aug 12 05:05:47 2012 +++ src/sys/arch/arm/include/pcb.h Tue Aug 14 20:42:33 2012 @@ -104,15 +104,4 @@ struct md_coredump { 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_ */