18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* asmmacro.h: Assembler macros. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu) 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef _SPARC_ASMMACRO_H 88c2ecf20Sopenharmony_ci#define _SPARC_ASMMACRO_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* All trap entry points _must_ begin with this macro or else you 118c2ecf20Sopenharmony_ci * lose. It makes sure the kernel has a proper window so that 128c2ecf20Sopenharmony_ci * c-code can be called. 138c2ecf20Sopenharmony_ci */ 148c2ecf20Sopenharmony_ci#define SAVE_ALL_HEAD \ 158c2ecf20Sopenharmony_ci sethi %hi(trap_setup), %l4; \ 168c2ecf20Sopenharmony_ci jmpl %l4 + %lo(trap_setup), %l6; 178c2ecf20Sopenharmony_ci#define SAVE_ALL \ 188c2ecf20Sopenharmony_ci SAVE_ALL_HEAD \ 198c2ecf20Sopenharmony_ci nop; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci/* All traps low-level code here must end with this macro. */ 228c2ecf20Sopenharmony_ci#define RESTORE_ALL b ret_trap_entry; clr %l6; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* Support for run-time patching of single instructions. 258c2ecf20Sopenharmony_ci * This is used to handle the differences in the ASI for 268c2ecf20Sopenharmony_ci * MMUREGS for LEON and SUN. 278c2ecf20Sopenharmony_ci * 288c2ecf20Sopenharmony_ci * Sample: 298c2ecf20Sopenharmony_ci * LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %o0 308c2ecf20Sopenharmony_ci * SUN_PI_(lda [%g0] ASI_M_MMUREGS, %o0 318c2ecf20Sopenharmony_ci * PI == Patch Instruction 328c2ecf20Sopenharmony_ci * 338c2ecf20Sopenharmony_ci * For LEON we will use the first variant, 348c2ecf20Sopenharmony_ci * and for all other we will use the SUN variant. 358c2ecf20Sopenharmony_ci * The order is important. 368c2ecf20Sopenharmony_ci */ 378c2ecf20Sopenharmony_ci#define LEON_PI(...) \ 388c2ecf20Sopenharmony_ci662: __VA_ARGS__ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define SUN_PI_(...) \ 418c2ecf20Sopenharmony_ci .section .leon_1insn_patch, "ax"; \ 428c2ecf20Sopenharmony_ci .word 662b; \ 438c2ecf20Sopenharmony_ci __VA_ARGS__; \ 448c2ecf20Sopenharmony_ci .previous 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#endif /* !(_SPARC_ASMMACRO_H) */ 47