]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/l4re-core/l4sys/include/ARCH-amd64/ktrace-arch.h
Update
[l4.git] / l4 / pkg / l4re-core / l4sys / include / ARCH-amd64 / ktrace-arch.h
1 /**
2  * \file
3  * \brief   L4 kernel event tracing
4  * \ingroup api_calls
5  */
6 /*
7  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
8  *               Björn Döbel <doebel@os.inf.tu-dresden.de>,
9  *               Torsten Frenzel <frenzel@os.inf.tu-dresden.de>
10  *     economic rights: Technische Universität Dresden (Germany)
11  *
12  * This file is part of TUD:OS and distributed under the terms of the
13  * GNU General Public License 2.
14  * Please see the COPYING-GPL-2 file for details.
15  *
16  * As a special exception, you may use this file as part of a free software
17  * library without restriction.  Specifically, if other files instantiate
18  * templates or use macros or inline functions from this file, or you compile
19  * this file and link it with other files to produce an executable, this
20  * file does not by itself cause the resulting executable to be covered by
21  * the GNU General Public License.  This exception does not however
22  * invalidate any other reasons why the executable file might be covered by
23  * the GNU General Public License.
24  */
25 /*****************************************************************************/
26 #pragma once
27
28 #ifndef __L4_KTRACE_H__
29 #error "Do not include this file directly."
30 #endif
31
32 L4_INLINE l4_tracebuffer_status_t *
33 fiasco_tbuf_get_status(void)
34 {
35   l4_tracebuffer_status_t *tbuf;
36   asm("int $3; cmpb $29, %%al" : "=a" (tbuf) : "0" (0));
37   return tbuf;
38 }
39
40 L4_INLINE l4_addr_t
41 fiasco_tbuf_get_status_phys(void)
42 {
43   l4_addr_t tbuf_phys;
44   asm("int $3; cmpb $29, %%al" : "=a" (tbuf_phys) : "0" (5));
45   return tbuf_phys;
46 }
47
48 L4_INLINE l4_umword_t
49 fiasco_tbuf_log(const char *text)
50 {
51   l4_umword_t offset;
52   asm volatile("int $3; cmpb $29, %%al"
53               : "=a" (offset)
54               : "a" (1), "d" (text));
55   return offset;
56 }
57
58 L4_INLINE l4_umword_t
59 fiasco_tbuf_log_3val(const char *text, l4_umword_t v1, l4_umword_t v2, l4_umword_t v3)
60 {
61   l4_umword_t offset;
62   asm volatile("int $3; cmpb $29, %%al"
63               : "=a" (offset)
64               : "a" (4), "d" (text), "c" (v1), "S" (v2), "D" (v3) : "cc");
65   return offset;
66 }
67
68 L4_INLINE void
69 fiasco_tbuf_clear(void)
70 {
71   asm volatile("int $3; cmpb $29, %%al" : : "a" (2));
72 }
73
74 L4_INLINE void
75 fiasco_tbuf_dump(void)
76 {
77   asm volatile("int $3; cmpb $29, %%al" : : "a" (3));
78 }
79
80 L4_INLINE void
81 fiasco_timer_disable(void)
82 {
83   asm volatile("int $3; cmpb $29, %%al" : : "a" (6));
84 }
85
86 L4_INLINE void
87 fiasco_timer_enable(void)
88 {
89   asm volatile("int $3; cmpb $29, %%al" : : "a" (7));
90 }
91
92 L4_INLINE l4_umword_t
93 fiasco_tbuf_log_binary(const unsigned char *data)
94 {
95   l4_umword_t offset;
96   asm volatile("int $3; cmpb $29, %%al"
97                : "=a" (offset)
98                : "a" (8), "d" (data));
99   return offset;
100 }