2 * (c) 2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
3 * economic rights: Technische Universität Dresden (Germany)
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.
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.
18 #ifndef __L4SYS__INCLUDE__ARCH_PPC32__KDEBUG_H__
19 #define __L4SYS__INCLUDE__ARCH_PPC32__KDEBUG_H__
21 #include <l4/sys/compiler.h>
22 #include <l4/sys/consts.h>
25 #ifndef L4_SYSCALL_MAGIC_OFFSET
26 # define L4_SYSCALL_MAGIC_OFFSET 8
28 #define L4_SYSCALL_ENTER_KDEBUG (-0x00000020-L4_SYSCALL_MAGIC_OFFSET)
31 #define enter_kdebug(text...) \
32 __asm__ __volatile__ ( \
36 " .ascii \"" text "\" \n" \
41 : "i" (L4_SYSCALL_ENTER_KDEBUG), \
46 outnstring(const char* x, unsigned len);
49 outstring(const char *text);
73 kd_display(char *text);
88 l4_atomic_add(volatile long int* mem, long int offset) L4_NOTHROW;
91 l4_atomic_cmpxchg(volatile long int* mem, long int oldval, long int newval) L4_NOTHROW;
94 l4_atomic_xchg(volatile long int* mem, long int newval) L4_NOTHROW;
99 L4_INLINE void __touch_ro(const char *x, unsigned len);
101 L4_INLINE unsigned long
102 __kdebug_param(unsigned long nr, unsigned long p1, unsigned long p2);
104 L4_INLINE unsigned long
105 __kdebug_param_5(unsigned long nr, unsigned long p1, unsigned long p2,
106 unsigned long p3, unsigned long p4, unsigned long p5);
110 __kdebug_param(unsigned long nr, unsigned long p1, unsigned long p2)
112 register unsigned long r3 asm("r3") = (nr) | (1 << 31);
113 register unsigned long r4 asm("r4") = (p1);
114 register unsigned long r5 asm("r5") = (p2);
115 asm volatile ( " bla %1 \n"
117 : "i" (L4_SYSCALL_ENTER_KDEBUG),
118 "0" (r4), "r" (r3), "r" (r5)
126 __kdebug_param_5(unsigned long nr, unsigned long p1, unsigned long p2,
127 unsigned long p3, unsigned long p4, unsigned long p5)
129 register unsigned long r3 asm("r3") = (nr) | (1 << 31);
130 register unsigned long r4 asm("r4") = (p1);
131 register unsigned long r5 asm("r5") = (p2);
132 register unsigned long r6 asm("r6") = (p3);
133 register unsigned long r7 asm("r7") = (p4);
134 register unsigned long r8 asm("r8") = (p5);
136 asm volatile ( " bla %1 \n"
138 : "i" (L4_SYSCALL_ENTER_KDEBUG),
139 "0" (r4), "r" (r3), "r" (r5),
140 "r" (r6), "r" (r7), "r" (r8)
147 __touch_ro(const char *x, unsigned len)
149 volatile const char *sptr, *eptr;
150 sptr = (const char*)((unsigned)x & L4_PAGEMASK);
151 eptr = (const char*)(((unsigned)x + len -1) & L4_PAGEMASK);
153 for(;sptr <= eptr; sptr += L4_PAGESIZE)
158 outnstring(const char* x, unsigned len)
161 __kdebug_param(3, (unsigned long)x, (unsigned long)len);
165 outstring(const char *text)
175 __kdebug_param(1, (unsigned long)c, 0);
181 __kdebug_param(4, (unsigned long)number, 0);
187 __kdebug_param(5, (unsigned long)number, 0);
193 __kdebug_param(6, (unsigned long)number, 0);
199 __kdebug_param(7, (unsigned long)number, 0);
205 __kdebug_param(8, (unsigned long)number, 0);
211 __kdebug_param(9, (unsigned long)number, 0);
215 kd_display(char *text)
223 return __kdebug_param(0xd, 0, 0);
229 __kdebug_param(0x32, 0, 0);
235 __kdebug_param(0x33, 0, 0);
241 // __KDEBUG_ARM_PARAM_0(0x3f);
246 return __kdebug_param(0x34, 0, 0);
250 #endif /* ! __L4SYS__INCLUDE__ARCH_PPC32__KDEBUG_H__ */