head_64.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef _SPARC64_HEAD_H
  2. #define _SPARC64_HEAD_H
  3. #include <asm/pstate.h>
  4. /* wrpr %g0, val, %gl */
  5. #define SET_GL(val) \
  6. .word 0xa1902000 | val
  7. /* rdpr %gl, %gN */
  8. #define GET_GL_GLOBAL(N) \
  9. .word 0x81540000 | (N << 25)
  10. #define KERNBASE 0x400000
  11. #define PTREGS_OFF (STACK_BIAS + STACKFRAME_SZ)
  12. #define RTRAP_PSTATE (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV|PSTATE_IE)
  13. #define RTRAP_PSTATE_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV)
  14. #define RTRAP_PSTATE_AG_IRQOFF (PSTATE_TSO|PSTATE_PEF|PSTATE_PRIV|PSTATE_AG)
  15. #define __CHEETAH_ID 0x003e0014
  16. #define __JALAPENO_ID 0x003e0016
  17. #define __SERRANO_ID 0x003e0022
  18. #define CHEETAH_MANUF 0x003e
  19. #define CHEETAH_IMPL 0x0014 /* Ultra-III */
  20. #define CHEETAH_PLUS_IMPL 0x0015 /* Ultra-III+ */
  21. #define JALAPENO_IMPL 0x0016 /* Ultra-IIIi */
  22. #define JAGUAR_IMPL 0x0018 /* Ultra-IV */
  23. #define PANTHER_IMPL 0x0019 /* Ultra-IV+ */
  24. #define SERRANO_IMPL 0x0022 /* Ultra-IIIi+ */
  25. #define BRANCH_IF_SUN4V(tmp1,label) \
  26. sethi %hi(is_sun4v), %tmp1; \
  27. lduw [%tmp1 + %lo(is_sun4v)], %tmp1; \
  28. brnz,pn %tmp1, label; \
  29. nop
  30. #define BRANCH_IF_CHEETAH_BASE(tmp1,tmp2,label) \
  31. rdpr %ver, %tmp1; \
  32. sethi %hi(__CHEETAH_ID), %tmp2; \
  33. srlx %tmp1, 32, %tmp1; \
  34. or %tmp2, %lo(__CHEETAH_ID), %tmp2;\
  35. cmp %tmp1, %tmp2; \
  36. be,pn %icc, label; \
  37. nop;
  38. #define BRANCH_IF_JALAPENO(tmp1,tmp2,label) \
  39. rdpr %ver, %tmp1; \
  40. sethi %hi(__JALAPENO_ID), %tmp2; \
  41. srlx %tmp1, 32, %tmp1; \
  42. or %tmp2, %lo(__JALAPENO_ID), %tmp2;\
  43. cmp %tmp1, %tmp2; \
  44. be,pn %icc, label; \
  45. nop;
  46. #define BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(tmp1,tmp2,label) \
  47. rdpr %ver, %tmp1; \
  48. srlx %tmp1, (32 + 16), %tmp2; \
  49. cmp %tmp2, CHEETAH_MANUF; \
  50. bne,pt %xcc, 99f; \
  51. sllx %tmp1, 16, %tmp1; \
  52. srlx %tmp1, (32 + 16), %tmp2; \
  53. cmp %tmp2, CHEETAH_PLUS_IMPL; \
  54. bgeu,pt %xcc, label; \
  55. 99: nop;
  56. #define BRANCH_IF_ANY_CHEETAH(tmp1,tmp2,label) \
  57. rdpr %ver, %tmp1; \
  58. srlx %tmp1, (32 + 16), %tmp2; \
  59. cmp %tmp2, CHEETAH_MANUF; \
  60. bne,pt %xcc, 99f; \
  61. sllx %tmp1, 16, %tmp1; \
  62. srlx %tmp1, (32 + 16), %tmp2; \
  63. cmp %tmp2, CHEETAH_IMPL; \
  64. bgeu,pt %xcc, label; \
  65. 99: nop;
  66. #endif /* !(_SPARC64_HEAD_H) */