1 | /* asm.h |
---|
2 | * |
---|
3 | * This include file attempts to address the problems |
---|
4 | * caused by incompatible flavors of assemblers and |
---|
5 | * toolsets. It primarily addresses variations in the |
---|
6 | * use of leading underscores on symbols and the requirement |
---|
7 | * that register names be preceded by a %. |
---|
8 | * |
---|
9 | * |
---|
10 | * NOTE: The spacing in the use of these macros |
---|
11 | * is critical to them working as advertised. |
---|
12 | * |
---|
13 | * COPYRIGHT: |
---|
14 | * |
---|
15 | * This file is based on similar code found in newlib available |
---|
16 | * from ftp.cygnus.com. The file which was used had no copyright |
---|
17 | * notice. This file is freely distributable as long as the source |
---|
18 | * of the file is noted. This file is: |
---|
19 | * |
---|
20 | * COPYRIGHT (c) 1994. |
---|
21 | * On-Line Applications Research Corporation (OAR). |
---|
22 | * |
---|
23 | * $Id$ |
---|
24 | */ |
---|
25 | |
---|
26 | #ifndef __i386_ASM_h |
---|
27 | #define __i386_ASM_h |
---|
28 | |
---|
29 | /* |
---|
30 | * Indicate we are in an assembly file and get the basic CPU definitions. |
---|
31 | */ |
---|
32 | |
---|
33 | #define ASM |
---|
34 | #include <rtems/core/i386.h> |
---|
35 | |
---|
36 | /* |
---|
37 | * Recent versions of GNU cpp define variables which indicate the |
---|
38 | * need for underscores and percents. If not using GNU cpp or |
---|
39 | * the version does not support this, then you will obviously |
---|
40 | * have to define these as appropriate. |
---|
41 | */ |
---|
42 | |
---|
43 | /* |
---|
44 | * Go32 suffers the same bug as __REGISTER_PREFIX__ |
---|
45 | */ |
---|
46 | |
---|
47 | #if __GO32__ |
---|
48 | #undef __USER_LABEL_PREFIX__ |
---|
49 | #define __USER_LABEL_PREFIX__ _ |
---|
50 | #endif |
---|
51 | |
---|
52 | #ifndef __USER_LABEL_PREFIX__ |
---|
53 | #define __USER_LABEL_PREFIX__ _ |
---|
54 | #endif |
---|
55 | |
---|
56 | /* |
---|
57 | * Looks like there is a bug in gcc 2.6.2 where this is not |
---|
58 | * defined correctly when configured as i386-coff and |
---|
59 | * i386-aout. |
---|
60 | */ |
---|
61 | |
---|
62 | #undef __REGISTER_PREFIX__ |
---|
63 | #define __REGISTER_PREFIX__ % |
---|
64 | |
---|
65 | /* |
---|
66 | #ifndef __REGISTER_PREFIX__ |
---|
67 | #define __REGISTER_PREFIX__ |
---|
68 | #endif |
---|
69 | */ |
---|
70 | |
---|
71 | /* ANSI concatenation macros. */ |
---|
72 | |
---|
73 | #define CONCAT1(a, b) CONCAT2(a, b) |
---|
74 | #define CONCAT2(a, b) a ## b |
---|
75 | |
---|
76 | /* Use the right prefix for global labels. */ |
---|
77 | |
---|
78 | #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) |
---|
79 | |
---|
80 | /* Use the right prefix for registers. */ |
---|
81 | |
---|
82 | #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) |
---|
83 | |
---|
84 | #define eax REG (eax) |
---|
85 | #define ebx REG (ebx) |
---|
86 | #define ecx REG (ecx) |
---|
87 | #define edx REG (edx) |
---|
88 | #define esi REG (esi) |
---|
89 | #define edi REG (edi) |
---|
90 | #define esp REG (esp) |
---|
91 | #define ebp REG (ebp) |
---|
92 | |
---|
93 | #define ax REG (ax) |
---|
94 | #define bx REG (bx) |
---|
95 | #define cx REG (cx) |
---|
96 | #define dx REG (dx) |
---|
97 | #define si REG (si) |
---|
98 | #define di REG (di) |
---|
99 | #define sp REG (sp) |
---|
100 | #define bp REG (bp) |
---|
101 | |
---|
102 | #define ah REG (ah) |
---|
103 | #define al REG (al) |
---|
104 | |
---|
105 | #define cs REG (cs) |
---|
106 | #define ds REG (ds) |
---|
107 | #define es REG (es) |
---|
108 | #define fs REG (fs) |
---|
109 | #define gs REG (gs) |
---|
110 | #define ss REG (ss) |
---|
111 | |
---|
112 | /* |
---|
113 | * Define macros to handle section beginning and ends. |
---|
114 | */ |
---|
115 | |
---|
116 | |
---|
117 | #define BEGIN_CODE_DCL .text |
---|
118 | #define END_CODE_DCL |
---|
119 | #define BEGIN_DATA_DCL .data |
---|
120 | #define END_DATA_DCL |
---|
121 | #define BEGIN_CODE .text |
---|
122 | #define END_CODE |
---|
123 | #define BEGIN_DATA |
---|
124 | #define END_DATA |
---|
125 | #define BEGIN_BSS |
---|
126 | #define END_BSS |
---|
127 | #define END |
---|
128 | |
---|
129 | /* |
---|
130 | * Following must be tailor for a particular flavor of the C compiler. |
---|
131 | * They may need to put underscores in front of the symbols. |
---|
132 | */ |
---|
133 | |
---|
134 | #define PUBLIC(sym) .globl SYM (sym) |
---|
135 | #define EXTERN(sym) .globl SYM (sym) |
---|
136 | |
---|
137 | #endif |
---|
138 | /* end of include file */ |
---|
139 | |
---|
140 | |
---|