]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4sys/include/ARCH-sparc/kdebug.h
update
[l4.git] / l4 / pkg / l4sys / include / ARCH-sparc / kdebug.h
1 /*
2  * (c) 2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  *
9  * As a special exception, you may use this file as part of a free software
10  * library without restriction.  Specifically, if other files instantiate
11  * templates or use macros or inline functions from this file, or you compile
12  * this file and link it with other files to produce an executable, this
13  * file does not by itself cause the resulting executable to be covered by
14  * the GNU General Public License.  This exception does not however
15  * invalidate any other reasons why the executable file might be covered by
16  * the GNU General Public License.
17  */
18 #ifndef __L4SYS__INCLUDE__ARCH_SPARC__KDEBUG_H__
19 #define __L4SYS__INCLUDE__ARCH_SPARC__KDEBUG_H__
20
21 #include <l4/sys/compiler.h>
22 #include <l4/sys/consts.h>
23 #ifdef __GNUC__
24
25 #ifndef L4_SYSCALL_MAGIC_OFFSET
26 #  define L4_SYSCALL_MAGIC_OFFSET       8
27 #endif
28 #define L4_SYSCALL_ENTER_KDEBUG         (-0x00000020-L4_SYSCALL_MAGIC_OFFSET)
29
30
31 #define enter_kdebug(text...) do { } while (1)
32
33 L4_INLINE void
34 outnstring(const char* x, unsigned len);
35
36 L4_INLINE void
37 outstring(const char *text);
38
39 L4_INLINE void
40 outchar(char c);
41
42 L4_INLINE void
43 outdec(int number);
44
45 L4_INLINE void
46 outhex32(int number);
47
48 L4_INLINE void
49 outhex20(int number);
50
51 L4_INLINE void
52 outhex16(int number);
53
54 L4_INLINE void
55 outhex12(int number);
56
57 L4_INLINE void
58 outhex8(int number);
59
60 L4_INLINE void
61 kd_display(char *text);
62
63 L4_INLINE int
64 l4kd_inchar(void);
65
66 L4_INLINE void
67 l4_kdebug_imb(void);
68
69 L4_INLINE void __touch_ro(const char *x, unsigned len);
70
71 L4_INLINE unsigned long
72 __kdebug_param(unsigned long nr, unsigned long p1, unsigned long p2);
73
74 L4_INLINE unsigned long
75 __kdebug_param_5(unsigned long nr, unsigned long p1, unsigned long p2,
76                  unsigned long p3, unsigned long p4, unsigned long p5);
77
78 L4_INLINE
79 unsigned long
80 __kdebug_param(unsigned long nr, unsigned long p1, unsigned long p2)
81 {
82         (void)nr;
83         (void)p1;
84         (void)p2;
85         return -1;
86 }
87
88 L4_INLINE
89 unsigned long
90 __kdebug_param_5(unsigned long nr, unsigned long p1, unsigned long p2,
91                  unsigned long p3, unsigned long p4, unsigned long p5)
92 {
93         (void)nr;
94         (void)p1;
95         (void)p2;
96         (void)p3;
97         (void)p4;
98         (void)p5;
99         return -1;
100 }
101
102 L4_INLINE void
103 __touch_ro(const char *x, unsigned len)
104 {
105    volatile const char *sptr, *eptr;
106    sptr = (const char*)((unsigned)x & L4_PAGEMASK);
107    eptr = (const char*)(((unsigned)x + len -1) & L4_PAGEMASK);
108
109    for(;sptr <= eptr; sptr += L4_PAGESIZE)
110      (void)(*sptr);
111 }
112
113 L4_INLINE void
114 outnstring(const char* x, unsigned len)
115 {
116   __touch_ro(x, len);
117   __kdebug_param(3, (unsigned long)x, (unsigned long)len);
118 }
119
120 L4_INLINE void
121 outstring(const char *text)
122 {
123   unsigned i = 0;
124   while(text[i++]) ;
125   outnstring(text, i);
126 }
127
128 L4_INLINE void
129 outchar(char c)
130 {
131   __kdebug_param(1, (unsigned long)c, 0);
132 }
133
134 L4_INLINE void
135 outdec(int number)
136 {
137   __kdebug_param(4, (unsigned long)number, 0);
138 }
139
140 L4_INLINE void
141 outhex32(int number)
142 {
143   __kdebug_param(5, (unsigned long)number, 0);
144 }
145
146 L4_INLINE void
147 outhex20(int number)
148 {
149   __kdebug_param(6, (unsigned long)number, 0);
150 }
151
152 L4_INLINE void
153 outhex16(int number)
154 {
155   __kdebug_param(7, (unsigned long)number, 0);
156 }
157
158 L4_INLINE void
159 outhex12(int number)
160 {
161   __kdebug_param(8, (unsigned long)number, 0);
162 }
163
164 L4_INLINE void
165 outhex8(int number)
166 {
167   __kdebug_param(9, (unsigned long)number, 0);
168 }
169
170 L4_INLINE void
171 kd_display(char *text)
172 {
173   outstring(text);
174 }
175
176 L4_INLINE int
177 l4kd_inchar(void)
178 {
179   return __kdebug_param(0xd, 0, 0);
180 }
181
182 L4_INLINE void
183 l4_kdebug_imb(void)
184 {
185  // __KDEBUG_ARM_PARAM_0(0x3f);
186 }
187 #endif //__GNUC__
188
189 #endif /* ! __L4SYS__INCLUDE__ARCH_SPARC__KDEBUG_H__ */