|
1 | 1 | /* |
2 | | - * This file is subject to the terms and conditions of the GNU General Public |
3 | | - * License. See the file "COPYING" in the main directory of this archive |
4 | | - * for more details. |
| 2 | + * Assembly Macros For MIPS |
5 | 3 | * |
6 | | - * Copyright (C) 1995, 1996, 1997, 1999, 2001 by Ralf Baechle |
7 | | - * Copyright (C) 1999 by Silicon Graphics, Inc. |
8 | | - * Copyright (C) 2001 MIPS Technologies, Inc. |
9 | | - * Copyright (C) 2002 Maciej W. Rozycki |
| 4 | + * Copyright (c) 2006-2019, RT-Thread Development Team |
10 | 5 | * |
11 | | - * Some useful macros for MIPS assembler code |
| 6 | + * SPDX-License-Identifier: Apache-2.0 |
12 | 7 | * |
13 | | - * Some of the routines below contain useless nops that will be optimized |
14 | | - * away by gas in -O mode. These nops are however required to fill delay |
15 | | - * slots in noreorder mode. |
| 8 | + * Change Logs: |
| 9 | + * Date Author Notes |
| 10 | + * 2019-12-04 Jiaxun Yang Initial version |
16 | 11 | */ |
| 12 | + |
| 13 | + |
17 | 14 | #ifndef __ASM_H__ |
18 | 15 | #define __ASM_H__ |
19 | 16 |
|
20 | 17 | /* |
21 | 18 | * LEAF - declare leaf routine |
22 | 19 | */ |
23 | 20 | #define LEAF(symbol) \ |
24 | | - .globl symbol; \ |
25 | | - .align 2; \ |
26 | | - .type symbol,@function; \ |
27 | | - .ent symbol,0; \ |
| 21 | + .globl symbol; \ |
| 22 | + .align 2; \ |
| 23 | + .type symbol,@function; \ |
| 24 | + .ent symbol,0; \ |
28 | 25 | symbol: .frame sp,0,ra |
29 | 26 |
|
30 | 27 | /* |
31 | 28 | * NESTED - declare nested routine entry point |
32 | 29 | */ |
33 | 30 | #define NESTED(symbol, framesize, rpc) \ |
34 | | - .globl symbol; \ |
35 | | - .align 2; \ |
36 | | - .type symbol,@function; \ |
37 | | - .ent symbol,0; \ |
| 31 | + .globl symbol; \ |
| 32 | + .align 2; \ |
| 33 | + .type symbol,@function; \ |
| 34 | + .ent symbol,0; \ |
38 | 35 | symbol: .frame sp, framesize, rpc |
39 | 36 |
|
40 | 37 | /* |
41 | 38 | * END - mark end of function |
42 | 39 | */ |
43 | 40 | #define END(function) \ |
44 | | - .end function; \ |
45 | | - .size function,.-function |
| 41 | + .end function; \ |
| 42 | + .size function,.-function |
46 | 43 |
|
47 | 44 | /* |
48 | 45 | * EXPORT - export definition of symbol |
49 | 46 | */ |
50 | 47 | #define EXPORT(symbol) \ |
51 | | - .globl symbol; \ |
| 48 | + .globl symbol; \ |
52 | 49 | symbol: |
53 | 50 |
|
54 | 51 | /* |
55 | 52 | * FEXPORT - export definition of a function symbol |
56 | 53 | */ |
57 | 54 | #define FEXPORT(symbol) \ |
58 | | - .globl symbol; \ |
59 | | - .type symbol,@function; \ |
| 55 | + .globl symbol; \ |
| 56 | + .type symbol,@function; \ |
60 | 57 | symbol: |
61 | 58 |
|
62 | 59 | /* |
63 | 60 | * Global data declaration with size. |
64 | 61 | */ |
65 | 62 | #define EXPORTS(name,sz) \ |
66 | | - .globl name; \ |
67 | | - .type name,@object; \ |
68 | | - .size name,sz; \ |
| 63 | + .globl name; \ |
| 64 | + .type name,@object; \ |
| 65 | + .size name,sz; \ |
69 | 66 | name: |
70 | 67 |
|
71 | 68 | /* |
72 | 69 | * Weak data declaration with size. |
73 | 70 | */ |
74 | 71 | #define WEXPORT(name,sz) \ |
75 | | - .weakext name; \ |
76 | | - .type name,@object; \ |
77 | | - .size name,sz; \ |
| 72 | + .weakext name; \ |
| 73 | + .type name,@object; \ |
| 74 | + .size name,sz; \ |
78 | 75 | name: |
79 | 76 |
|
80 | 77 | /* |
81 | 78 | * Global data reference with size. |
82 | 79 | */ |
83 | 80 | #define IMPORT(name, size) \ |
84 | | - .extern name,size |
| 81 | + .extern name,size |
85 | 82 |
|
86 | 83 | /* |
87 | 84 | * Global zeroed data. |
88 | 85 | */ |
89 | 86 | #define BSS(name,size) \ |
90 | | - .type name,@object; \ |
91 | | - .comm name,size |
| 87 | + .type name,@object; \ |
| 88 | + .comm name,size |
92 | 89 |
|
93 | 90 | /* |
94 | 91 | * Local zeroed data. |
95 | 92 | */ |
96 | 93 | #define LBSS(name,size) \ |
97 | | - .lcomm name,size |
| 94 | + .lcomm name,size |
98 | 95 |
|
99 | 96 |
|
100 | 97 | /* |
101 | 98 | * ABS - export absolute symbol |
102 | 99 | */ |
103 | 100 | #define ABS(symbol,value) \ |
104 | | - .globl symbol; \ |
| 101 | + .globl symbol; \ |
105 | 102 | symbol = value |
106 | 103 |
|
107 | 104 |
|
108 | 105 | #define TEXT(msg) \ |
109 | | - .pushsection .data; \ |
| 106 | + .pushsection .data; \ |
110 | 107 | 8: .asciiz msg; \ |
111 | | - .popsection; |
| 108 | + .popsection; |
112 | 109 |
|
113 | 110 |
|
114 | 111 | #define ENTRY(name) \ |
|
0 commit comments