asmmacro.h 1.2 KB

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