Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64 sun4v: The maximum number of register windo...
details: https://anonhg.NetBSD.org/src/rev/8973f840684e
branches: trunk
changeset: 796990:8973f840684e
user: palle <palle%NetBSD.org@localhost>
date: Mon Jun 30 12:59:48 2014 +0000
description:
sun4v: The maximum number of register windows is a constant and thus not available via the %ver register (sun4u only). Introduce a macro GET_MAXCWP that handles this, so cpu_switchto() works properly
on sun4v. Other relevant reference to %ver can be adapted to use GET_MAXCWP as the sun4v port progresses. OK martin@
diffstat:
sys/arch/sparc64/doc/TODO | 8 +++++++-
sys/arch/sparc64/sparc64/locore.s | 32 ++++++++++++++++++++++++++++----
2 files changed, 35 insertions(+), 5 deletions(-)
diffs (78 lines):
diff -r c3bcab4eba8b -r 8973f840684e sys/arch/sparc64/doc/TODO
--- a/sys/arch/sparc64/doc/TODO Mon Jun 30 12:56:51 2014 +0000
+++ b/sys/arch/sparc64/doc/TODO Mon Jun 30 12:59:48 2014 +0000
@@ -1,7 +1,11 @@
- /* $NetBSD: TODO,v 1.4 2014/06/05 19:49:04 palle Exp $ */
+ /* $NetBSD: TODO,v 1.5 2014/06/30 12:59:48 palle Exp $ */
Things to be done:
+common:
+- make %g6 point to curcpu
+- make %g7 point to curlwp
+
sun4u:
sun4v:
@@ -12,3 +16,5 @@
- locore.s: sun4v_datatrap missing implementation for trap levels 0 and 1
- pmap.c: pmap_calculate_colors() should known about sun4v
- cpu.c: cpu_attach() does not emit cache info on sun4v
+- check build without SUN4V defined
+- replace relevant references til %ver with GET_MAXCWP
diff -r c3bcab4eba8b -r 8973f840684e sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Mon Jun 30 12:56:51 2014 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Mon Jun 30 12:59:48 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.s,v 1.360 2014/05/31 18:22:29 palle Exp $ */
+/* $NetBSD: locore.s,v 1.361 2014/06/30 12:59:48 palle Exp $ */
/*
* Copyright (c) 2006-2010 Matthew R. Green
@@ -93,8 +93,33 @@
#define BLOCK_SIZE SPARC64_BLOCK_SIZE
#define BLOCK_ALIGN SPARC64_BLOCK_ALIGN
+#ifdef SUN4V
+#define SUN4V_N_REG_WINDOWS 8 /* As per UA2005 spec */
+#define SUN4V_NWINDOWS (SUN4V_N_REG_WINDOWS-1) /* This is an index number, so subtract one */
+#endif
+
#include "ksyms.h"
+ /* Misc. macros */
+
+ .macro GET_MAXCWP reg
+#ifdef SUN4V
+ sethi %hi(cputyp), \reg
+ ld [\reg + %lo(cputyp)], \reg
+ bne,pt %icc, 2f
+ nop
+ /* sun4v */
+ ba 3f
+ mov SUN4V_NWINDOWS, \reg
+2:
+#endif
+ /* sun4u */
+ rdpr %ver, \reg
+ and \reg, CWP, \reg
+3:
+ .endm
+
+
#ifdef SUN4V
/* Misc. sun4v macros */
@@ -5442,10 +5467,9 @@
wrpr %g0, 0, %otherwin ! These two insns should be redundant
wrpr %g0, 0, %canrestore
- rdpr %ver, %o3
- and %o3, CWP, %o3
+ GET_MAXCWP %o3
wrpr %g0, %o3, %cleanwin
- dec 1, %o3 ! NWINDOWS-1-1
+ dec 1, %o3 ! CANSAVE + CANRESTORE + OTHERWIN = MAXCWP - 1
/* Skip the rest if returning to a interrupted LWP. */
brnz,pn %i2, Lsw_noras
wrpr %o3, %cansave
Home |
Main Index |
Thread Index |
Old Index