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 | * |
---|
21 | * COPYRIGHT (c) 1989-1999. |
---|
22 | * On-Line Applications Research Corporation (OAR). |
---|
23 | * |
---|
24 | * The license and distribution terms for this file may be |
---|
25 | * found in the file LICENSE in this distribution or at |
---|
26 | * http://www.OARcorp.com/rtems/license.html. |
---|
27 | * |
---|
28 | * $Id$ |
---|
29 | */ |
---|
30 | |
---|
31 | #ifndef __H8300_CPU_ASM_h |
---|
32 | #define __H8300_CPU_ASM_h |
---|
33 | |
---|
34 | /* |
---|
35 | * Indicate we are in an assembly file and get the basic CPU definitions. |
---|
36 | */ |
---|
37 | |
---|
38 | #define ASM |
---|
39 | #include <rtems/score/h8300.h> |
---|
40 | |
---|
41 | /* |
---|
42 | * Recent versions of GNU cpp define variables which indicate the |
---|
43 | * need for underscores and percents. If not using GNU cpp or |
---|
44 | * the version does not support this, then you will obviously |
---|
45 | * have to define these as appropriate. |
---|
46 | */ |
---|
47 | |
---|
48 | #ifndef __USER_LABEL_PREFIX__ |
---|
49 | #define __USER_LABEL_PREFIX__ _ |
---|
50 | #endif |
---|
51 | |
---|
52 | #ifndef __REGISTER_PREFIX__ |
---|
53 | #define __REGISTER_PREFIX__ |
---|
54 | #endif |
---|
55 | |
---|
56 | /* ANSI concatenation macros. */ |
---|
57 | |
---|
58 | #define CONCAT1(a, b) CONCAT2(a, b) |
---|
59 | #define CONCAT2(a, b) a ## b |
---|
60 | |
---|
61 | /* Use the right prefix for global labels. */ |
---|
62 | |
---|
63 | #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) |
---|
64 | |
---|
65 | /* Use the right prefix for registers. */ |
---|
66 | |
---|
67 | #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) |
---|
68 | |
---|
69 | /* |
---|
70 | * define macros for all of the registers on this CPU |
---|
71 | * |
---|
72 | * EXAMPLE: #define d0 REG (d0) |
---|
73 | */ |
---|
74 | #define r0 REG(r0) |
---|
75 | #define r1 REG(r1) |
---|
76 | #define r2 REG(r2) |
---|
77 | #define r3 REG(r3) |
---|
78 | #define r4 REG(r4) |
---|
79 | #define r5 REG(r5) |
---|
80 | #define r6 REG(r6) |
---|
81 | #define r7 REG(r7) |
---|
82 | |
---|
83 | #define er0 REG(er0) |
---|
84 | #define er1 REG(er1) |
---|
85 | #define er2 REG(er2) |
---|
86 | #define er3 REG(er3) |
---|
87 | #define er4 REG(er4) |
---|
88 | #define er5 REG(er5) |
---|
89 | #define er6 REG(er6) |
---|
90 | #define er7 REG(er7) |
---|
91 | |
---|
92 | #define sp REG(sp) |
---|
93 | |
---|
94 | /* |
---|
95 | * Define macros to handle section beginning and ends. |
---|
96 | */ |
---|
97 | |
---|
98 | |
---|
99 | #define BEGIN_CODE_DCL .text |
---|
100 | #define END_CODE_DCL |
---|
101 | #define BEGIN_DATA_DCL .data |
---|
102 | #define END_DATA_DCL |
---|
103 | #define BEGIN_CODE asm ( ".text |
---|
104 | #define END_CODE "); |
---|
105 | #define BEGIN_DATA |
---|
106 | #define END_DATA |
---|
107 | #define BEGIN_BSS |
---|
108 | #define END_BSS |
---|
109 | #define END |
---|
110 | |
---|
111 | /* |
---|
112 | * Following must be tailor for a particular flavor of the C compiler. |
---|
113 | * They may need to put underscores in front of the symbols. |
---|
114 | */ |
---|
115 | |
---|
116 | #define PUBLIC(sym) .globl SYM (sym) |
---|
117 | #define EXTERN(sym) .globl SYM (sym) |
---|
118 | |
---|
119 | #endif |
---|
120 | /* end of include file */ |
---|
121 | |
---|
122 | asm( \".h8300h\" ); |
---|
123 | |
---|