Module Name: src Committed By: palle Date: Mon Jun 30 12:59:48 UTC 2014
Modified Files: src/sys/arch/sparc64/doc: TODO src/sys/arch/sparc64/sparc64: locore.s Log Message: 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@ To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc64/doc/TODO cvs rdiff -u -r1.360 -r1.361 src/sys/arch/sparc64/sparc64/locore.s 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/sparc64/doc/TODO diff -u src/sys/arch/sparc64/doc/TODO:1.4 src/sys/arch/sparc64/doc/TODO:1.5 --- src/sys/arch/sparc64/doc/TODO:1.4 Thu Jun 5 19:49:04 2014 +++ src/sys/arch/sparc64/doc/TODO Mon Jun 30 12:59:48 2014 @@ -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 @@ sun4v: - 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 Index: src/sys/arch/sparc64/sparc64/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.360 src/sys/arch/sparc64/sparc64/locore.s:1.361 --- src/sys/arch/sparc64/sparc64/locore.s:1.360 Sat May 31 18:22:29 2014 +++ src/sys/arch/sparc64/sparc64/locore.s Mon Jun 30 12:59:48 2014 @@ -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 @@ ENTRY(cpu_switchto) 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