[08330bf] | 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 | * COPYRIGHT (c) 2000 Canon Research Centre France SA. |
---|
| 21 | * Emmanuel Raguet, mailto:raguet@crf.canon.fr |
---|
| 22 | * |
---|
| 23 | * The license and distribution terms for this file may be |
---|
| 24 | * found in the file LICENSE in this distribution or at |
---|
| 25 | * http://www.OARcorp.com/rtems/license.html. |
---|
| 26 | * |
---|
| 27 | */ |
---|
| 28 | |
---|
| 29 | #ifndef __ARM_ASM_h |
---|
| 30 | #define __ARM_ASM_h |
---|
| 31 | |
---|
| 32 | /* |
---|
| 33 | * Indicate we are in an assembly file and get the basic CPU definitions. |
---|
| 34 | */ |
---|
| 35 | |
---|
| 36 | #ifndef ASM |
---|
| 37 | #define ASM |
---|
| 38 | #endif |
---|
| 39 | #include <rtems/score/targopts.h> |
---|
| 40 | #include <rtems/score/arm.h> |
---|
| 41 | |
---|
| 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 | |
---|
| 49 | #ifndef __USER_LABEL_PREFIX__ |
---|
| 50 | #define __USER_LABEL_PREFIX__ _ |
---|
| 51 | #endif |
---|
| 52 | |
---|
| 53 | #ifndef __REGISTER_PREFIX__ |
---|
| 54 | #define __REGISTER_PREFIX__ |
---|
| 55 | #endif |
---|
| 56 | |
---|
| 57 | /* ANSI concatenation macros. */ |
---|
| 58 | |
---|
| 59 | #define CONCAT1(a, b) CONCAT2(a, b) |
---|
| 60 | #define CONCAT2(a, b) a ## b |
---|
| 61 | |
---|
| 62 | /* Use the right prefix for global labels. */ |
---|
| 63 | |
---|
| 64 | #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x) |
---|
| 65 | |
---|
| 66 | /* Use the right prefix for registers. */ |
---|
| 67 | |
---|
| 68 | #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x) |
---|
| 69 | |
---|
| 70 | /* |
---|
| 71 | * define macros for all of the registers on this CPU |
---|
| 72 | * |
---|
| 73 | * EXAMPLE: #define d0 REG (d0) |
---|
| 74 | */ |
---|
| 75 | |
---|
| 76 | #define r0 REG(r0) |
---|
| 77 | #define r1 REG(r1) |
---|
| 78 | #define r2 REG(r2) |
---|
| 79 | #define r3 REG(r3) |
---|
| 80 | #define r4 REG(r4) |
---|
| 81 | #define r5 REG(r5) |
---|
| 82 | #define r6 REG(r6) |
---|
| 83 | #define r7 REG(r7) |
---|
| 84 | #define r8 REG(r8) |
---|
| 85 | #define r9 REG(r9) |
---|
| 86 | #define r10 REG(r10) |
---|
| 87 | #define r11 REG(r11) |
---|
| 88 | #define r12 REG(r12) |
---|
| 89 | #define r13 REG(r13) |
---|
| 90 | #define r14 REG(r14) |
---|
| 91 | #define r15 REG(r15) |
---|
| 92 | |
---|
| 93 | #define CPSR REG(CPSR) |
---|
| 94 | |
---|
| 95 | #define SPSR REG(SPSR) |
---|
| 96 | |
---|
| 97 | /* |
---|
| 98 | * Define macros to handle section beginning and ends. |
---|
| 99 | */ |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | #define BEGIN_CODE_DCL .text |
---|
| 103 | #define END_CODE_DCL |
---|
| 104 | #define BEGIN_DATA_DCL .data |
---|
| 105 | #define END_DATA_DCL |
---|
| 106 | #define BEGIN_CODE .text |
---|
| 107 | #define END_CODE |
---|
| 108 | #define BEGIN_DATA |
---|
| 109 | #define END_DATA |
---|
| 110 | #define BEGIN_BSS |
---|
| 111 | #define END_BSS |
---|
| 112 | #define END |
---|
| 113 | |
---|
| 114 | /* |
---|
| 115 | * Following must be tailor for a particular flavor of the C compiler. |
---|
| 116 | * They may need to put underscores in front of the symbols. |
---|
| 117 | */ |
---|
| 118 | |
---|
| 119 | #define PUBLIC(sym) .globl SYM (sym) |
---|
| 120 | #define EXTERN(sym) .globl SYM (sym) |
---|
| 121 | |
---|
| 122 | #endif |
---|
| 123 | /* end of include file */ |
---|
| 124 | |
---|
| 125 | |
---|