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-1997. |
---|
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/i386.h> |
---|
41 | |
---|
42 | /* |
---|
43 | * Recent versions of GNU cpp define variables which indicate the |
---|
44 | * need for underscores and percents. If not using GNU cpp or |
---|
45 | * the version does not support this, then you will obviously |
---|
46 | * have to define these as appropriate. |
---|
47 | */ |
---|
48 | |
---|
49 | #ifndef __USER_LABEL_PREFIX__ |
---|
50 | #define __USER_LABEL_PREFIX__ |
---|
51 | #endif |
---|
52 | |
---|
53 | /* |
---|
54 | * Looks like there is a bug in gcc 2.6.2 where this is not |
---|
55 | * defined correctly when configured as i386-coff and |
---|
56 | * i386-aout. |
---|
57 | */ |
---|
58 | |
---|
59 | #undef __REGISTER_PREFIX__ |
---|
60 | #define __REGISTER_PREFIX__ % |
---|
61 | |
---|
62 | /* |
---|
63 | #ifndef __REGISTER_PREFIX__ |
---|
64 | #define __REGISTER_PREFIX__ |
---|
65 | #endif |
---|
66 | */ |
---|
67 | |
---|
68 | #include <rtems/concat.h> |
---|
69 | |
---|
70 | /* Use the right prefix for global labels. */ |
---|
71 | |
---|
72 | #define SYM(x) CONCAT0 (__USER_LABEL_PREFIX__, x) |
---|
73 | |
---|
74 | /* Use the right prefix for registers. */ |
---|
75 | |
---|
76 | #define REG(x) CONCAT0 (__REGISTER_PREFIX__, x) |
---|
77 | |
---|
78 | #define eax REG (eax) |
---|
79 | #define ebx REG (ebx) |
---|
80 | #define ecx REG (ecx) |
---|
81 | #define edx REG (edx) |
---|
82 | #define esi REG (esi) |
---|
83 | #define edi REG (edi) |
---|
84 | #define esp REG (esp) |
---|
85 | #define ebp REG (ebp) |
---|
86 | #define cr0 REG (cr0) |
---|
87 | #define cr4 REG (cr4) |
---|
88 | |
---|
89 | #define ax REG (ax) |
---|
90 | #define bx REG (bx) |
---|
91 | #define cx REG (cx) |
---|
92 | #define dx REG (dx) |
---|
93 | #define si REG (si) |
---|
94 | #define di REG (di) |
---|
95 | #define sp REG (sp) |
---|
96 | #define bp REG (bp) |
---|
97 | |
---|
98 | #define ah REG (ah) |
---|
99 | #define bh REG (bh) |
---|
100 | #define ch REG (ch) |
---|
101 | #define dh REG (dh) |
---|
102 | |
---|
103 | #define al REG (al) |
---|
104 | #define bl REG (bl) |
---|
105 | #define cl REG (cl) |
---|
106 | #define dl REG (dl) |
---|
107 | |
---|
108 | #define cs REG (cs) |
---|
109 | #define ds REG (ds) |
---|
110 | #define es REG (es) |
---|
111 | #define fs REG (fs) |
---|
112 | #define gs REG (gs) |
---|
113 | #define ss REG (ss) |
---|
114 | |
---|
115 | /* |
---|
116 | * Define macros to handle section beginning and ends. |
---|
117 | */ |
---|
118 | |
---|
119 | |
---|
120 | #define BEGIN_CODE_DCL .text |
---|
121 | #define END_CODE_DCL |
---|
122 | #define BEGIN_DATA_DCL .data |
---|
123 | #define END_DATA_DCL |
---|
124 | #define BEGIN_CODE .text |
---|
125 | #define END_CODE |
---|
126 | #define BEGIN_DATA .data |
---|
127 | #define END_DATA |
---|
128 | #define BEGIN_BSS .bss |
---|
129 | #define END_BSS |
---|
130 | #define END |
---|
131 | |
---|
132 | /* |
---|
133 | * Following must be tailor for a particular flavor of the C compiler. |
---|
134 | * They may need to put underscores in front of the symbols. |
---|
135 | */ |
---|
136 | |
---|
137 | #define PUBLIC(sym) .globl SYM (sym) |
---|
138 | #define EXTERN(sym) .globl SYM (sym) |
---|
139 | |
---|
140 | #endif |
---|