asmmacro.h 1.1 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. /* All trap entry points _must_ begin with this macro or else you
  8. * lose. It makes sure the kernel has a proper window so that
  9. * c-code can be called.
  10. */
  11. #define SAVE_ALL_HEAD \
  12. sethi %hi(trap_setup), %l4; \
  13. jmpl %l4 + %lo(trap_setup), %l6;
  14. #define SAVE_ALL \
  15. SAVE_ALL_HEAD \
  16. nop;
  17. /* All traps low-level code here must end with this macro. */
  18. #define RESTORE_ALL b ret_trap_entry; clr %l6;
  19. /* Support for run-time patching of single instructions.
  20. * This is used to handle the differences in the ASI for
  21. * MMUREGS for LEON and SUN.
  22. *
  23. * Sample:
  24. * LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %o0
  25. * SUN_PI_(lda [%g0] ASI_M_MMUREGS, %o0
  26. * PI == Patch Instruction
  27. *
  28. * For LEON we will use the first variant,
  29. * and for all other we will use the SUN variant.
  30. * The order is important.
  31. */
  32. #define LEON_PI(...) \
  33. 662: __VA_ARGS__
  34. #define SUN_PI_(...) \
  35. .section .leon_1insn_patch, "ax"; \
  36. .word 662b; \
  37. __VA_ARGS__; \
  38. .previous
  39. #endif /* !(_SPARC_ASMMACRO_H) */