Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* asmmacro.h: Assembler macros.
0003  *
0004  * Copyright (C) 1996 David S. Miller (davem@caipfs.rutgers.edu)
0005  */
0006 
0007 #ifndef _SPARC_ASMMACRO_H
0008 #define _SPARC_ASMMACRO_H
0009 
0010 /* All trap entry points _must_ begin with this macro or else you
0011  * lose.  It makes sure the kernel has a proper window so that
0012  * c-code can be called.
0013  */
0014 #define SAVE_ALL_HEAD \
0015     sethi   %hi(trap_setup), %l4; \
0016     jmpl    %l4 + %lo(trap_setup), %l6;
0017 #define SAVE_ALL \
0018     SAVE_ALL_HEAD \
0019      nop;
0020 
0021 /* All traps low-level code here must end with this macro. */
0022 #define RESTORE_ALL b ret_trap_entry; clr %l6;
0023 
0024 /* Support for run-time patching of single instructions.
0025  * This is used to handle the differences in the ASI for
0026  * MMUREGS for LEON and SUN.
0027  *
0028  * Sample:
0029  * LEON_PI(lda [%g0] ASI_LEON_MMUREGS, %o0
0030  * SUN_PI_(lda [%g0] ASI_M_MMUREGS, %o0
0031  * PI == Patch Instruction
0032  *
0033  * For LEON we will use the first variant,
0034  * and for all other we will use the SUN variant.
0035  * The order is important.
0036  */
0037 #define LEON_PI(...)                \
0038 662:    __VA_ARGS__
0039 
0040 #define SUN_PI_(...)                \
0041     .section .leon_1insn_patch, "ax";   \
0042     .word 662b;             \
0043     __VA_ARGS__;                \
0044     .previous
0045 
0046 #endif /* !(_SPARC_ASMMACRO_H) */