[b8ed8a9f] | 1 | /** |
---|
| 2 | * @file rtems/asm.h |
---|
[db903c74] | 3 | * |
---|
| 4 | * This include file attempts to address the problems |
---|
| 5 | * caused by incompatible flavors of assemblers and |
---|
| 6 | * toolsets. It primarily addresses variations in the |
---|
| 7 | * use of leading underscores on symbols and the requirement |
---|
| 8 | * that register names be preceded by a %. |
---|
[b8ed8a9f] | 9 | */ |
---|
| 10 | |
---|
| 11 | /* |
---|
[db903c74] | 12 | * NOTE: The spacing in the use of these macros |
---|
| 13 | * is critical to them working as advertised. |
---|
| 14 | * |
---|
| 15 | * COPYRIGHT: |
---|
| 16 | * |
---|
| 17 | * This file is based on similar code found in newlib available |
---|
| 18 | * from ftp.cygnus.com. The file which was used had no copyright |
---|
| 19 | * notice. This file is freely distributable as long as the source |
---|
| 20 | * of the file is noted. This file is: |
---|
| 21 | * |
---|
| 22 | * COPYRIGHT (c) 1994-1997. |
---|
| 23 | * On-Line Applications Research Corporation (OAR). |
---|
| 24 | * |
---|
| 25 | * $Id$ |
---|
| 26 | */ |
---|
| 27 | |
---|
[7f70d1b7] | 28 | #ifndef _RTEMS_ASM_H |
---|
| 29 | #define _RTEMS_ASM_H |
---|
[db903c74] | 30 | |
---|
| 31 | /* |
---|
| 32 | * Indicate we are in an assembly file and get the basic CPU definitions. |
---|
| 33 | */ |
---|
| 34 | |
---|
| 35 | #ifndef ASM |
---|
| 36 | #define ASM |
---|
| 37 | #endif |
---|
[270e3cc] | 38 | #include <rtems/score/cpuopts.h> |
---|
[db903c74] | 39 | #include <rtems/score/cpu.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 | |
---|
[7b3de7e] | 61 | #define EVAL(x) x |
---|
| 62 | #define CONCAT0(a, b) EVAL(a)EVAL(b) |
---|
| 63 | |
---|
[db903c74] | 64 | /* Use the right prefix for global labels. */ |
---|
| 65 | |
---|
[7b3de7e] | 66 | #define SYM(x) CONCAT0 (__USER_LABEL_PREFIX__, x) |
---|
[db903c74] | 67 | |
---|
| 68 | /* Use the right prefix for registers. */ |
---|
| 69 | |
---|
[7b3de7e] | 70 | #define REG(x) CONCAT0 (__REGISTER_PREFIX__, x) |
---|
[db903c74] | 71 | |
---|
| 72 | #define d0 REG (d0) |
---|
| 73 | #define d1 REG (d1) |
---|
| 74 | #define d2 REG (d2) |
---|
| 75 | #define d3 REG (d3) |
---|
| 76 | #define d4 REG (d4) |
---|
| 77 | #define d5 REG (d5) |
---|
| 78 | #define d6 REG (d6) |
---|
| 79 | #define d7 REG (d7) |
---|
| 80 | #define a0 REG (a0) |
---|
| 81 | #define a1 REG (a1) |
---|
| 82 | #define a2 REG (a2) |
---|
| 83 | #define a3 REG (a3) |
---|
| 84 | #define a4 REG (a4) |
---|
| 85 | #define a5 REG (a5) |
---|
| 86 | #define a6 REG (a6) |
---|
| 87 | #define a7 REG (a7) |
---|
| 88 | #define sp REG (sp) |
---|
| 89 | |
---|
| 90 | #define msp REG (msp) |
---|
| 91 | #define usp REG (usp) |
---|
| 92 | #define isp REG (isp) |
---|
| 93 | #define sr REG (sr) |
---|
| 94 | #define vbr REG (vbr) |
---|
| 95 | #define dfc REG (dfc) |
---|
| 96 | #define sfc REG (sfc) |
---|
| 97 | |
---|
| 98 | /* mcf52xx special regs */ |
---|
| 99 | #define cacr REG (cacr) |
---|
| 100 | #define acr0 REG (acr0) |
---|
| 101 | #define acr1 REG (acr1) |
---|
| 102 | #define rambar0 REG (rambar0) |
---|
| 103 | #define mbar REG (mbar) |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | #define fp0 REG (fp0) |
---|
| 107 | #define fp1 REG (fp1) |
---|
| 108 | #define fp2 REG (fp2) |
---|
| 109 | #define fp3 REG (fp3) |
---|
| 110 | #define fp4 REG (fp4) |
---|
| 111 | #define fp5 REG (fp5) |
---|
| 112 | #define fp6 REG (fp6) |
---|
| 113 | #define fp7 REG (fp7) |
---|
| 114 | |
---|
| 115 | #define fpc REG (fpc) |
---|
| 116 | #define fpi REG (fpi) |
---|
| 117 | #define fps REG (fps) |
---|
| 118 | #define fpsr REG (fpsr) |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | /* |
---|
| 122 | * Define macros to handle section beginning and ends. |
---|
| 123 | */ |
---|
| 124 | |
---|
| 125 | |
---|
| 126 | #define BEGIN_CODE_DCL .text |
---|
| 127 | #define END_CODE_DCL |
---|
| 128 | #define BEGIN_DATA_DCL .data |
---|
| 129 | #define END_DATA_DCL |
---|
| 130 | #define BEGIN_CODE .text |
---|
| 131 | #define END_CODE |
---|
| 132 | #define BEGIN_DATA .data |
---|
| 133 | #define END_DATA |
---|
| 134 | #define BEGIN_BSS .bss |
---|
| 135 | #define END_BSS |
---|
| 136 | #define END |
---|
| 137 | |
---|
| 138 | /* |
---|
| 139 | * Following must be tailor for a particular flavor of the C compiler. |
---|
| 140 | * They may need to put underscores in front of the symbols. |
---|
| 141 | */ |
---|
| 142 | |
---|
| 143 | #define PUBLIC(sym) .globl SYM (sym) |
---|
| 144 | #define EXTERN(sym) .globl SYM (sym) |
---|
| 145 | |
---|
| 146 | #endif |
---|