base: remove 'Native_thread_id' type

Issue #1832
This commit is contained in:
Norman Feske
2016-03-08 17:44:54 +01:00
parent da16ecc002
commit 84bfb4c04c
31 changed files with 145 additions and 205 deletions

View File

@ -26,8 +26,6 @@ namespace Genode {
class Platform_thread; class Platform_thread;
typedef Fiasco::l4_threadid_t Native_thread_id;
struct Cap_dst_policy struct Cap_dst_policy
{ {
typedef Fiasco::l4_threadid_t Dst; typedef Fiasco::l4_threadid_t Dst;
@ -42,7 +40,7 @@ namespace Genode {
struct Native_thread struct Native_thread
{ {
Native_thread_id l4id; Fiasco::l4_threadid_t l4id;
/** /**
* Only used in core * Only used in core
@ -54,15 +52,6 @@ namespace Genode {
Platform_thread *pt; Platform_thread *pt;
}; };
inline unsigned long convert_native_thread_id_to_badge(Native_thread_id tid)
{
/*
* Fiasco has no server-defined badges for page-fault messages.
* Therefore, we have to interpret the sender ID as badge.
*/
return tid.raw;
}
typedef Native_capability_tpl<Cap_dst_policy> Native_capability; typedef Native_capability_tpl<Cap_dst_policy> Native_capability;
typedef Fiasco::l4_threadid_t Native_connection_state; typedef Fiasco::l4_threadid_t Native_connection_state;
} }

View File

@ -24,6 +24,9 @@
/* base-internal includes */ /* base-internal includes */
#include <base/internal/fiasco_thread_helper.h> #include <base/internal/fiasco_thread_helper.h>
/* core includes */
#include <util.h>
/* Fiasco includes */ /* Fiasco includes */
namespace Fiasco { namespace Fiasco {
#include <l4/sys/types.h> #include <l4/sys/types.h>
@ -91,7 +94,7 @@ namespace Genode {
{ {
private: private:
Native_thread_id _last; /* origin of last fault message */ Fiasco::l4_threadid_t _last; /* origin of last fault message */
addr_t _pf_addr; /* page-fault address */ addr_t _pf_addr; /* page-fault address */
addr_t _pf_ip; /* instruction pointer of faulter */ addr_t _pf_ip; /* instruction pointer of faulter */
Mapping _reply_mapping; /* page-fault answer */ Mapping _reply_mapping; /* page-fault answer */

View File

@ -40,7 +40,7 @@ namespace Genode {
*/ */
inline bool map_local(addr_t from_addr, addr_t to_addr, size_t num_pages) inline bool map_local(addr_t from_addr, addr_t to_addr, size_t num_pages)
{ {
Native_thread_id core_pager = platform_specific()->core_pager()->native_thread_id(); Fiasco::l4_threadid_t core_pager = platform_specific()->core_pager()->native_thread_id();
addr_t offset = 0; addr_t offset = 0;
size_t page_size = get_page_size(); size_t page_size = get_page_size();

View File

@ -36,7 +36,7 @@ namespace Genode {
private: private:
int _thread_id; /* plain thread number */ int _thread_id; /* plain thread number */
Native_thread_id _l4_thread_id; /* L4 thread ID */ Fiasco::l4_threadid_t _l4_thread_id; /* L4 thread ID */
char _name[32]; /* thread name that will be char _name[32]; /* thread name that will be
registered at the kernel registered at the kernel
debugger */ debugger */
@ -94,7 +94,7 @@ namespace Genode {
* \param l4_thread_id final L4 thread ID * \param l4_thread_id final L4 thread ID
* \param pd platform pd, thread is bound to * \param pd platform pd, thread is bound to
*/ */
void bind(int thread_id, Native_thread_id l4_thread_id, void bind(int thread_id, Fiasco::l4_threadid_t l4_thread_id,
Platform_pd *pd); Platform_pd *pd);
/** /**
@ -166,7 +166,7 @@ namespace Genode {
*******************************/ *******************************/
int thread_id() const { return _thread_id; } int thread_id() const { return _thread_id; }
Native_thread_id native_thread_id() const { return _l4_thread_id; } Fiasco::l4_threadid_t native_thread_id() const { return _l4_thread_id; }
const char *name() const { return _name; } const char *name() const { return _name; }
}; };
} }

View File

@ -103,7 +103,7 @@ namespace Genode {
Rm_session::Fault_type pf_type, Rm_session::Fault_type pf_type,
unsigned long badge) unsigned long badge)
{ {
Native_thread_id tid; Fiasco::l4_threadid_t tid;
tid.raw = badge; tid.raw = badge;
printf("%s (%s pf_addr=%p pf_ip=%p from %x.%02x)\n", msg, printf("%s (%s pf_addr=%p pf_ip=%p from %x.%02x)\n", msg,
pf_type == Rm_session::WRITE_FAULT ? "WRITE" : "READ", pf_type == Rm_session::WRITE_FAULT ? "WRITE" : "READ",
@ -115,6 +115,15 @@ namespace Genode {
return core_local_addr; } return core_local_addr; }
inline size_t constrain_map_size_log2(size_t size_log2) { return size_log2; } inline size_t constrain_map_size_log2(size_t size_log2) { return size_log2; }
inline unsigned long convert_native_thread_id_to_badge(Fiasco::l4_threadid_t tid)
{
/*
* Fiasco has no server-defined badges for page-fault messages.
* Therefore, we have to interpret the sender ID as badge.
*/
return tid.raw;
}
} }
#endif /* _CORE__INCLUDE__UTIL_H_ */ #endif /* _CORE__INCLUDE__UTIL_H_ */

View File

@ -80,9 +80,6 @@ namespace Fiasco {
namespace Genode { namespace Genode {
typedef Fiasco::l4_cap_idx_t Native_thread_id;
struct Native_thread struct Native_thread
{ {
Fiasco::l4_cap_idx_t kcap = 0; Fiasco::l4_cap_idx_t kcap = 0;

View File

@ -41,12 +41,12 @@ namespace Genode {
public: public:
Native_capability local; /* reference to cap that is mapped */ Native_capability local; /* reference to cap that is mapped */
Native_thread_id remote; /* index in cap-space of the other pd */ Fiasco::l4_cap_idx_t remote; /* index in cap-space of the other pd */
Cap_mapping(bool alloc=false, Cap_mapping(bool alloc=false,
Native_thread_id r = Fiasco::L4_INVALID_CAP); Fiasco::l4_cap_idx_t r = Fiasco::L4_INVALID_CAP);
Cap_mapping(Native_capability cap, Cap_mapping(Native_capability cap,
Native_thread_id r = Fiasco::L4_INVALID_CAP); Fiasco::l4_cap_idx_t r = Fiasco::L4_INVALID_CAP);
/** /**
* Map the cap in local to corresponding task. * Map the cap in local to corresponding task.

View File

@ -58,7 +58,7 @@ Core_cap_index* Cap_mapping::_get_cap()
} }
void Cap_mapping::map(Native_thread_id task) void Cap_mapping::map(Fiasco::l4_cap_idx_t task)
{ {
using namespace Fiasco; using namespace Fiasco;
@ -73,11 +73,11 @@ void Cap_mapping::map(Native_thread_id task)
} }
Cap_mapping::Cap_mapping(bool alloc, Native_thread_id r) Cap_mapping::Cap_mapping(bool alloc, Fiasco::l4_cap_idx_t r)
: local(alloc ? _get_cap() : 0), remote(r) { } : local(alloc ? _get_cap() : 0), remote(r) { }
Cap_mapping::Cap_mapping(Native_capability cap, Native_thread_id r) Cap_mapping::Cap_mapping(Native_capability cap, Fiasco::l4_cap_idx_t r)
: local(cap), remote(r) { } : local(cap), remote(r) { }

View File

@ -47,10 +47,10 @@ static inline void thread_yield() { Fiasco::l4_thread_yield(); }
*/ */
static inline bool thread_check_stopped_and_restart(Genode::Thread_base *thread_base) static inline bool thread_check_stopped_and_restart(Genode::Thread_base *thread_base)
{ {
Genode::Native_thread_id tid = thread_base ? Fiasco::l4_cap_idx_t tid = thread_base ?
thread_base->tid().kcap : thread_base->tid().kcap :
Fiasco::MAIN_THREAD_CAP; Fiasco::MAIN_THREAD_CAP;
Genode::Native_thread_id irq = tid + Fiasco::THREAD_IRQ_CAP; Fiasco::l4_cap_idx_t irq = tid + Fiasco::THREAD_IRQ_CAP;
Fiasco::l4_irq_trigger(irq); Fiasco::l4_irq_trigger(irq);
return true; return true;
} }
@ -61,7 +61,7 @@ static inline bool thread_check_stopped_and_restart(Genode::Thread_base *thread_
*/ */
static inline void thread_switch_to(Genode::Thread_base *thread_base) static inline void thread_switch_to(Genode::Thread_base *thread_base)
{ {
Genode::Native_thread_id tid = thread_base ? Fiasco::l4_cap_idx_t tid = thread_base ?
thread_base->tid().kcap : thread_base->tid().kcap :
Fiasco::MAIN_THREAD_CAP; Fiasco::MAIN_THREAD_CAP;
Fiasco::l4_thread_switch(tid); Fiasco::l4_thread_switch(tid);
@ -81,10 +81,10 @@ static void thread_stop_myself()
using namespace Fiasco; using namespace Fiasco;
Genode::Thread_base *myself = Genode::Thread_base::myself(); Genode::Thread_base *myself = Genode::Thread_base::myself();
Genode::Native_thread_id tid = myself ? Fiasco::l4_cap_idx_t tid = myself ?
myself->tid().kcap : myself->tid().kcap :
Fiasco::MAIN_THREAD_CAP; Fiasco::MAIN_THREAD_CAP;
Genode::Native_thread_id irq = tid + THREAD_IRQ_CAP; Fiasco::l4_cap_idx_t irq = tid + THREAD_IRQ_CAP;
l4_irq_receive(irq, L4_IPC_NEVER); l4_irq_receive(irq, L4_IPC_NEVER);
} }

View File

@ -26,7 +26,7 @@ int main(int argc, char **argv)
enum { COUNT = 1000 }; enum { COUNT = 1000 };
Cap_index* idx = cap_idx_alloc()->alloc_range(COUNT); Cap_index* idx = cap_idx_alloc()->alloc_range(COUNT);
Native_thread_id tid = env()->ram_session_cap().dst(); Fiasco::l4_cap_idx_t tid = env()->ram_session_cap().dst();
/* try the first 1000 local name IDs */ /* try the first 1000 local name IDs */
for (int local_name = 0; local_name < COUNT; local_name++, idx++) { for (int local_name = 0; local_name < COUNT; local_name++, idx++) {

View File

@ -26,8 +26,6 @@ namespace Genode
class Platform_thread; class Platform_thread;
class Native_thread; class Native_thread;
using Native_thread_id = Kernel::capid_t;
typedef int Native_connection_state; typedef int Native_connection_state;
/** /**

View File

@ -34,7 +34,7 @@ using namespace Genode;
enum enum
{ {
/* size of the callee-local name of a targeted RPC object */ /* size of the callee-local name of a targeted RPC object */
RPC_OBJECT_ID_SIZE = sizeof(Native_thread_id), RPC_OBJECT_ID_SIZE = sizeof(Kernel::capid_t),
/* /*
* The RPC framework marshalls a return value into reply messages to * The RPC framework marshalls a return value into reply messages to

View File

@ -32,7 +32,7 @@ static inline void thread_yield() {
/** /**
* Return kernel name of thread t * Return kernel name of thread t
*/ */
static inline Genode::Native_thread_id static inline Kernel::capid_t
native_thread_id(Genode::Thread_base * const t) native_thread_id(Genode::Thread_base * const t)
{ {
return t ? t->tid().cap.dst() : Hw::_main_thread_cap.dst(); return t ? t->tid().cap.dst() : Hw::_main_thread_cap.dst();

View File

@ -21,61 +21,38 @@
namespace Genode { namespace Genode {
/** /**
* Thread ID * Native thread contains more thread-local data than just the ID
* */
struct Native_thread
{
/*
* Unfortunately, both - PID and TID - are needed for lx_tgkill() * Unfortunately, both - PID and TID - are needed for lx_tgkill()
*/ */
struct Native_thread_id unsigned int tid = 0; /* Native thread ID type as returned by the
{
unsigned int tid; /* Native thread ID type as returned by the
'clone' system call */ 'clone' system call */
unsigned int pid; /* process ID (resp. thread-group ID) */ unsigned int pid = 0; /* process ID (resp. thread-group ID) */
Native_thread_id() : tid(0), pid(0) { } bool is_ipc_server = false;
Native_thread_id(unsigned int tid, unsigned int pid)
: tid(tid), pid(pid) { }
};
struct Thread_meta_data;
/**
* Native thread contains more thread-local data than just the ID
*
* FIXME doc
* A thread needs two sockets as it may be a server that depends on another
* service during request processing. If the server socket would be used for
* the client call, the server thread may be unblocked by further requests
* from its clients. In other words, the additional client socket provides
* closed-receive semantics in calls. An even better solution is to use
* SCM_RIGHTS messages to send a client socket descriptor with the request.
*/
struct Native_thread : Native_thread_id
{
bool is_ipc_server;
/** /**
* Natively aligned memory location used in the lock implementation * Natively aligned memory location used in the lock implementation
*/ */
int futex_counter __attribute__((aligned(sizeof(Genode::addr_t)))); int futex_counter __attribute__((aligned(sizeof(Genode::addr_t)))) = 0;
struct Meta_data;
/** /**
* Opaque pointer to additional thread-specific meta data * Opaque pointer to additional thread-specific meta data
* *
* This pointer is used by hybrid Linux/Genode program to maintain * This pointer is used by hybrid Linux/Genode programs to maintain
* POSIX-thread-related meta data. For non-hybrid Genode programs, it * POSIX-thread-related meta data. For non-hybrid Genode programs, it
* remains unused. * remains unused.
*/ */
Thread_meta_data *meta_data; Meta_data *meta_data = nullptr;
Native_thread() : is_ipc_server(false), futex_counter(0), meta_data(0) { } Native_thread() { }
}; };
inline bool operator == (Native_thread_id t1, Native_thread_id t2) {
return (t1.tid == t2.tid) && (t1.pid == t2.pid); }
inline bool operator != (Native_thread_id t1, Native_thread_id t2) {
return (t1.tid != t2.tid) || (t1.pid != t2.pid); }
struct Cap_dst_policy struct Cap_dst_policy
{ {
struct Dst struct Dst

View File

@ -134,7 +134,7 @@ static pthread_key_t tls_key()
namespace Genode { namespace Genode {
struct Thread_meta_data struct Native_thread::Meta_data
{ {
/** /**
* Filled out by 'thread_start' function in the stack of the new * Filled out by 'thread_start' function in the stack of the new
@ -152,7 +152,7 @@ namespace Genode {
* *
* \param thread associated 'Thread_base' object * \param thread associated 'Thread_base' object
*/ */
Thread_meta_data(Thread_base *thread) : thread_base(thread) { } Meta_data(Thread_base *thread) : thread_base(thread) { }
/** /**
* Used to block the constructor until the new thread has initialized * Used to block the constructor until the new thread has initialized
@ -177,7 +177,7 @@ namespace Genode {
/* /*
* Thread meta data for a thread created by Genode * Thread meta data for a thread created by Genode
*/ */
class Thread_meta_data_created : public Thread_meta_data class Thread_meta_data_created : public Native_thread::Meta_data
{ {
private: private:
@ -204,7 +204,8 @@ namespace Genode {
public: public:
Thread_meta_data_created(Thread_base *thread) : Thread_meta_data(thread) { } Thread_meta_data_created(Thread_base *thread)
: Native_thread::Meta_data(thread) { }
void wait_for_construction() void wait_for_construction()
{ {
@ -240,11 +241,12 @@ namespace Genode {
/* /*
* Thread meta data for an adopted thread * Thread meta data for an adopted thread
*/ */
class Thread_meta_data_adopted : public Thread_meta_data class Thread_meta_data_adopted : public Native_thread::Meta_data
{ {
public: public:
Thread_meta_data_adopted(Thread_base *thread) : Thread_meta_data(thread) { } Thread_meta_data_adopted(Thread_base *thread)
: Native_thread::Meta_data(thread) { }
void wait_for_construction() void wait_for_construction()
{ {
@ -296,7 +298,7 @@ Linux_cpu_session *cpu_session(Cpu_session * cpu_session)
} }
static void adopt_thread(Thread_meta_data *meta_data) static void adopt_thread(Native_thread::Meta_data *meta_data)
{ {
/* /*
* Set signal handler such that canceled system calls get not * Set signal handler such that canceled system calls get not
@ -309,7 +311,7 @@ static void adopt_thread(Thread_meta_data *meta_data)
*/ */
lx_sigaction(LX_SIGCHLD, (void (*)(int))1); lx_sigaction(LX_SIGCHLD, (void (*)(int))1);
/* assign 'Thread_meta_data' pointer to TLS entry */ /* assign 'Native_thread::Meta_data' pointer to TLS entry */
pthread_setspecific(tls_key(), meta_data); pthread_setspecific(tls_key(), meta_data);
/* enable immediate cancellation when calling 'pthread_cancel' */ /* enable immediate cancellation when calling 'pthread_cancel' */
@ -326,7 +328,7 @@ static void adopt_thread(Thread_meta_data *meta_data)
static void *thread_start(void *arg) static void *thread_start(void *arg)
{ {
Thread_meta_data *meta_data = (Thread_meta_data *)arg; Native_thread::Meta_data *meta_data = (Native_thread::Meta_data *)arg;
adopt_thread(meta_data); adopt_thread(meta_data);
@ -351,7 +353,7 @@ Thread_base *Thread_base::myself()
void * const tls = pthread_getspecific(tls_key()); void * const tls = pthread_getspecific(tls_key());
if (tls != 0) if (tls != 0)
return ((Thread_meta_data *)tls)->thread_base; return ((Native_thread::Meta_data *)tls)->thread_base;
bool const is_main_thread = (lx_getpid() == lx_gettid()); bool const is_main_thread = (lx_getpid() == lx_gettid());
if (is_main_thread) if (is_main_thread)
@ -378,7 +380,7 @@ Thread_base *Thread_base::myself()
*/ */
Thread_base *thread = (Thread_base *)malloc(sizeof(Thread_base)); Thread_base *thread = (Thread_base *)malloc(sizeof(Thread_base));
memset(thread, 0, sizeof(*thread)); memset(thread, 0, sizeof(*thread));
Thread_meta_data *meta_data = new Thread_meta_data_adopted(thread); Native_thread::Meta_data *meta_data = new Thread_meta_data_adopted(thread);
/* /*
* Initialize 'Thread_base::_tid' using the default constructor of * Initialize 'Thread_base::_tid' using the default constructor of

View File

@ -36,20 +36,6 @@ namespace Genode {
exc_pt_sel (INVALID_INDEX), is_vcpu(false) {} exc_pt_sel (INVALID_INDEX), is_vcpu(false) {}
}; };
typedef Native_thread Native_thread_id;
inline bool operator == (Native_thread_id t1, Native_thread_id t2)
{
return (t1.ec_sel == t2.ec_sel) &&
(t1.exc_pt_sel == t2.exc_pt_sel);
}
inline bool operator != (Native_thread_id t1, Native_thread_id t2)
{
return (t1.ec_sel != t2.ec_sel) &&
(t1.exc_pt_sel != t2.exc_pt_sel);
}
class Native_capability class Native_capability
{ {
public: public:

View File

@ -31,26 +31,9 @@ namespace Genode {
*/ */
enum { UTCB_TCR_THREAD_WORD_MYSELF = 0 }; enum { UTCB_TCR_THREAD_WORD_MYSELF = 0 };
namespace Thread_id_bits {
/*
* L4 thread ID has 18 bits for thread number and 14 bits for
* version info.
*/
enum { PD = 8, THREAD = 5 };
}
typedef Okl4::L4_ThreadId_t Native_thread_id;
inline bool operator == (Native_thread_id t1, Native_thread_id t2) {
return t1.raw == t2.raw; }
inline bool operator != (Native_thread_id t1, Native_thread_id t2) {
return t1.raw != t2.raw; }
struct Native_thread struct Native_thread
{ {
Native_thread_id l4id; Okl4::L4_ThreadId_t l4id;
/** /**
* Only used in core * Only used in core
@ -62,15 +45,6 @@ namespace Genode {
Platform_thread *pt; Platform_thread *pt;
}; };
inline unsigned long convert_native_thread_id_to_badge(Native_thread_id tid)
{
/*
* OKL4 has no server-defined badges for page-fault messages.
* Therefore, we have to interpret the sender ID as badge.
*/
return tid.raw;
}
struct Cap_dst_policy struct Cap_dst_policy
{ {
typedef Okl4::L4_ThreadId_t Dst; typedef Okl4::L4_ThreadId_t Dst;

View File

@ -25,7 +25,7 @@ namespace Okl4
} }
} }
Genode::Native_thread_id main_thread_tid; Okl4::L4_ThreadId_t main_thread_tid;
/******************* /*******************

View File

@ -18,7 +18,6 @@
#include <base/allocator.h> #include <base/allocator.h>
/* core includes */ /* core includes */
#include <platform_thread.h>
#include <address_space.h> #include <address_space.h>
namespace Okl4 { extern "C" { namespace Okl4 { extern "C" {
@ -27,6 +26,15 @@ namespace Okl4 { extern "C" {
namespace Genode { namespace Genode {
namespace Thread_id_bits {
/*
* L4 thread ID has 18 bits for thread number and 14 bits for
* version info.
*/
enum { PD = 8, THREAD = 5 };
}
class Platform_thread; class Platform_thread;
class Platform_pd : public Address_space class Platform_pd : public Address_space
{ {
@ -45,7 +53,7 @@ namespace Genode {
/** /**
* Manually construct L4 thread ID from its components * Manually construct L4 thread ID from its components
*/ */
static Native_thread_id make_l4_id(unsigned space_no, static Okl4::L4_ThreadId_t make_l4_id(unsigned space_no,
unsigned thread_no) unsigned thread_no)
{ {
/* /*

View File

@ -31,7 +31,7 @@ namespace Genode {
private: private:
int _thread_id; /* plain thread number */ int _thread_id; /* plain thread number */
Native_thread_id _l4_thread_id; /* L4 thread ID */ Okl4::L4_ThreadId_t _l4_thread_id; /* L4 thread ID */
char _name[32]; /* thread name that will be char _name[32]; /* thread name that will be
registered at the kernel registered at the kernel
debugger */ debugger */
@ -91,7 +91,7 @@ namespace Genode {
* \param l4_thread_id final L4 thread ID * \param l4_thread_id final L4 thread ID
* \param pd platform pd, thread is bound to * \param pd platform pd, thread is bound to
*/ */
void bind(int thread_id, Native_thread_id l4_thread_id, void bind(int thread_id, Okl4::L4_ThreadId_t l4_thread_id,
Platform_pd *pd); Platform_pd *pd);
/** /**
@ -163,10 +163,10 @@ namespace Genode {
*****************************/ *****************************/
int thread_id() const { return _thread_id; } int thread_id() const { return _thread_id; }
Native_thread_id native_thread_id() const { return _l4_thread_id; } Okl4::L4_ThreadId_t native_thread_id() const { return _l4_thread_id; }
const char *name() const { return _name; } const char *name() const { return _name; }
void set_l4_thread_id(Native_thread_id id) { _l4_thread_id = id; } void set_l4_thread_id(Okl4::L4_ThreadId_t id) { _l4_thread_id = id; }
}; };
} }

View File

@ -14,9 +14,10 @@
/* Genode includes */ /* Genode includes */
#include <base/printf.h> #include <base/printf.h>
/* Core includes */ /* core includes */
#include <ipc_pager.h> #include <ipc_pager.h>
#include <pager.h> #include <pager.h>
#include <platform_thread.h>
namespace Okl4 { extern "C" { namespace Okl4 { extern "C" {
#include <l4/message.h> #include <l4/message.h>

View File

@ -17,6 +17,7 @@
/* core includes */ /* core includes */
#include <util.h> #include <util.h>
#include <platform_pd.h> #include <platform_pd.h>
#include <platform_thread.h>
#include <platform.h> #include <platform.h>
/* OKL4 includes */ /* OKL4 includes */

View File

@ -34,7 +34,7 @@ namespace Okl4 { extern "C" {
static inline void thread_yield() { Okl4::L4_Yield(); } static inline void thread_yield() { Okl4::L4_Yield(); }
extern Genode::Native_thread_id main_thread_tid; extern Okl4::L4_ThreadId_t main_thread_tid;
/** /**
@ -54,7 +54,7 @@ static inline bool thread_check_stopped_and_restart(Genode::Thread_base *thread_
L4_ThreadId_t dummy_id; L4_ThreadId_t dummy_id;
L4_ThreadState_t state; L4_ThreadState_t state;
Genode::Native_thread_id tid = thread_base ? Okl4::L4_ThreadId_t tid = thread_base ?
thread_base->tid().l4id : thread_base->tid().l4id :
main_thread_tid; main_thread_tid;
@ -71,7 +71,7 @@ static inline bool thread_check_stopped_and_restart(Genode::Thread_base *thread_
*/ */
static inline void thread_switch_to(Genode::Thread_base *thread_base) static inline void thread_switch_to(Genode::Thread_base *thread_base)
{ {
Genode::Native_thread_id tid = thread_base ? Okl4::L4_ThreadId_t tid = thread_base ?
thread_base->tid().l4id : thread_base->tid().l4id :
main_thread_tid; main_thread_tid;
Okl4::L4_ThreadSwitch(tid); Okl4::L4_ThreadSwitch(tid);
@ -84,7 +84,7 @@ static inline void thread_switch_to(Genode::Thread_base *thread_base)
static inline void thread_stop_myself() static inline void thread_stop_myself()
{ {
Genode::Thread_base *myself = Genode::Thread_base::myself(); Genode::Thread_base *myself = Genode::Thread_base::myself();
Genode::Native_thread_id tid = myself ? Okl4::L4_ThreadId_t tid = myself ?
myself->tid().l4id : myself->tid().l4id :
main_thread_tid; main_thread_tid;
Okl4::L4_Stop(tid); Okl4::L4_Stop(tid);

View File

@ -25,8 +25,6 @@ namespace Genode {
class Platform_thread; class Platform_thread;
typedef Pistachio::L4_ThreadId_t Native_thread_id;
struct Cap_dst_policy struct Cap_dst_policy
{ {
typedef Pistachio::L4_ThreadId_t Dst; typedef Pistachio::L4_ThreadId_t Dst;
@ -41,7 +39,7 @@ namespace Genode {
struct Native_thread struct Native_thread
{ {
Native_thread_id l4id; Pistachio::L4_ThreadId_t l4id;
/** /**
* Only used in core * Only used in core

View File

@ -16,12 +16,11 @@
#include <base/env.h> #include <base/env.h>
/* Pistachio includes */ /* Pistachio includes */
namespace Pistachio namespace Pistachio {
{
#include <l4/thread.h> #include <l4/thread.h>
} }
Genode::Native_thread_id main_thread_tid; Pistachio::L4_ThreadId_t main_thread_tid;
/***************************** /*****************************

View File

@ -42,7 +42,7 @@ namespace Genode {
inline static bool map_local(addr_t from_addr, addr_t to_addr, size_t num_pages) inline static bool map_local(addr_t from_addr, addr_t to_addr, size_t num_pages)
{ {
Native_thread_id core_pager = platform_specific()->core_pager()->native_thread_id(); Pistachio::L4_ThreadId_t core_pager = platform_specific()->core_pager()->native_thread_id();
addr_t offset = 0; addr_t offset = 0;
size_t page_size = get_page_size(); size_t page_size = get_page_size();

View File

@ -29,7 +29,7 @@ namespace Pistachio {
} }
inline unsigned long convert_native_thread_id_to_badge(Genode::Native_thread_id tid) inline unsigned long convert_native_thread_id_to_badge(Pistachio::L4_ThreadId_t tid)
{ {
/* /*
* Pistachio has no server-defined badges for page-fault messages. * Pistachio has no server-defined badges for page-fault messages.
@ -47,7 +47,7 @@ namespace Genode {
private: private:
int _thread_id; /* plain thread number */ int _thread_id; /* plain thread number */
Native_thread_id _l4_thread_id; /* L4 thread ID */ Pistachio::L4_ThreadId_t _l4_thread_id; /* L4 thread ID */
char _name[32]; /* thread name that will be char _name[32]; /* thread name that will be
registered at the kernel registered at the kernel
debugger */ debugger */
@ -107,7 +107,7 @@ namespace Genode {
* \param l4_thread_id final L4 thread ID * \param l4_thread_id final L4 thread ID
* \param pd platform pd, thread is bound to * \param pd platform pd, thread is bound to
*/ */
void bind(int thread_id, Native_thread_id l4_thread_id, void bind(int thread_id, Pistachio::L4_ThreadId_t l4_thread_id,
Platform_pd *pd); Platform_pd *pd);
/** /**
@ -175,11 +175,11 @@ namespace Genode {
**********************************/ **********************************/
int thread_id() const { return _thread_id; } int thread_id() const { return _thread_id; }
Native_thread_id native_thread_id() const { return _l4_thread_id; } Pistachio::L4_ThreadId_t native_thread_id() const { return _l4_thread_id; }
const char *name() const { return _name; } const char *name() const { return _name; }
/* use only for core... */ /* use only for core... */
void set_l4_thread_id(Native_thread_id id) { _l4_thread_id = id; } void set_l4_thread_id(Pistachio::L4_ThreadId_t id) { _l4_thread_id = id; }
}; };
} }

View File

@ -110,7 +110,7 @@ namespace Genode {
Rm_session::Fault_type pf_type, Rm_session::Fault_type pf_type,
unsigned long badge) unsigned long badge)
{ {
Native_thread_id tid; Pistachio::L4_ThreadId_t tid;
tid.raw = badge; tid.raw = badge;
printf("%s (%s pf_addr=%p pf_ip=%p from %02lx (raw %08lx))\n", msg, printf("%s (%s pf_addr=%p pf_ip=%p from %02lx (raw %08lx))\n", msg,
pf_type == Rm_session::WRITE_FAULT ? "WRITE" : "READ", pf_type == Rm_session::WRITE_FAULT ? "WRITE" : "READ",

View File

@ -28,7 +28,7 @@ namespace Pistachio {
} }
extern Genode::Native_thread_id main_thread_tid; extern Pistachio::L4_ThreadId_t main_thread_tid;
/** /**
@ -54,7 +54,7 @@ static inline bool thread_check_stopped_and_restart(Genode::Thread_base *thread_
L4_ThreadId_t dummy_id; L4_ThreadId_t dummy_id;
L4_ThreadState_t state; L4_ThreadState_t state;
Genode::Native_thread_id tid = thread_base ? Pistachio::L4_ThreadId_t tid = thread_base ?
thread_base->tid().l4id : thread_base->tid().l4id :
main_thread_tid; main_thread_tid;
@ -72,7 +72,7 @@ static inline bool thread_check_stopped_and_restart(Genode::Thread_base *thread_
*/ */
static inline void thread_switch_to(Genode::Thread_base *thread_base) static inline void thread_switch_to(Genode::Thread_base *thread_base)
{ {
Genode::Native_thread_id tid = thread_base ? Pistachio::L4_ThreadId_t tid = thread_base ?
thread_base->tid().l4id : thread_base->tid().l4id :
main_thread_tid; main_thread_tid;
Pistachio::L4_ThreadSwitch(tid); Pistachio::L4_ThreadSwitch(tid);
@ -85,7 +85,7 @@ static inline void thread_switch_to(Genode::Thread_base *thread_base)
static inline void thread_stop_myself() static inline void thread_stop_myself()
{ {
Genode::Thread_base *myself = Genode::Thread_base::myself(); Genode::Thread_base *myself = Genode::Thread_base::myself();
Genode::Native_thread_id tid = myself ? Pistachio::L4_ThreadId_t tid = myself ?
myself->tid().l4id : myself->tid().l4id :
main_thread_tid; main_thread_tid;
Pistachio::L4_Stop(tid); Pistachio::L4_Stop(tid);

View File

@ -19,8 +19,6 @@
namespace Genode { namespace Genode {
typedef int Native_thread_id;
struct Native_thread struct Native_thread
{ {
unsigned tcb_sel = 0; unsigned tcb_sel = 0;

View File

@ -75,7 +75,7 @@ namespace Genode {
{ {
private: private:
Native_thread_id _last; /* faulted thread */ addr_t _last; /* faulted thread ID */
addr_t _pf_addr; /* page-fault address */ addr_t _pf_addr; /* page-fault address */
addr_t _pf_ip; /* instruction pointer of faulter */ addr_t _pf_ip; /* instruction pointer of faulter */
bool _pf_write; /* true on write fault */ bool _pf_write; /* true on write fault */