Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:25

0001 /**
0002  * @file
0003  *
0004  * @brief Address the Problems Caused by Incompatible Flavor of
0005  * Assemblers and Toolsets
0006  *
0007  * This include file attempts to address the problems
0008  * caused by incompatible flavors of assemblers and
0009  * toolsets.  It primarily addresses variations in the
0010  * use of leading underscores on symbols and the requirement
0011  * that register names be preceded by a %.
0012  *
0013  * @note The spacing in the use of these macros
0014  *       is critical to them working as advertised.
0015  */
0016 
0017 /*
0018  *  Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and
0019  *           Bernd Becker (becker@faw.uni-ulm.de)
0020  *
0021  *  COPYRIGHT:
0022  *
0023  *  This file is based on similar code found in newlib available
0024  *  from ftp.cygnus.com.  The file which was used had no copyright
0025  *  notice.  This file is freely distributable as long as the source
0026  *  of the file is noted.  This file is:
0027  *
0028  *
0029  *  COPYRIGHT (c) 1997-1998, FAW Ulm, Germany
0030  *
0031  *  This program is distributed in the hope that it will be useful,
0032  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0033  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
0034  *
0035  *
0036  *  COPYRIGHT (c) 1998-2001.
0037  *  On-Line Applications Research Corporation (OAR).
0038  *
0039  *  The license and distribution terms for this file may be
0040  *  found in the file LICENSE in this distribution or at
0041  *  http://www.rtems.org/license/LICENSE.
0042  */
0043 
0044 #ifndef _RTEMS_ASM_H
0045 #define _RTEMS_ASM_H
0046 
0047 /*
0048  *  Indicate we are in an assembly file and get the basic CPU definitions.
0049  */
0050 
0051 #ifndef ASM
0052 #define ASM
0053 #endif
0054 
0055 #include <rtems/score/cpuopts.h>
0056 #include <rtems/score/sh.h>
0057 
0058 /**
0059  * @defgroup RTEMSScoreCPUshASM SuperH (sh) Assembler Support
0060  *
0061  * @ingroup RTEMSScoreCPUsh
0062  *
0063  * @brief SuperH (sh) Assembler Support
0064  *
0065  * @{
0066  */
0067 
0068 /*
0069  *  Recent versions of GNU cpp define variables which indicate the
0070  *  need for underscores and percents.  If not using GNU cpp or
0071  *  the version does not support this, then you will obviously
0072  *  have to define these as appropriate.
0073  */
0074 
0075 #ifndef __USER_LABEL_PREFIX__
0076 #define __USER_LABEL_PREFIX__ _
0077 #endif
0078 
0079 #ifndef __REGISTER_PREFIX__
0080 #define __REGISTER_PREFIX__
0081 #endif
0082 
0083 #include <rtems/concat.h>
0084 
0085 /* Use the right prefix for global labels.  */
0086 
0087 #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
0088 
0089 /* Use the right prefix for registers.  */
0090 
0091 #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
0092 
0093 /*
0094  *  define macros for all of the registers on this CPU
0095  *
0096  *  EXAMPLE:     #define d0 REG (d0)
0097  */
0098 #define r0 REG (r0)
0099 #define r1 REG (r1)
0100 #define r2 REG (r2)
0101 #define r3 REG (r3)
0102 #define r4 REG (r4)
0103 #define r5 REG (r5)
0104 #define r6 REG (r6)
0105 #define r7 REG (r7)
0106 #define r8 REG (r8)
0107 #define r9 REG (r9)
0108 #define r10 REG (r10)
0109 #define r11 REG (r11)
0110 #define r12 REG (r12)
0111 #define r13 REG (r13)
0112 #define r14 REG (r14)
0113 #define r15 REG (r15)
0114 #define vbr REG (vbr)
0115 #define gbr REG (gbr)
0116 #define pr REG (pr)
0117 #define mach REG (mach)
0118 #define macl REG (macl)
0119 #define sr REG (sr)
0120 #define pc REG (pc)
0121 
0122 /*
0123  *  Define macros to handle section beginning and ends.
0124  */
0125 
0126 
0127 #define BEGIN_CODE_DCL .text
0128 #define END_CODE_DCL
0129 #define BEGIN_DATA_DCL .data
0130 #define END_DATA_DCL
0131 #define BEGIN_CODE .text
0132 #define END_CODE
0133 #define BEGIN_DATA
0134 #define END_DATA
0135 #define BEGIN_BSS
0136 #define END_BSS
0137 #define END
0138 
0139 /*
0140  *  Following must be tailor for a particular flavor of the C compiler.
0141  *  They may need to put underscores in front of the symbols.
0142  */
0143 
0144 #define PUBLIC(sym) .global SYM (sym)
0145 #define EXTERN(sym) .global SYM (sym)
0146 
0147 #endif