[d9a6ab3] | 1 | /** |
---|
| 2 | * @file rtems/asm.h |
---|
| 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 %. |
---|
| 9 | */ |
---|
| 10 | |
---|
| 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 | * COPYRIGHT (c) 1994-2006. |
---|
| 23 | * On-Line Applications Research Corporation (OAR). |
---|
| 24 | * |
---|
| 25 | * $Id$ |
---|
| 26 | */ |
---|
| 27 | |
---|
| 28 | #ifndef _RTEMS_ASM_H |
---|
| 29 | #define _RTEMS_ASM_H |
---|
| 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 |
---|
| 38 | #include <rtems/score/cpuopts.h> |
---|
| 39 | #include <rtems/score/bfin.h> |
---|
| 40 | |
---|
| 41 | #ifndef __USER_LABEL_PREFIX__ |
---|
| 42 | /** |
---|
| 43 | * Recent versions of GNU cpp define variables which indicate the |
---|
| 44 | * need for underscores and percents. If not using GNU cpp or |
---|
| 45 | * the version does not support this, then you will obviously |
---|
| 46 | * have to define these as appropriate. |
---|
| 47 | * |
---|
| 48 | * This symbol is prefixed to all C program symbols. |
---|
| 49 | */ |
---|
| 50 | #define __USER_LABEL_PREFIX__ _ |
---|
| 51 | #endif |
---|
| 52 | |
---|
| 53 | #ifndef __REGISTER_PREFIX__ |
---|
| 54 | /** |
---|
| 55 | * Recent versions of GNU cpp define variables which indicate the |
---|
| 56 | * need for underscores and percents. If not using GNU cpp or |
---|
| 57 | * the version does not support this, then you will obviously |
---|
| 58 | * have to define these as appropriate. |
---|
| 59 | * |
---|
| 60 | * This symbol is prefixed to all register names. |
---|
| 61 | */ |
---|
| 62 | #define __REGISTER_PREFIX__ |
---|
| 63 | #endif |
---|
| 64 | |
---|
| 65 | #include <rtems/concat.h> |
---|
| 66 | |
---|
| 67 | /** Use the right prefix for global labels. */ |
---|
| 68 | #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) |
---|
| 69 | |
---|
| 70 | /** Use the right prefix for registers. */ |
---|
| 71 | #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) |
---|
| 72 | |
---|
| 73 | /* |
---|
| 74 | * define macros for all of the registers on this CPU |
---|
| 75 | * |
---|
| 76 | * EXAMPLE: #define d0 REG (d0) |
---|
| 77 | */ |
---|
| 78 | |
---|
| 79 | /* |
---|
| 80 | * Define macros to handle section beginning and ends. |
---|
| 81 | */ |
---|
| 82 | |
---|
| 83 | |
---|
| 84 | /** This macro is used to denote the beginning of a code declaration. */ |
---|
| 85 | #define BEGIN_CODE_DCL .text |
---|
| 86 | /** This macro is used to denote the end of a code declaration. */ |
---|
| 87 | #define END_CODE_DCL |
---|
| 88 | /** This macro is used to denote the beginning of a data declaration section. */ |
---|
| 89 | #define BEGIN_DATA_DCL .data |
---|
| 90 | /** This macro is used to denote the end of a data declaration section. */ |
---|
| 91 | #define END_DATA_DCL |
---|
| 92 | /** This macro is used to denote the beginning of a code section. */ |
---|
| 93 | #define BEGIN_CODE .text |
---|
| 94 | /** This macro is used to denote the end of a code section. */ |
---|
| 95 | #define END_CODE |
---|
| 96 | /** This macro is used to denote the beginning of a data section. */ |
---|
| 97 | #define BEGIN_DATA |
---|
| 98 | /** This macro is used to denote the end of a data section. */ |
---|
| 99 | #define END_DATA |
---|
| 100 | /** This macro is used to denote the beginning of the |
---|
| 101 | * unitialized data section. |
---|
| 102 | */ |
---|
| 103 | #define BEGIN_BSS |
---|
| 104 | /** This macro is used to denote the end of the unitialized data section. */ |
---|
| 105 | #define END_BSS |
---|
| 106 | /** This macro is used to denote the end of the assembly file. */ |
---|
| 107 | #define END |
---|
| 108 | |
---|
| 109 | /** |
---|
| 110 | * This macro is used to declare a public global symbol. |
---|
| 111 | * |
---|
| 112 | * @note This must be tailored for a particular flavor of the C compiler. |
---|
| 113 | * They may need to put underscores in front of the symbols. |
---|
| 114 | */ |
---|
| 115 | #define PUBLIC(sym) .globl SYM (sym) |
---|
| 116 | |
---|
| 117 | /** |
---|
| 118 | * This macro is used to prototype a public global symbol. |
---|
| 119 | * |
---|
| 120 | * @note This must be tailored for a particular flavor of the C compiler. |
---|
| 121 | * They may need to put underscores in front of the symbols. |
---|
| 122 | */ |
---|
| 123 | #define EXTERN(sym) .globl SYM (sym) |
---|
| 124 | |
---|
| 125 | #endif |
---|