RTEMS 6.1-rc7
Loading...
Searching...
No Matches
asm.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
13/*
14 * NOTE: The spacing in the use of these macros
15 * is critical to them working as advertised.
16 *
17 * COPYRIGHT:
18 *
19 * This file is based on similar code found in newlib available
20 * from ftp.cygnus.com. The file which was used had no copyright
21 * notice. This file is freely distributable as long as the source
22 * of the file is noted. This file is:
23 *
24 * COPYRIGHT (c) 2011
25 * Anthony Green
26 *
27 * COPYRIGHT (c) 1989-1999, 2010.
28 * On-Line Applications Research Corporation (OAR).
29 *
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
32 * are met:
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in the
37 * documentation and/or other materials provided with the distribution.
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
40 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
42 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
43 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
44 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
45 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
46 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 * POSSIBILITY OF SUCH DAMAGE.
50 *
51 * $Id: asm.h,v 1.9 2010/06/29 00:31:09 joel Exp $
52 */
53
54#ifndef _RTEMS_ASM_H
55#define _RTEMS_ASM_H
56
57/*
58 * Indicate we are in an assembly file and get the basic CPU definitions.
59 */
60
61#include <rtems/score/moxie.h>
62
73/*
74 * Recent versions of GNU cpp define variables which indicate the
75 * need for underscores and percents. If not using GNU cpp or
76 * the version does not support this, then you will obviously
77 * have to define these as appropriate.
78 */
79
80#ifndef __USER_LABEL_PREFIX__
81#define __USER_LABEL_PREFIX__
82#endif
83
84#ifndef __REGISTER_PREFIX__
85#define __REGISTER_PREFIX__ "$"
86#endif
87
88#include <rtems/concat.h>
89
90/* Use the right prefix for global labels. */
91
92#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
93
94/* Use the right prefix for registers. */
95
96#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
97
98/*
99 * define macros for all of the registers on this CPU
100 *
101 * EXAMPLE: #define d0 REG (d0)
102 */
103#define fp REG(fp)
104#define sp REG(sp)
105#define r0 REG(r0)
106#define r1 REG(r1)
107#define r2 REG(r2)
108#define r3 REG(r3)
109#define r4 REG(r4)
110#define r5 REG(r5)
111#define r6 REG(r6)
112#define r7 REG(r7)
113#define r8 REG(r8)
114#define r9 REG(r9)
115#define r10 REG(r10)
116#define r11 REG(r11)
117#define r12 REG(r12)
118#define r13 REG(r13)
119
120/*
121 * Define macros to handle section beginning and ends.
122 */
123
124
125#define BEGIN_CODE_DCL .text
126#define END_CODE_DCL
127#define BEGIN_DATA_DCL .data
128#define END_DATA_DCL
129#define BEGIN_CODE asm ( ".text
130#define END_CODE ");
131#define BEGIN_DATA
132#define END_DATA
133#define BEGIN_BSS
134#define END_BSS
135#define END
136
137/*
138 * Following must be tailor for a particular flavor of the C compiler.
139 * They may need to put underscores in front of the symbols.
140 */
141
142#define PUBLIC(sym) .globl SYM (sym)
143#define EXTERN(sym) .globl SYM (sym)
144
147#endif