asmmacro.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* asmmacro.h: Assembler macros.
  2. *
  3. * Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu)
  4. */
  5. #ifndef _SPARC_ASMMACRO_H
  6. #define _SPARC_ASMMACRO_H
  7. #include <linux/config.h>
  8. #include <asm/btfixup.h>
  9. #include <asm/asi.h>
  10. #define GET_PROCESSOR4M_ID(reg) \
  11. rd %tbr, %reg; \
  12. srl %reg, 12, %reg; \
  13. and %reg, 3, %reg;
  14. #define GET_PROCESSOR4D_ID(reg) \
  15. lda [%g0] ASI_M_VIKING_TMP1, %reg;
  16. /* All trap entry points _must_ begin with this macro or else you
  17. * lose. It makes sure the kernel has a proper window so that
  18. * c-code can be called.
  19. */
  20. #define SAVE_ALL_HEAD \
  21. sethi %hi(trap_setup), %l4; \
  22. jmpl %l4 + %lo(trap_setup), %l6;
  23. #define SAVE_ALL \
  24. SAVE_ALL_HEAD \
  25. nop;
  26. /* All traps low-level code here must end with this macro. */
  27. #define RESTORE_ALL b ret_trap_entry; clr %l6;
  28. /* sun4 probably wants half word accesses to ASI_SEGMAP, while sun4c+
  29. likes byte accesses. These are to avoid ifdef mania. */
  30. #ifdef CONFIG_SUN4
  31. #define lduXa lduha
  32. #define stXa stha
  33. #else
  34. #define lduXa lduba
  35. #define stXa stba
  36. #endif
  37. #endif /* !(_SPARC_ASMMACRO_H) */