Back to home page

LXR

 
 

    


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

0001 /**
0002  * @file
0003  *
0004  * @brief Addresses Incompatible Flavors Problems
0005  *
0006  *  This include file attempts to address the problems
0007  *  caused by incompatible flavors of assemblers and
0008  *  toolsets.  It primarily addresses variations in the
0009  *  use of leading underscores on symbols and the requirement
0010  *  that register names be preceded by a %.
0011  *
0012  *  NOTE: The spacing in the use of these macros
0013  *        is critical to them working as advertised.
0014  */
0015 
0016 /*
0017  *  COPYRIGHT:
0018  *
0019  *  This file is based on similar code found in newlib available
0020  *  from ftp.cygnus.com.  The file which was used had no copyright
0021  *  notice.  This file is freely distributable as long as the source
0022  *  of the file is noted.  This file is:
0023  *
0024  *  COPYRIGHT (c) 1994-2006.
0025  *  On-Line Applications Research Corporation (OAR).
0026  */
0027 
0028 #ifndef _RTEMS_ASM_H
0029 #define _RTEMS_ASM_H
0030 
0031 /**
0032  *  @defgroup RTEMSScoreCPUExampleASM Example Assembler Support
0033  *
0034  *  @ingroup RTEMSScoreCPUExample
0035  */
0036 /**@{*/
0037 
0038 /*
0039  *  Indicate we are in an assembly file and get the basic CPU definitions.
0040  */
0041 
0042 #ifndef ASM
0043 #define ASM
0044 #endif
0045 #include <rtems/score/cpuopts.h>
0046 #include <rtems/score/no_cpu.h>
0047 
0048 #ifndef __USER_LABEL_PREFIX__
0049 /**
0050  *  Recent versions of GNU cpp define variables which indicate the
0051  *  need for underscores and percents.  If not using GNU cpp or
0052  *  the version does not support this, then you will obviously
0053  *  have to define these as appropriate.
0054  *
0055  *  This symbol is prefixed to all C program symbols.
0056  */
0057 #define __USER_LABEL_PREFIX__ _
0058 #endif
0059 
0060 #ifndef __REGISTER_PREFIX__
0061 /**
0062  *  Recent versions of GNU cpp define variables which indicate the
0063  *  need for underscores and percents.  If not using GNU cpp or
0064  *  the version does not support this, then you will obviously
0065  *  have to define these as appropriate.
0066  *
0067  *  This symbol is prefixed to all register names.
0068  */
0069 #define __REGISTER_PREFIX__
0070 #endif
0071 
0072 #include <rtems/concat.h>
0073 
0074 /** Use the right prefix for global labels.  */
0075 #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
0076 
0077 /** Use the right prefix for registers.  */
0078 #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
0079 
0080 /*
0081  *  define macros for all of the registers on this CPU
0082  *
0083  *  EXAMPLE:     #define d0 REG (d0)
0084  */
0085 
0086 /*
0087  *  Define macros to handle section beginning and ends.
0088  */
0089 
0090 
0091 /** This macro is used to denote the beginning of a code declaration. */
0092 #define BEGIN_CODE_DCL .text
0093 /** This macro is used to denote the end of a code declaration. */
0094 #define END_CODE_DCL
0095 /** This macro is used to denote the beginning of a data declaration section. */
0096 #define BEGIN_DATA_DCL .data
0097 /** This macro is used to denote the end of a data declaration section. */
0098 #define END_DATA_DCL
0099 /** This macro is used to denote the beginning of a code section. */
0100 #define BEGIN_CODE .text
0101 /** This macro is used to denote the end of a code section. */
0102 #define END_CODE
0103 /** This macro is used to denote the beginning of a data section. */
0104 #define BEGIN_DATA
0105 /** This macro is used to denote the end of a data section. */
0106 #define END_DATA
0107 /** This macro is used to denote the beginning of the
0108  *  unitialized data section.
0109  */
0110 #define BEGIN_BSS
0111 /** This macro is used to denote the end of the unitialized data section.  */
0112 #define END_BSS
0113 /** This macro is used to denote the end of the assembly file.  */
0114 #define END
0115 
0116 /**
0117  *  This macro is used to declare a public global symbol.
0118  *
0119  *  @note This must be tailored for a particular flavor of the C compiler.
0120  *  They may need to put underscores in front of the symbols.
0121  */
0122 #define PUBLIC(sym) .globl SYM (sym)
0123 
0124 /**
0125  *  This macro is used to prototype a public global symbol.
0126  *
0127  *  @note This must be tailored for a particular flavor of the C compiler.
0128  *  They may need to put underscores in front of the symbols.
0129  */
0130 #define EXTERN(sym) .globl SYM (sym)
0131 
0132 /**@}*/
0133 #endif