From 83b671e23d7cc9b7aacb538708165f9c19ff0ea0 Mon Sep 17 00:00:00 2001 From: pk Date: Mon, 12 Oct 1998 20:56:48 +0000 Subject: [PATCH] Make `cpcb' (current u.area) a per-CPU variable. Brace some MP-only code with `#ifdef MULTIPROCESSOR'. --- sys/arch/sparc/sparc/cpu.c | 25 ++++++++++++------------- sys/arch/sparc/sparc/cpuvar.h | 4 +++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/sys/arch/sparc/sparc/cpu.c b/sys/arch/sparc/sparc/cpu.c index 4413bdd3ef30..36598b618226 100644 --- a/sys/arch/sparc/sparc/cpu.c +++ b/sys/arch/sparc/sparc/cpu.c @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.80 1998/10/11 23:21:02 chuck Exp $ */ +/* $NetBSD: cpu.c,v 1.81 1998/10/12 20:56:48 pk Exp $ */ /* * Copyright (c) 1996 @@ -118,9 +118,9 @@ void fpu_init __P((struct cpu_info *)); #define SRMMU_VERS(mmusr) (((mmusr) >> 24) & 0xf) +#if defined(MULTIPROCESSOR) struct cpu_info *alloc_cpuinfo __P((void)); - struct cpu_info * alloc_cpuinfo() { @@ -183,12 +183,12 @@ alloc_cpuinfo() } bzero((void *)cpi, sizeof(struct cpu_info)); - - cpi->eintstack = (void *)(sva + sz); - cpi->idle_u = (void *)(sva + sz - INT_STACK_SIZE - USPACE); + cpi->eintstack = (void *)((u_int)cpi + sz); + cpi->idle_u = (void *)((u_int)cpi + sz - INT_STACK_SIZE - USPACE); return (cpi); } +#endif /* MULTIPROCESSOR */ #ifdef notdef /* @@ -273,8 +273,15 @@ static int cpu_number; cpi->master = 1; cpi->eintstack = eintstack; cpi->idle_u = idle_u; + /* Note: `curpcb' is set to `proc0' in locore */ } else { +#if defined(MULTIPROCESSOR) cpi = sc->sc_cpuinfo = alloc_cpuinfo(); + cpi->curpcb = cpi->idle_u; + /* Note: `idle_u' and `eintstack' are set in alloc_cpuinfo() */ +#else + printf(": no SMP support in kernel\n"); +#endif } #ifdef DEBUG @@ -313,14 +320,6 @@ static int cpu_number; cpuinfo.vcache_flush_region = smp_vcache_flush_region; cpuinfo.vcache_flush_context = smp_vcache_flush_context; } - -#ifdef DEBUG - printf("***\n"); - if (ncpu >= 4) - callrom(); -#endif -#else - printf(": no SMP support in kernel\n"); #endif /* MULTIPROCESSOR */ } diff --git a/sys/arch/sparc/sparc/cpuvar.h b/sys/arch/sparc/sparc/cpuvar.h index a0217cc81505..cfa79eaf0eec 100644 --- a/sys/arch/sparc/sparc/cpuvar.h +++ b/sys/arch/sparc/sparc/cpuvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpuvar.h,v 1.16 1998/10/11 14:46:45 pk Exp $ */ +/* $NetBSD: cpuvar.h,v 1.17 1998/10/12 20:56:48 pk Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -209,6 +209,8 @@ struct cpu_info { void *redzone; /* DEBUG: stack red zone */ #define REDSIZE (8*96) /* some room for bouncing */ + struct pcb *curpcb; /* CPU's PCB & kernel stack */ + /* * The following are function pointers to do interesting CPU-dependent * things without having to do type-tests all the time