RTEMS 7.0-rc1
Loading...
Searching...
No Matches
asm.h
Go to the documentation of this file.
1
19/*
20 * COPYRIGHT:
21 *
22 * This file is based on similar code found in newlib available
23 * from ftp.cygnus.com. The file which was used had no copyright
24 * notice. This file is freely distributable as long as the source
25 * of the file is noted.
26 */
27
28#ifndef _RTEMS_ASM_H
29#define _RTEMS_ASM_H
30
31/*
32 * Indicate we are in an assembly file and get the basic CPU definitions.
33 */
34
35#ifndef ASM
36#define ASM
37#endif
38
39#include <rtems/score/cpuopts.h>
40#include <rtems/score/cpu.h>
41
52/*
53 * Recent versions of GNU cpp define variables which indicate the
54 * need for underscores and percents. If not using GNU cpp or
55 * the version does not support this, then you will obviously
56 * have to define these as appropriate.
57 */
58
59/* XXX __USER_LABEL_PREFIX__ and __REGISTER_PREFIX__ do not work on gcc 2.7.0 */
60/* XXX The following ifdef magic fixes the problem but results in a warning */
61/* XXX when compiling assembly code. */
62
63#ifndef __USER_LABEL_PREFIX__
64#define __USER_LABEL_PREFIX__ _
65#endif
66
67#ifndef __REGISTER_PREFIX__
68#define __REGISTER_PREFIX__
69#endif
70
71/* Use the right prefix for global labels. */
72
73#define SYM(x) RTEMS_XCONCAT(__USER_LABEL_PREFIX__, x)
74
75/* Use the right prefix for registers. */
76
77#define REG(x) RTEMS_XCONCAT(__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
85/*
86 * Define macros to handle section beginning and ends.
87 */
88
89#define BEGIN_CODE_DCL .text
90#define END_CODE_DCL
91#define BEGIN_DATA_DCL .data
92#define END_DATA_DCL
93#define BEGIN_CODE .text
94#define END_CODE
95#define BEGIN_DATA
96#define END_DATA
97#define BEGIN_BSS
98#define END_BSS
99#define END
100
101/*
102 * Following must be tailor for a particular flavor of the C compiler.
103 * They may need to put underscores in front of the symbols.
104 */
105
106#define PUBLIC(sym) .globl SYM (sym)
107#define EXTERN(sym) .globl SYM (sym)
108
109/*
110 * Entry for traps which jump to a programmer-specified trap handler.
111 */
112
113#define TRAP(_vector, _handler) \
114 mov %psr, %l0 ; \
115 sethi %hi(_handler), %l4 ; \
116 jmp %l4+%lo(_handler); \
117 mov _vector, %l3
118
119/*
120 * Used for the reset trap to avoid a supervisor instruction
121 */
122
123#define RTRAP(_vector, _handler) \
124 mov %g0, %l0 ; \
125 sethi %hi(_handler), %l4 ; \
126 jmp %l4+%lo(_handler); \
127 mov _vector, %l3
128
129#endif
130