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