Back to home page

LXR

 
 

    


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

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
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 
0013 /*
0014  *  NOTE: The spacing in the use of these macros
0015  *        is critical to them working as advertised.
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) 2011
0025  *  Anthony Green
0026  *
0027  *  COPYRIGHT (c) 1989-1999, 2010.
0028  *  On-Line Applications Research Corporation (OAR).
0029  *
0030  * Redistribution and use in source and binary forms, with or without
0031  * modification, are permitted provided that the following conditions
0032  * are met:
0033  * 1. Redistributions of source code must retain the above copyright
0034  *    notice, this list of conditions and the following disclaimer.
0035  * 2. Redistributions in binary form must reproduce the above copyright
0036  *    notice, this list of conditions and the following disclaimer in the
0037  *    documentation and/or other materials provided with the distribution.
0038  *
0039  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0040  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0041  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0042  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0043  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0044  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0045  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0046  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0047  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0048  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0049  * POSSIBILITY OF SUCH DAMAGE.
0050  *
0051  *  $Id: asm.h,v 1.9 2010/06/29 00:31:09 joel Exp $
0052  */
0053 
0054 #ifndef _RTEMS_ASM_H
0055 #define _RTEMS_ASM_H
0056 
0057 /*
0058  *  Indicate we are in an assembly file and get the basic CPU definitions.
0059  */
0060 
0061 #include <rtems/score/moxie.h>
0062 
0063 /**
0064  * @defgroup RTEMSScoreCPUMoxieASM Moxie Assembler Support
0065  *
0066  * @ingroup RTEMSScoreCPUMoxie
0067  *
0068  * @brief Moxie Assembler Support
0069  *
0070  * @{
0071  */
0072 
0073 /*
0074  *  Recent versions of GNU cpp define variables which indicate the
0075  *  need for underscores and percents.  If not using GNU cpp or
0076  *  the version does not support this, then you will obviously
0077  *  have to define these as appropriate.
0078  */
0079 
0080 #ifndef __USER_LABEL_PREFIX__
0081 #define __USER_LABEL_PREFIX__
0082 #endif
0083 
0084 #ifndef __REGISTER_PREFIX__
0085 #define __REGISTER_PREFIX__ "$"
0086 #endif
0087 
0088 #include <rtems/concat.h>
0089 
0090 /* Use the right prefix for global labels.  */
0091 
0092 #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
0093 
0094 /* Use the right prefix for registers.  */
0095 
0096 #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
0097 
0098 /*
0099  *  define macros for all of the registers on this CPU
0100  *
0101  *  EXAMPLE:     #define d0 REG (d0)
0102  */
0103 #define fp      REG(fp)
0104 #define sp      REG(sp)
0105 #define r0      REG(r0)
0106 #define r1      REG(r1)
0107 #define r2      REG(r2)
0108 #define r3      REG(r3)
0109 #define r4      REG(r4)
0110 #define r5      REG(r5)
0111 #define r6      REG(r6)
0112 #define r7      REG(r7)
0113 #define r8      REG(r8)
0114 #define r9      REG(r9)
0115 #define r10     REG(r10)
0116 #define r11     REG(r11)
0117 #define r12     REG(r12)
0118 #define r13     REG(r13)
0119 
0120 /*
0121  *  Define macros to handle section beginning and ends.
0122  */
0123 
0124 
0125 #define BEGIN_CODE_DCL .text
0126 #define END_CODE_DCL
0127 #define BEGIN_DATA_DCL .data
0128 #define END_DATA_DCL
0129 #define BEGIN_CODE asm ( ".text
0130 #define END_CODE ");
0131 #define BEGIN_DATA
0132 #define END_DATA
0133 #define BEGIN_BSS
0134 #define END_BSS
0135 #define END
0136 
0137 /*
0138  *  Following must be tailor for a particular flavor of the C compiler.
0139  *  They may need to put underscores in front of the symbols.
0140  */
0141 
0142 #define PUBLIC(sym) .globl SYM (sym)
0143 #define EXTERN(sym) .globl SYM (sym)
0144 
0145 /** @} */
0146 
0147 #endif