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