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