[db903c74] | 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 | * Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and |
---|
| 10 | * Bernd Becker (becker@faw.uni-ulm.de) |
---|
| 11 | * |
---|
| 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 | * |
---|
| 23 | * COPYRIGHT (c) 1997-1998, FAW Ulm, Germany |
---|
| 24 | * |
---|
| 25 | * This program is distributed in the hope that it will be useful, |
---|
| 26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
---|
| 28 | * |
---|
| 29 | * |
---|
| 30 | * COPYRIGHT (c) 1998. |
---|
| 31 | * On-Line Applications Research Corporation (OAR). |
---|
| 32 | * Copyright assigned to U.S. Government, 1994. |
---|
| 33 | * |
---|
| 34 | * The license and distribution terms for this file may be |
---|
| 35 | * found in the file LICENSE in this distribution or at |
---|
| 36 | * http://www.OARcorp.com/rtems/license.html. |
---|
| 37 | * |
---|
| 38 | * $Id$ |
---|
| 39 | */ |
---|
| 40 | |
---|
| 41 | #ifndef __CPU_SH_ASM_h |
---|
| 42 | #define __CPU_SH_ASM_h |
---|
| 43 | |
---|
| 44 | /* |
---|
| 45 | * Indicate we are in an assembly file and get the basic CPU definitions. |
---|
| 46 | */ |
---|
| 47 | |
---|
| 48 | #ifndef ASM |
---|
| 49 | #define ASM |
---|
| 50 | #endif |
---|
| 51 | |
---|
| 52 | #include <rtems/score/targopts.h> |
---|
| 53 | #include <rtems/score/sh.h> |
---|
| 54 | |
---|
| 55 | /* |
---|
| 56 | * Recent versions of GNU cpp define variables which indicate the |
---|
| 57 | * need for underscores and percents. If not using GNU cpp or |
---|
| 58 | * the version does not support this, then you will obviously |
---|
| 59 | * have to define these as appropriate. |
---|
| 60 | */ |
---|
| 61 | |
---|
| 62 | #ifndef __USER_LABEL_PREFIX__ |
---|
| 63 | #define __USER_LABEL_PREFIX__ _ |
---|
| 64 | #endif |
---|
| 65 | |
---|
| 66 | #ifndef __REGISTER_PREFIX__ |
---|
| 67 | #define __REGISTER_PREFIX__ |
---|
| 68 | #endif |
---|
| 69 | |
---|
| 70 | /* ANSI concatenation macros. */ |
---|
| 71 | |
---|
| 72 | #define CONCAT1(a, b) CONCAT2(a, b) |
---|
| 73 | #define CONCAT2(a, b) a ## b |
---|
| 74 | |
---|
| 75 | /* Use the right prefix for global labels. */ |
---|
| 76 | |
---|
| 77 | #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) |
---|
| 78 | |
---|
| 79 | /* Use the right prefix for registers. */ |
---|
| 80 | |
---|
| 81 | #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) |
---|
| 82 | |
---|
| 83 | /* |
---|
| 84 | * define macros for all of the registers on this CPU |
---|
| 85 | * |
---|
| 86 | * EXAMPLE: #define d0 REG (d0) |
---|
| 87 | */ |
---|
| 88 | #define r0 REG (r0) |
---|
| 89 | #define r1 REG (r1) |
---|
| 90 | #define r2 REG (r2) |
---|
| 91 | #define r3 REG (r3) |
---|
| 92 | #define r4 REG (r4) |
---|
| 93 | #define r5 REG (r5) |
---|
| 94 | #define r6 REG (r6) |
---|
| 95 | #define r7 REG (r7) |
---|
| 96 | #define r8 REG (r8) |
---|
| 97 | #define r9 REG (r9) |
---|
| 98 | #define r10 REG (r10) |
---|
| 99 | #define r11 REG (r11) |
---|
| 100 | #define r12 REG (r12) |
---|
| 101 | #define r13 REG (r13) |
---|
| 102 | #define r14 REG (r14) |
---|
| 103 | #define r15 REG (r15) |
---|
| 104 | #define vbr REG (vbr) |
---|
| 105 | #define gbr REG (gbr) |
---|
| 106 | #define pr REG (pr) |
---|
| 107 | #define mach REG (mach) |
---|
| 108 | #define macl REG (macl) |
---|
| 109 | #define sr REG (sr) |
---|
| 110 | #define pc REG (pc) |
---|
| 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) .global SYM (sym) |
---|
| 135 | #define EXTERN(sym) .global SYM (sym) |
---|
| 136 | |
---|
| 137 | #endif |
---|