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.
24  */
25 
26 #ifndef _RTEMS_ASM_H
27 #define _RTEMS_ASM_H
28 
29 /*
30  * Indicate we are in an assembly file and get the basic CPU definitions.
31  */
32 
33 #ifndef ASM
34 #define ASM
35 #endif
36 #ifndef __ASM__
37 #define __ASM__
38 #endif
39 
40 #include <rtems/score/cpuopts.h>
41 #include <rtems/score/cpu.h>
42 
53 /*
54  * Recent versions of GNU cpp define variables which indicate the
55  * need for underscores and percents. If not using GNU cpp or
56  * the version does not support this, then you will obviously
57  * have to define these as appropriate.
58  */
59 
60 /* XXX __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ do not work on gcc 2.7.0 */
61 /* XXX The following ifdef magic fixes the problem but results in a warning */
62 /* XXX when compiling assembly code. */
63 
64 #ifndef __USER_LABEL_PREFIX__
65 #define __USER_LABEL_PREFIX__ _
66 #endif
67 
68 #ifndef __REGISTER_PREFIX__
69 #define __REGISTER_PREFIX__
70 #endif
71 
72 #include <rtems/concat.h>
73 
74 /* Use the right prefix for global labels. */
75 
76 #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
77 
78 /* Use the right prefix for registers. */
79 
80 #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
81 
82 /*
83  * define macros for all of the registers on this CPU
84  *
85  * EXAMPLE: #define d0 REG (d0)
86  */
87 
88 /*
89  * Define macros to handle section beginning and ends.
90  */
91 
92 
93 #define BEGIN_CODE_DCL .text
94 #define END_CODE_DCL
95 #define BEGIN_DATA_DCL .data
96 #define END_DATA_DCL
97 #define BEGIN_CODE .text
98 #define END_CODE
99 #define BEGIN_DATA
100 #define END_DATA
101 #define BEGIN_BSS
102 #define END_BSS
103 #define END
104 
105 /*
106  * Following must be tailor for a particular flavor of the C compiler.
107  * They may need to put underscores in front of the symbols.
108  */
109 
110 #define PUBLIC(sym) .globl SYM (sym)
111 #define EXTERN(sym) .globl SYM (sym)
112 
113 #endif
114