Back to home page

LXR

 
 

    


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

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