]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ferret/lib/common/convert.cc
update
[l4.git] / l4 / pkg / ferret / lib / common / convert.cc
1 /**
2  * \file   ferret/lib/util/convert.c
3  * \brief  Convert kernel tracebuffer entries to common header format.
4  *
5  * \date   09/12/2005
6  * \author Martin Pohlack  <mp26@os.inf.tu-dresden.de>
7  */
8 /*
9  * (c) 2005-2009 Technische Universität Dresden
10  * This file is part of TUD:OS and distributed under the terms of the
11  * GNU General Public License 2.
12  * Please see the COPYING-GPL-2 file for details.
13  */
14 #include <stdarg.h>
15 #include <stdint.h>
16 #include <string.h>
17
18 #include <l4/ferret/sensors/tbuf.h>
19 #include <l4/ferret/util.h>
20 #include <l4/ferret/types.h>
21
22 void ferret_util_convert_k2c(const l4_tracebuffer_entry_t * tb_e,
23                              ferret_list_entry_kernel_t * lec)
24 {
25     // common part for list entry
26     lec->timestamp = tb_e->tsc;
27     lec->major     = FERRET_TBUF_MAJOR;
28     lec->minor     = tb_e->type;
29     lec->instance  = FERRET_TBUF_INSTANCE;
30     lec->cpu       = 0;  // fixme: later
31
32     // common part for all kernel events
33     lec->context   = (void *)tb_e->context;  // thread
34     lec->eip       = tb_e->eip;
35     lec->pmc1      = tb_e->pmc1;
36     lec->pmc2      = tb_e->pmc2;
37
38     lec->data8[0]  = 0;  // padding byte
39
40     // kernel event specific parts, directly after padding byte
41     memcpy(&lec->data8[1], &tb_e->m, sizeof(tb_e->m.fit._pad));
42 }