Module Name:    src
Committed By:   thorpej
Date:           Thu Sep  3 04:18:30 UTC 2020

Modified Files:
        src/sys/arch/alpha/alpha: genassym.cf locore.s prom.c
        src/sys/arch/alpha/include: asm.h

Log Message:
The only remaining consumer of curpcb was the PROM mapping code, for if
PROM console routines are being used (only on KN8AE).  We have access to
the sam information via curlwp, so use that, and eliminate the need to set
cpu_info::ci_curpcb when context switching, which saves an extra all into
PALcode.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/alpha/genassym.cf
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/alpha/alpha/locore.s
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/alpha/alpha/prom.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/alpha/include/asm.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/alpha/alpha/genassym.cf
diff -u src/sys/arch/alpha/alpha/genassym.cf:1.22 src/sys/arch/alpha/alpha/genassym.cf:1.23
--- src/sys/arch/alpha/alpha/genassym.cf:1.22	Thu Feb 20 08:27:38 2020
+++ src/sys/arch/alpha/alpha/genassym.cf	Thu Sep  3 04:18:30 2020
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.22 2020/02/20 08:27:38 skrll Exp $
+# $NetBSD: genassym.cf,v 1.23 2020/09/03 04:18:30 thorpej Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -187,6 +187,5 @@ define	SYS_exit		SYS_exit
 
 # CPU info
 define	CPU_INFO_CURLWP		offsetof(struct cpu_info, ci_curlwp)
-define	CPU_INFO_CURPCB		offsetof(struct cpu_info, ci_curpcb)
 define	CPU_INFO_IDLE_LWP	offsetof(struct cpu_info, ci_data.cpu_idlelwp)
 define	CPU_INFO_SIZEOF		sizeof(struct cpu_info)

Index: src/sys/arch/alpha/alpha/locore.s
diff -u src/sys/arch/alpha/alpha/locore.s:1.126 src/sys/arch/alpha/alpha/locore.s:1.127
--- src/sys/arch/alpha/alpha/locore.s:1.126	Thu Sep  3 02:09:09 2020
+++ src/sys/arch/alpha/alpha/locore.s	Thu Sep  3 04:18:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.126 2020/09/03 02:09:09 thorpej Exp $ */
+/* $NetBSD: locore.s,v 1.127 2020/09/03 04:18:30 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2019 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <machine/asm.h>
 
-__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.126 2020/09/03 02:09:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.s,v 1.127 2020/09/03 04:18:30 thorpej Exp $");
 
 #include "assym.h"
 
@@ -78,10 +78,6 @@ __KERNEL_RCSID(0, "$NetBSD: locore.s,v 1
  * hwpcb should be in a0.  Clobbers v0, t0, t8..t11, a0.
  */
 #define	SWITCH_CONTEXT							\
-	/* Make a note of the context we're running on. */		\
-	GET_CURPCB						;	\
-	stq	a0, 0(v0)					;	\
-									\
 	/* Swap in the new context. */					\
 	call_pal PAL_OSF1_swpctx
 

Index: src/sys/arch/alpha/alpha/prom.c
diff -u src/sys/arch/alpha/alpha/prom.c:1.54 src/sys/arch/alpha/alpha/prom.c:1.55
--- src/sys/arch/alpha/alpha/prom.c:1.54	Thu Sep  3 02:09:09 2020
+++ src/sys/arch/alpha/alpha/prom.c	Thu Sep  3 04:18:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: prom.c,v 1.54 2020/09/03 02:09:09 thorpej Exp $ */
+/* $NetBSD: prom.c,v 1.55 2020/09/03 04:18:30 thorpej Exp $ */
 
 /*
  * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.54 2020/09/03 02:09:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.55 2020/09/03 04:18:30 thorpej Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -77,7 +77,8 @@ prom_lev1map(void)
 	/*
 	 * Find the level 1 map that we're currently running on.
 	 */
-	apcb = (struct alpha_pcb *)ALPHA_PHYS_TO_K0SEG(curpcb);
+	apcb = (struct alpha_pcb *))
+	    ALPHA_PHYS_TO_K0SEG((paddr_t)curlwp->l_md.md_pcbpaddr);
 
 	return ((pt_entry_t *)ALPHA_PHYS_TO_K0SEG(apcb->apcb_ptbr << PGSHIFT));
 }
@@ -186,7 +187,7 @@ prom_enter(void)
 	 * (i.e. the first one after alpha_init()), then the PROM
 	 * is still mapped, regardless of the `prom_mapped' setting.
 	 */
-	if (prom_mapped == 0 && curpcb != 0) {
+	if (! prom_mapped) {
 		if (!prom_uses_prom_console())
 			panic("prom_enter");
 		{
@@ -209,7 +210,7 @@ prom_leave(void)
 	/*
 	 * See comment above.
 	 */
-	if (prom_mapped == 0 && curpcb != 0) {
+	if (! prom_mapped) {
 		if (!prom_uses_prom_console())
 			panic("prom_leave");
 		{

Index: src/sys/arch/alpha/include/asm.h
diff -u src/sys/arch/alpha/include/asm.h:1.39 src/sys/arch/alpha/include/asm.h:1.40
--- src/sys/arch/alpha/include/asm.h:1.39	Sat Aug 29 22:50:27 2020
+++ src/sys/arch/alpha/include/asm.h	Thu Sep  3 04:18:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: asm.h,v 1.39 2020/08/29 22:50:27 thorpej Exp $ */
+/* $NetBSD: asm.h,v 1.40 2020/09/03 04:18:30 thorpej Exp $ */
 
 /*
  * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
@@ -675,10 +675,6 @@ label:	ASCIZ msg;						\
 	call_pal PAL_OSF1_rdval					;	\
 	addq	v0, CPU_INFO_FPCURLWP, v0
 
-#define	GET_CURPCB							\
-	call_pal PAL_OSF1_rdval					;	\
-	addq	v0, CPU_INFO_CURPCB, v0
-
 #else	/* if not MULTIPROCESSOR... */
 
 IMPORT(cpu_info_primary, CPU_INFO_SIZEOF)
@@ -688,8 +684,6 @@ IMPORT(cpu_info_primary, CPU_INFO_SIZEOF
 #define	GET_CURLWP		lda v0, cpu_info_primary + CPU_INFO_CURLWP
 
 #define	GET_FPCURLWP		lda v0, cpu_info_primary + CPU_INFO_FPCURLWP
-
-#define	GET_CURPCB		lda v0, cpu_info_primary + CPU_INFO_CURPCB
 #endif /* MULTIPROCESSOR */
 #else
 #define	RCSID(_s)		__SECTIONSTRING(.ident, _s)

Reply via email to