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);
81 L4_INLINE void __touch_ro(const char *x, unsigned len);
83 L4_INLINE unsigned long
84 __kdebug_param(unsigned long nr, unsigned long p1, unsigned long p2);
86 L4_INLINE unsigned long
87 __kdebug_param_5(unsigned long nr, unsigned long p1, unsigned long p2,
88 unsigned long p3, unsigned long p4, unsigned long p5);
92 __kdebug_param(unsigned long nr, unsigned long p1, unsigned long p2)
94 register unsigned long r3 __asm__ ("r3") = (nr) | (1 << 31);
95 register unsigned long r4 __asm__ ("r4") = (p1);
96 register unsigned long r5 __asm__ ("r5") = (p2);
97 asm volatile ( " bla %1 \n"
99 : "i" (L4_SYSCALL_ENTER_KDEBUG),
100 "0" (r4), "r" (r3), "r" (r5)
108 __kdebug_param_5(unsigned long nr, unsigned long p1, unsigned long p2,
109 unsigned long p3, unsigned long p4, unsigned long p5)
111 register unsigned long r3 __asm__ ("r3") = (nr) | (1 << 31);
112 register unsigned long r4 __asm__ ("r4") = (p1);
113 register unsigned long r5 __asm__ ("r5") = (p2);
114 register unsigned long r6 __asm__ ("r6") = (p3);
115 register unsigned long r7 __asm__ ("r7") = (p4);
116 register unsigned long r8 __asm__ ("r8") = (p5);
118 asm volatile ( " bla %1 \n"
120 : "i" (L4_SYSCALL_ENTER_KDEBUG),
121 "0" (r4), "r" (r3), "r" (r5),
122 "r" (r6), "r" (r7), "r" (r8)
129 __touch_ro(const char *x, unsigned len)
131 volatile const char *sptr, *eptr;
132 sptr = (const char*)((unsigned)x & L4_PAGEMASK);
133 eptr = (const char*)(((unsigned)x + len -1) & L4_PAGEMASK);
135 for(;sptr <= eptr; sptr += L4_PAGESIZE)
140 outnstring(const char* x, unsigned len)
143 __kdebug_param(3, (unsigned long)x, (unsigned long)len);
147 outstring(const char *text)
157 __kdebug_param(1, (unsigned long)c, 0);
163 __kdebug_param(4, (unsigned long)number, 0);
169 __kdebug_param(5, (unsigned long)number, 0);
175 __kdebug_param(6, (unsigned long)number, 0);
181 __kdebug_param(7, (unsigned long)number, 0);
187 __kdebug_param(8, (unsigned long)number, 0);
193 __kdebug_param(9, (unsigned long)number, 0);
197 kd_display(char *text)
205 return __kdebug_param(0xd, 0, 0);
211 // __KDEBUG_ARM_PARAM_0(0x3f);
215 #endif /* ! __L4SYS__INCLUDE__ARCH_PPC32__KDEBUG_H__ */