Index: sys/arch/sparc64/doc/TODO =================================================================== RCS file: /cvsroot/src/sys/arch/sparc64/doc/TODO,v retrieving revision 1.4 diff -u -r1.4 TODO --- sys/arch/sparc64/doc/TODO 5 Jun 2014 19:49:04 -0000 1.4 +++ sys/arch/sparc64/doc/TODO 29 Jun 2014 19:51:28 -0000 @@ -2,6 +2,10 @@ 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 Index: sys/arch/sparc64/sparc64/locore.s =================================================================== RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/locore.s,v retrieving revision 1.360 diff -u -r1.360 locore.s --- sys/arch/sparc64/sparc64/locore.s 31 May 2014 18:22:29 -0000 1.360 +++ sys/arch/sparc64/sparc64/locore.s 29 Jun 2014 19:51:29 -0000 @@ -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