1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Address the Problems Caused by Incompatible Flavor of |
---|
5 | * Assemblers and Toolsets |
---|
6 | * |
---|
7 | * This include file attempts to address the problems |
---|
8 | * caused by incompatible flavors of assemblers and |
---|
9 | * toolsets. It primarily addresses variations in the |
---|
10 | * use of leading underscores on symbols and the requirement |
---|
11 | * that register names be preceded by a %. |
---|
12 | * |
---|
13 | * @note The spacing in the use of these macros |
---|
14 | * is critical to them working as advertised. |
---|
15 | */ |
---|
16 | |
---|
17 | /* |
---|
18 | * COPYRIGHT: |
---|
19 | * |
---|
20 | * This file is based on similar code found in newlib available |
---|
21 | * from ftp.cygnus.com. The file which was used had no copyright |
---|
22 | * notice. This file is freely distributable as long as the source |
---|
23 | * of the file is noted. This file is: |
---|
24 | * |
---|
25 | * COPYRIGHT (c) 1994-2012. |
---|
26 | * On-Line Applications Research Corporation (OAR). |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _RTEMS_ASM_H |
---|
30 | #define _RTEMS_ASM_H |
---|
31 | |
---|
32 | /* |
---|
33 | * Indicate we are in an assembly file and get the basic CPU definitions. |
---|
34 | */ |
---|
35 | |
---|
36 | #ifndef ASM |
---|
37 | #define ASM |
---|
38 | #endif |
---|
39 | #include <rtems/score/cpuopts.h> |
---|
40 | #include <rtems/score/no_cpu.h> |
---|
41 | |
---|
42 | #ifndef __USER_LABEL_PREFIX__ |
---|
43 | /** |
---|
44 | * Recent versions of GNU cpp define variables which indicate the |
---|
45 | * need for underscores and percents. If not using GNU cpp or |
---|
46 | * the version does not support this, then you will obviously |
---|
47 | * have to define these as appropriate. |
---|
48 | * |
---|
49 | * This symbol is prefixed to all C program symbols. |
---|
50 | */ |
---|
51 | #define __USER_LABEL_PREFIX__ _ |
---|
52 | #endif |
---|
53 | |
---|
54 | #ifndef __REGISTER_PREFIX__ |
---|
55 | /** |
---|
56 | * Recent versions of GNU cpp define variables which indicate the |
---|
57 | * need for underscores and percents. If not using GNU cpp or |
---|
58 | * the version does not support this, then you will obviously |
---|
59 | * have to define these as appropriate. |
---|
60 | * |
---|
61 | * This symbol is prefixed to all register names. |
---|
62 | */ |
---|
63 | #define __REGISTER_PREFIX__ |
---|
64 | #endif |
---|
65 | |
---|
66 | #include <rtems/concat.h> |
---|
67 | |
---|
68 | /** Use the right prefix for global labels. */ |
---|
69 | #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) |
---|
70 | |
---|
71 | /** Use the right prefix for registers. */ |
---|
72 | #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) |
---|
73 | |
---|
74 | /* |
---|
75 | * define macros for all of the registers on this CPU |
---|
76 | * |
---|
77 | * EXAMPLE: #define d0 REG (d0) |
---|
78 | */ |
---|
79 | |
---|
80 | /* |
---|
81 | * Define macros to handle section beginning and ends. |
---|
82 | */ |
---|
83 | |
---|
84 | |
---|
85 | /** This macro is used to denote the beginning of a code declaration. */ |
---|
86 | #define BEGIN_CODE_DCL .text |
---|
87 | /** This macro is used to denote the end of a code declaration. */ |
---|
88 | #define END_CODE_DCL |
---|
89 | /** This macro is used to denote the beginning of a data declaration section. */ |
---|
90 | #define BEGIN_DATA_DCL .data |
---|
91 | /** This macro is used to denote the end of a data declaration section. */ |
---|
92 | #define END_DATA_DCL |
---|
93 | /** This macro is used to denote the beginning of a code section. */ |
---|
94 | #define BEGIN_CODE .text |
---|
95 | /** This macro is used to denote the end of a code section. */ |
---|
96 | #define END_CODE |
---|
97 | /** This macro is used to denote the beginning of a data section. */ |
---|
98 | #define BEGIN_DATA |
---|
99 | /** This macro is used to denote the end of a data section. */ |
---|
100 | #define END_DATA |
---|
101 | /** |
---|
102 | * This macro is used to denote the beginning of the |
---|
103 | * unitialized data section. |
---|
104 | */ |
---|
105 | #define BEGIN_BSS |
---|
106 | /** This macro is used to denote the end of the unitialized data section. */ |
---|
107 | #define END_BSS |
---|
108 | /** This macro is used to denote the end of the assembly file. */ |
---|
109 | #define END |
---|
110 | |
---|
111 | /** |
---|
112 | * This macro is used to declare a public global symbol. |
---|
113 | * |
---|
114 | * @note This must be tailored for a particular flavor of the C compiler. |
---|
115 | * They may need to put underscores in front of the symbols. |
---|
116 | */ |
---|
117 | #define PUBLIC(sym) .globl SYM (sym) |
---|
118 | |
---|
119 | /** |
---|
120 | * This macro is used to prototype a public global symbol. |
---|
121 | * |
---|
122 | * @note This must be tailored for a particular flavor of the C compiler. |
---|
123 | * They may need to put underscores in front of the symbols. |
---|
124 | */ |
---|
125 | #define EXTERN(sym) .globl SYM (sym) |
---|
126 | |
---|
127 | #endif |
---|