0001
0002 #ifndef _SPARC64_PSRCOMPAT_H
0003 #define _SPARC64_PSRCOMPAT_H
0004
0005 #include <asm/pstate.h>
0006
0007
0008 #define PSR_CWP 0x0000001f
0009 #define PSR_ET 0x00000020
0010 #define PSR_PS 0x00000040
0011 #define PSR_S 0x00000080
0012 #define PSR_PIL 0x00000f00
0013 #define PSR_EF 0x00001000
0014 #define PSR_EC 0x00002000
0015 #define PSR_SYSCALL 0x00004000
0016 #define PSR_LE 0x00008000
0017 #define PSR_ICC 0x00f00000
0018 #define PSR_C 0x00100000
0019 #define PSR_V 0x00200000
0020 #define PSR_Z 0x00400000
0021 #define PSR_N 0x00800000
0022 #define PSR_VERS 0x0f000000
0023 #define PSR_IMPL 0xf0000000
0024
0025 #define PSR_V8PLUS 0xff000000
0026 #define PSR_XCC 0x000f0000
0027
0028 static inline unsigned int tstate_to_psr(unsigned long tstate)
0029 {
0030 return ((tstate & TSTATE_CWP) |
0031 PSR_S |
0032 ((tstate & TSTATE_ICC) >> 12) |
0033 ((tstate & TSTATE_XCC) >> 20) |
0034 ((tstate & TSTATE_SYSCALL) ? PSR_SYSCALL : 0) |
0035 PSR_V8PLUS);
0036 }
0037
0038 static inline unsigned long psr_to_tstate_icc(unsigned int psr)
0039 {
0040 unsigned long tstate = ((unsigned long)(psr & PSR_ICC)) << 12;
0041 if ((psr & (PSR_VERS|PSR_IMPL)) == PSR_V8PLUS)
0042 tstate |= ((unsigned long)(psr & PSR_XCC)) << 20;
0043 return tstate;
0044 }
0045
0046 #endif