RTEMS 5.2
asm.h
Go to the documentation of this file.
1
11/*
12 * NOTE: The spacing in the use of these macros
13 * is critical to them working as advertised.
14 *
15 * COPYRIGHT:
16 *
17 * This file is based on similar code found in newlib available
18 * from ftp.cygnus.com. The file which was used had no copyright
19 * notice. This file is freely distributable as long as the source
20 * of the file is noted. This file is:
21 *
22 * COPYRIGHT (c) 2011
23 * Anthony Green
24 *
25 * COPYRIGHT (c) 1989-1999, 2010.
26 * On-Line Applications Research Corporation (OAR).
27 *
28 * The license and distribution terms for this file may be
29 * found in the file LICENSE in this distribution or at
30 * http://www.rtems.org/license/LICENSE.
31 *
32 * $Id: asm.h,v 1.9 2010/06/29 00:31:09 joel Exp $
33 */
34
35#ifndef _RTEMS_ASM_H
36#define _RTEMS_ASM_H
37
38/*
39 * Indicate we are in an assembly file and get the basic CPU definitions.
40 */
41
42#include <rtems/score/moxie.h>
43
54/*
55 * Recent versions of GNU cpp define variables which indicate the
56 * need for underscores and percents. If not using GNU cpp or
57 * the version does not support this, then you will obviously
58 * have to define these as appropriate.
59 */
60
61#ifndef __USER_LABEL_PREFIX__
62#define __USER_LABEL_PREFIX__
63#endif
64
65#ifndef __REGISTER_PREFIX__
66#define __REGISTER_PREFIX__ "$"
67#endif
68
69#include <rtems/concat.h>
70
71/* Use the right prefix for global labels. */
72
73#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
74
75/* Use the right prefix for registers. */
76
77#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
78
79/*
80 * define macros for all of the registers on this CPU
81 *
82 * EXAMPLE: #define d0 REG (d0)
83 */
84#define fp REG(fp)
85#define sp REG(sp)
86#define r0 REG(r0)
87#define r1 REG(r1)
88#define r2 REG(r2)
89#define r3 REG(r3)
90#define r4 REG(r4)
91#define r5 REG(r5)
92#define r6 REG(r6)
93#define r7 REG(r7)
94#define r8 REG(r8)
95#define r9 REG(r9)
96#define r10 REG(r10)
97#define r11 REG(r11)
98#define r12 REG(r12)
99#define r13 REG(r13)
100
101/*
102 * Define macros to handle section beginning and ends.
103 */
104
105
106#define BEGIN_CODE_DCL .text
107#define END_CODE_DCL
108#define BEGIN_DATA_DCL .data
109#define END_DATA_DCL
110#define BEGIN_CODE asm ( ".text
111#define END_CODE ");
112#define BEGIN_DATA
113#define END_DATA
114#define BEGIN_BSS
115#define END_BSS
116#define END
117
118/*
119 * Following must be tailor for a particular flavor of the C compiler.
120 * They may need to put underscores in front of the symbols.
121 */
122
123#define PUBLIC(sym) .globl SYM (sym)
124#define EXTERN(sym) .globl SYM (sym)
125
128#endif