source: rtems/cpukit/score/cpu/sparc/rtems/asm.h @ b72e847b

4.8
Last change on this file since b72e847b was c6ea319, checked in by Ralf Corsepius <ralf.corsepius@…>, on Oct 27, 2005 at 7:29:04 AM

2005-10-27 Ralf Corsepius <ralf.corsepius@…>

  • rtems/asm.h: Remove private version of CONCAT macros. Include <rtems/concat.h> instead.
  • Property mode set to 100644
File size: 2.7 KB
Line 
1/**
2 * @file rtems/asm.h
3 *
4 *  This include file attempts to address the problems
5 *  caused by incompatible flavors of assemblers and
6 *  toolsets.  It primarily addresses variations in the
7 *  use of leading underscores on symbols and the requirement
8 *  that register names be preceded by a %.
9 */
10
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.
21 *
22 *  $Id$
23 */
24
25#ifndef _RTEMS_ASM_H
26#define _RTEMS_ASM_H
27
28/*
29 *  Indicate we are in an assembly file and get the basic CPU definitions.
30 */
31
32#ifndef ASM
33#define ASM
34#endif
35
36#include <rtems/score/cpuopts.h>
37#include <rtems/score/cpu.h>
38
39/*
40 *  Recent versions of GNU cpp define variables which indicate the
41 *  need for underscores and percents.  If not using GNU cpp or
42 *  the version does not support this, then you will obviously
43 *  have to define these as appropriate.
44 */
45
46/* XXX __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ do not work on gcc 2.7.0 */
47/* XXX The following ifdef magic fixes the problem but results in a warning   */
48/* XXX when compiling assembly code.                                          */
49
50#ifndef __USER_LABEL_PREFIX__
51#define __USER_LABEL_PREFIX__ _
52#endif
53
54#ifndef __REGISTER_PREFIX__
55#define __REGISTER_PREFIX__
56#endif
57
58#include <rtems/concat.h>
59
60/* Use the right prefix for global labels.  */
61
62#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
63
64/* Use the right prefix for registers.  */
65
66#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
67
68/*
69 *  define macros for all of the registers on this CPU
70 *
71 *  EXAMPLE:     #define d0 REG (d0)
72 */
73
74/*
75 *  Define macros to handle section beginning and ends.
76 */
77
78
79#define BEGIN_CODE_DCL .text
80#define END_CODE_DCL
81#define BEGIN_DATA_DCL .data
82#define END_DATA_DCL
83#define BEGIN_CODE .text
84#define END_CODE
85#define BEGIN_DATA
86#define END_DATA
87#define BEGIN_BSS
88#define END_BSS
89#define END
90
91/*
92 *  Following must be tailor for a particular flavor of the C compiler.
93 *  They may need to put underscores in front of the symbols.
94 */
95
96#define PUBLIC(sym) .globl SYM (sym)
97#define EXTERN(sym) .globl SYM (sym)
98
99/*
100 *  Entry for traps which jump to a programmer-specified trap handler.
101 */
102 
103#define TRAP(_vector, _handler)  \
104  mov   %psr, %l0 ; \
105  sethi %hi(_handler), %l4 ; \
106  jmp   %l4+%lo(_handler); \
107  mov   _vector, %l3
108
109/*
110 *  Used for the reset trap to avoid a supervisor instruction
111 */
112 
113#define RTRAP(_vector, _handler)  \
114  mov   %g0, %l0 ; \
115  sethi %hi(_handler), %l4 ; \
116  jmp   %l4+%lo(_handler); \
117  mov   _vector, %l3
118
119#endif
Note: See TracBrowser for help on using the repository browser.