genode/base-pistachio/include/pistachio/thread_helper.h
2011-12-22 16:19:25 +01:00

46 lines
1.0 KiB
C++

/*
* \brief Pistachio-specific thread helper functions
* \author Julian Stecklina
* \date 2008-02-20
*/
/*
* Copyright (C) 2008-2011 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__PISTACHIO__THREAD_HELPER_H_
#define _INCLUDE__PISTACHIO__THREAD_HELPER_H_
#include <base/printf.h>
namespace Pistachio
{
#include <l4/types.h>
inline void print_l4_threadid(L4_ThreadId_t t)
{
if (L4_IsLocalId(t)) {
Genode::printf("THREAD (local) %02lx (raw %08lx)\n",
t.local.X.local_id, t.raw);
} else if (L4_IsGlobalId(t)) {
Genode::printf("THREAD (global) %02lx (version %lx) (raw %08lx)\n",
t.global.X.thread_no, t.global.X.version, t.raw);
} else {
const char *name;
if (t == L4_nilthread) name = "nilthread";
else if (t == L4_anythread) name = "anythread";
else name = "???";
Genode::printf("THREAD (%s)\n", name);
}
}
}
#endif /* _INCLUDE__PISTACHIO__THREAD_HELPER_H_ */