xref: /openbmc/linux/arch/mips/include/asm/sim.h (revision 96a68b14)
1384740dcSRalf Baechle /*
2384740dcSRalf Baechle  * This file is subject to the terms and conditions of the GNU General Public
3384740dcSRalf Baechle  * License.  See the file "COPYING" in the main directory of this archive
4384740dcSRalf Baechle  * for more details.
5384740dcSRalf Baechle  *
6384740dcSRalf Baechle  * Copyright (C) 1999, 2000, 2003 Ralf Baechle
7384740dcSRalf Baechle  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
8384740dcSRalf Baechle  */
9384740dcSRalf Baechle #ifndef _ASM_SIM_H
10384740dcSRalf Baechle #define _ASM_SIM_H
11384740dcSRalf Baechle 
12384740dcSRalf Baechle 
13384740dcSRalf Baechle #include <asm/asm-offsets.h>
14384740dcSRalf Baechle 
15384740dcSRalf Baechle #define __str2(x) #x
16384740dcSRalf Baechle #define __str(x) __str2(x)
17384740dcSRalf Baechle 
18384740dcSRalf Baechle #ifdef CONFIG_32BIT
19384740dcSRalf Baechle 
20384740dcSRalf Baechle #define save_static_function(symbol)					\
21384740dcSRalf Baechle __asm__(								\
22384740dcSRalf Baechle 	".text\n\t"							\
2350150d2bSAl Viro 	".globl\t__" #symbol "\n\t"					\
24384740dcSRalf Baechle 	".align\t2\n\t"							\
2550150d2bSAl Viro 	".type\t__" #symbol ", @function\n\t"				\
2650150d2bSAl Viro 	".ent\t__" #symbol ", 0\n__"					\
27384740dcSRalf Baechle 	#symbol":\n\t"							\
28384740dcSRalf Baechle 	".frame\t$29, 0, $31\n\t"					\
29384740dcSRalf Baechle 	"sw\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t"	\
30384740dcSRalf Baechle 	"sw\t$17,"__str(PT_R17)"($29)\n\t"				\
31384740dcSRalf Baechle 	"sw\t$18,"__str(PT_R18)"($29)\n\t"				\
32384740dcSRalf Baechle 	"sw\t$19,"__str(PT_R19)"($29)\n\t"				\
33384740dcSRalf Baechle 	"sw\t$20,"__str(PT_R20)"($29)\n\t"				\
34384740dcSRalf Baechle 	"sw\t$21,"__str(PT_R21)"($29)\n\t"				\
35384740dcSRalf Baechle 	"sw\t$22,"__str(PT_R22)"($29)\n\t"				\
36384740dcSRalf Baechle 	"sw\t$23,"__str(PT_R23)"($29)\n\t"				\
37384740dcSRalf Baechle 	"sw\t$30,"__str(PT_R30)"($29)\n\t"				\
3850150d2bSAl Viro 	"j\t" #symbol "\n\t"						\
3950150d2bSAl Viro 	".end\t__" #symbol "\n\t"					\
4050150d2bSAl Viro 	".size\t__" #symbol",. - __" #symbol)
41384740dcSRalf Baechle 
42384740dcSRalf Baechle #endif /* CONFIG_32BIT */
43384740dcSRalf Baechle 
44384740dcSRalf Baechle #ifdef CONFIG_64BIT
45384740dcSRalf Baechle 
46384740dcSRalf Baechle #define save_static_function(symbol)					\
47384740dcSRalf Baechle __asm__(								\
48384740dcSRalf Baechle 	".text\n\t"							\
4950150d2bSAl Viro 	".globl\t__" #symbol "\n\t"					\
50384740dcSRalf Baechle 	".align\t2\n\t"							\
5150150d2bSAl Viro 	".type\t__" #symbol ", @function\n\t"				\
5250150d2bSAl Viro 	".ent\t__" #symbol ", 0\n__"					\
53384740dcSRalf Baechle 	#symbol":\n\t"							\
54384740dcSRalf Baechle 	".frame\t$29, 0, $31\n\t"					\
55384740dcSRalf Baechle 	"sd\t$16,"__str(PT_R16)"($29)\t\t\t# save_static_function\n\t"	\
56384740dcSRalf Baechle 	"sd\t$17,"__str(PT_R17)"($29)\n\t"				\
57384740dcSRalf Baechle 	"sd\t$18,"__str(PT_R18)"($29)\n\t"				\
58384740dcSRalf Baechle 	"sd\t$19,"__str(PT_R19)"($29)\n\t"				\
59384740dcSRalf Baechle 	"sd\t$20,"__str(PT_R20)"($29)\n\t"				\
60384740dcSRalf Baechle 	"sd\t$21,"__str(PT_R21)"($29)\n\t"				\
61384740dcSRalf Baechle 	"sd\t$22,"__str(PT_R22)"($29)\n\t"				\
62384740dcSRalf Baechle 	"sd\t$23,"__str(PT_R23)"($29)\n\t"				\
63384740dcSRalf Baechle 	"sd\t$30,"__str(PT_R30)"($29)\n\t"				\
6450150d2bSAl Viro 	"j\t" #symbol "\n\t"						\
6550150d2bSAl Viro 	".end\t__" #symbol "\n\t"					\
6650150d2bSAl Viro 	".size\t__" #symbol",. - __" #symbol)
67384740dcSRalf Baechle 
68384740dcSRalf Baechle #endif /* CONFIG_64BIT */
69384740dcSRalf Baechle 
70384740dcSRalf Baechle #endif /* _ASM_SIM_H */
71