mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-07 19:34:56 +00:00
parent
da16ecc002
commit
84bfb4c04c
@ -26,8 +26,6 @@ namespace Genode {
|
||||
|
||||
class Platform_thread;
|
||||
|
||||
typedef Fiasco::l4_threadid_t Native_thread_id;
|
||||
|
||||
struct Cap_dst_policy
|
||||
{
|
||||
typedef Fiasco::l4_threadid_t Dst;
|
||||
@ -42,7 +40,7 @@ namespace Genode {
|
||||
|
||||
struct Native_thread
|
||||
{
|
||||
Native_thread_id l4id;
|
||||
Fiasco::l4_threadid_t l4id;
|
||||
|
||||
/**
|
||||
* Only used in core
|
||||
@ -54,15 +52,6 @@ namespace Genode {
|
||||
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 Fiasco::l4_threadid_t Native_connection_state;
|
||||
}
|
||||
|
@ -24,6 +24,9 @@
|
||||
/* base-internal includes */
|
||||
#include <base/internal/fiasco_thread_helper.h>
|
||||
|
||||
/* core includes */
|
||||
#include <util.h>
|
||||
|
||||
/* Fiasco includes */
|
||||
namespace Fiasco {
|
||||
#include <l4/sys/types.h>
|
||||
@ -91,10 +94,10 @@ namespace Genode {
|
||||
{
|
||||
private:
|
||||
|
||||
Native_thread_id _last; /* origin of last fault message */
|
||||
addr_t _pf_addr; /* page-fault address */
|
||||
addr_t _pf_ip; /* instruction pointer of faulter */
|
||||
Mapping _reply_mapping; /* page-fault answer */
|
||||
Fiasco::l4_threadid_t _last; /* origin of last fault message */
|
||||
addr_t _pf_addr; /* page-fault address */
|
||||
addr_t _pf_ip; /* instruction pointer of faulter */
|
||||
Mapping _reply_mapping; /* page-fault answer */
|
||||
|
||||
public:
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace Genode {
|
||||
*/
|
||||
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;
|
||||
size_t page_size = get_page_size();
|
||||
|
@ -35,14 +35,14 @@ namespace Genode {
|
||||
{
|
||||
private:
|
||||
|
||||
int _thread_id; /* plain thread number */
|
||||
Native_thread_id _l4_thread_id; /* L4 thread ID */
|
||||
char _name[32]; /* thread name that will be
|
||||
registered at the kernel
|
||||
debugger */
|
||||
Platform_pd *_platform_pd; /* protection domain thread
|
||||
is bound to */
|
||||
Pager_object *_pager;
|
||||
int _thread_id; /* plain thread number */
|
||||
Fiasco::l4_threadid_t _l4_thread_id; /* L4 thread ID */
|
||||
char _name[32]; /* thread name that will be
|
||||
registered at the kernel
|
||||
debugger */
|
||||
Platform_pd *_platform_pd; /* protection domain thread
|
||||
is bound to */
|
||||
Pager_object *_pager;
|
||||
|
||||
public:
|
||||
|
||||
@ -94,7 +94,7 @@ namespace Genode {
|
||||
* \param l4_thread_id final L4 thread ID
|
||||
* \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);
|
||||
|
||||
/**
|
||||
@ -165,9 +165,9 @@ namespace Genode {
|
||||
** Fiasco-specific Accessors **
|
||||
*******************************/
|
||||
|
||||
int thread_id() const { return _thread_id; }
|
||||
Native_thread_id native_thread_id() const { return _l4_thread_id; }
|
||||
const char *name() const { return _name; }
|
||||
int thread_id() const { return _thread_id; }
|
||||
Fiasco::l4_threadid_t native_thread_id() const { return _l4_thread_id; }
|
||||
const char *name() const { return _name; }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ namespace Genode {
|
||||
Rm_session::Fault_type pf_type,
|
||||
unsigned long badge)
|
||||
{
|
||||
Native_thread_id tid;
|
||||
Fiasco::l4_threadid_t tid;
|
||||
tid.raw = badge;
|
||||
printf("%s (%s pf_addr=%p pf_ip=%p from %x.%02x)\n", msg,
|
||||
pf_type == Rm_session::WRITE_FAULT ? "WRITE" : "READ",
|
||||
@ -115,6 +115,15 @@ namespace Genode {
|
||||
return core_local_addr; }
|
||||
|
||||
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_ */
|
||||
|
@ -80,9 +80,6 @@ namespace Fiasco {
|
||||
|
||||
namespace Genode {
|
||||
|
||||
typedef Fiasco::l4_cap_idx_t Native_thread_id;
|
||||
|
||||
|
||||
struct Native_thread
|
||||
{
|
||||
Fiasco::l4_cap_idx_t kcap = 0;
|
||||
|
@ -40,13 +40,13 @@ namespace Genode {
|
||||
|
||||
public:
|
||||
|
||||
Native_capability local; /* reference to cap that is mapped */
|
||||
Native_thread_id remote; /* index in cap-space of the other pd */
|
||||
Native_capability local; /* reference to cap that is mapped */
|
||||
Fiasco::l4_cap_idx_t remote; /* index in cap-space of the other pd */
|
||||
|
||||
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,
|
||||
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.
|
||||
|
@ -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;
|
||||
|
||||
@ -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) { }
|
||||
|
||||
|
||||
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) { }
|
||||
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
Genode::Native_thread_id tid = thread_base ?
|
||||
thread_base->tid().kcap :
|
||||
Fiasco::MAIN_THREAD_CAP;
|
||||
Genode::Native_thread_id irq = tid + Fiasco::THREAD_IRQ_CAP;
|
||||
Fiasco::l4_cap_idx_t tid = thread_base ?
|
||||
thread_base->tid().kcap :
|
||||
Fiasco::MAIN_THREAD_CAP;
|
||||
Fiasco::l4_cap_idx_t irq = tid + Fiasco::THREAD_IRQ_CAP;
|
||||
Fiasco::l4_irq_trigger(irq);
|
||||
return true;
|
||||
}
|
||||
@ -61,9 +61,9 @@ static inline bool thread_check_stopped_and_restart(Genode::Thread_base *thread_
|
||||
*/
|
||||
static inline void thread_switch_to(Genode::Thread_base *thread_base)
|
||||
{
|
||||
Genode::Native_thread_id tid = thread_base ?
|
||||
thread_base->tid().kcap :
|
||||
Fiasco::MAIN_THREAD_CAP;
|
||||
Fiasco::l4_cap_idx_t tid = thread_base ?
|
||||
thread_base->tid().kcap :
|
||||
Fiasco::MAIN_THREAD_CAP;
|
||||
Fiasco::l4_thread_switch(tid);
|
||||
}
|
||||
|
||||
@ -81,10 +81,10 @@ static void thread_stop_myself()
|
||||
using namespace Fiasco;
|
||||
|
||||
Genode::Thread_base *myself = Genode::Thread_base::myself();
|
||||
Genode::Native_thread_id tid = myself ?
|
||||
myself->tid().kcap :
|
||||
Fiasco::MAIN_THREAD_CAP;
|
||||
Genode::Native_thread_id irq = tid + THREAD_IRQ_CAP;
|
||||
Fiasco::l4_cap_idx_t tid = myself ?
|
||||
myself->tid().kcap :
|
||||
Fiasco::MAIN_THREAD_CAP;
|
||||
Fiasco::l4_cap_idx_t irq = tid + THREAD_IRQ_CAP;
|
||||
l4_irq_receive(irq, L4_IPC_NEVER);
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ int main(int argc, char **argv)
|
||||
|
||||
enum { COUNT = 1000 };
|
||||
|
||||
Cap_index* idx = cap_idx_alloc()->alloc_range(COUNT);
|
||||
Native_thread_id tid = env()->ram_session_cap().dst();
|
||||
Cap_index* idx = cap_idx_alloc()->alloc_range(COUNT);
|
||||
Fiasco::l4_cap_idx_t tid = env()->ram_session_cap().dst();
|
||||
|
||||
/* try the first 1000 local name IDs */
|
||||
for (int local_name = 0; local_name < COUNT; local_name++, idx++) {
|
||||
|
@ -26,8 +26,6 @@ namespace Genode
|
||||
class Platform_thread;
|
||||
class Native_thread;
|
||||
|
||||
using Native_thread_id = Kernel::capid_t;
|
||||
|
||||
typedef int Native_connection_state;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ using namespace Genode;
|
||||
enum
|
||||
{
|
||||
/* 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
|
||||
|
@ -32,7 +32,7 @@ static inline void thread_yield() {
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
return t ? t->tid().cap.dst() : Hw::_main_thread_cap.dst();
|
||||
|
@ -20,62 +20,39 @@
|
||||
|
||||
namespace Genode {
|
||||
|
||||
/**
|
||||
* Thread ID
|
||||
*
|
||||
* Unfortunately, both - PID and TID - are needed for lx_tgkill()
|
||||
*/
|
||||
struct Native_thread_id
|
||||
{
|
||||
unsigned int tid; /* Native thread ID type as returned by the
|
||||
'clone' system call */
|
||||
unsigned int pid; /* process ID (resp. thread-group ID) */
|
||||
|
||||
Native_thread_id() : tid(0), pid(0) { }
|
||||
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
|
||||
struct Native_thread
|
||||
{
|
||||
bool is_ipc_server;
|
||||
/*
|
||||
* Unfortunately, both - PID and TID - are needed for lx_tgkill()
|
||||
*/
|
||||
unsigned int tid = 0; /* Native thread ID type as returned by the
|
||||
'clone' system call */
|
||||
unsigned int pid = 0; /* process ID (resp. thread-group ID) */
|
||||
|
||||
bool is_ipc_server = false;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
* 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 Dst
|
||||
|
@ -134,7 +134,7 @@ static pthread_key_t tls_key()
|
||||
|
||||
namespace Genode {
|
||||
|
||||
struct Thread_meta_data
|
||||
struct Native_thread::Meta_data
|
||||
{
|
||||
/**
|
||||
* Filled out by 'thread_start' function in the stack of the new
|
||||
@ -152,7 +152,7 @@ namespace Genode {
|
||||
*
|
||||
* \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
|
||||
@ -177,7 +177,7 @@ namespace 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:
|
||||
|
||||
@ -204,7 +204,8 @@ namespace Genode {
|
||||
|
||||
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()
|
||||
{
|
||||
@ -240,11 +241,12 @@ namespace Genode {
|
||||
/*
|
||||
* 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:
|
||||
|
||||
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()
|
||||
{
|
||||
@ -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
|
||||
@ -309,7 +311,7 @@ static void adopt_thread(Thread_meta_data *meta_data)
|
||||
*/
|
||||
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);
|
||||
|
||||
/* 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)
|
||||
{
|
||||
Thread_meta_data *meta_data = (Thread_meta_data *)arg;
|
||||
Native_thread::Meta_data *meta_data = (Native_thread::Meta_data *)arg;
|
||||
|
||||
adopt_thread(meta_data);
|
||||
|
||||
@ -351,7 +353,7 @@ Thread_base *Thread_base::myself()
|
||||
void * const tls = pthread_getspecific(tls_key());
|
||||
|
||||
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());
|
||||
if (is_main_thread)
|
||||
@ -378,7 +380,7 @@ Thread_base *Thread_base::myself()
|
||||
*/
|
||||
Thread_base *thread = (Thread_base *)malloc(sizeof(Thread_base));
|
||||
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
|
||||
|
@ -36,20 +36,6 @@ namespace Genode {
|
||||
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
|
||||
{
|
||||
public:
|
||||
|
@ -31,26 +31,9 @@ namespace Genode {
|
||||
*/
|
||||
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
|
||||
{
|
||||
Native_thread_id l4id;
|
||||
Okl4::L4_ThreadId_t l4id;
|
||||
|
||||
/**
|
||||
* Only used in core
|
||||
@ -62,15 +45,6 @@ namespace Genode {
|
||||
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
|
||||
{
|
||||
typedef Okl4::L4_ThreadId_t Dst;
|
||||
|
@ -25,7 +25,7 @@ namespace Okl4
|
||||
}
|
||||
}
|
||||
|
||||
Genode::Native_thread_id main_thread_tid;
|
||||
Okl4::L4_ThreadId_t main_thread_tid;
|
||||
|
||||
|
||||
/*******************
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <base/allocator.h>
|
||||
|
||||
/* core includes */
|
||||
#include <platform_thread.h>
|
||||
#include <address_space.h>
|
||||
|
||||
namespace Okl4 { extern "C" {
|
||||
@ -27,6 +26,15 @@ namespace Okl4 { extern "C" {
|
||||
|
||||
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_pd : public Address_space
|
||||
{
|
||||
@ -45,8 +53,8 @@ namespace Genode {
|
||||
/**
|
||||
* Manually construct L4 thread ID from its components
|
||||
*/
|
||||
static Native_thread_id make_l4_id(unsigned space_no,
|
||||
unsigned thread_no)
|
||||
static Okl4::L4_ThreadId_t make_l4_id(unsigned space_no,
|
||||
unsigned thread_no)
|
||||
{
|
||||
/*
|
||||
* On OKL4, version must be set to 1
|
||||
|
@ -30,15 +30,15 @@ namespace Genode {
|
||||
{
|
||||
private:
|
||||
|
||||
int _thread_id; /* plain thread number */
|
||||
Native_thread_id _l4_thread_id; /* L4 thread ID */
|
||||
char _name[32]; /* thread name that will be
|
||||
int _thread_id; /* plain thread number */
|
||||
Okl4::L4_ThreadId_t _l4_thread_id; /* L4 thread ID */
|
||||
char _name[32]; /* thread name that will be
|
||||
registered at the kernel
|
||||
debugger */
|
||||
Platform_pd *_platform_pd; /* protection domain thread
|
||||
is bound to */
|
||||
unsigned _priority; /* thread priority */
|
||||
Pager_object *_pager;
|
||||
Platform_pd *_platform_pd; /* protection domain thread
|
||||
is bound to */
|
||||
unsigned _priority; /* thread priority */
|
||||
Pager_object *_pager;
|
||||
|
||||
public:
|
||||
|
||||
@ -91,7 +91,7 @@ namespace Genode {
|
||||
* \param l4_thread_id final L4 thread ID
|
||||
* \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);
|
||||
|
||||
/**
|
||||
@ -162,11 +162,11 @@ namespace Genode {
|
||||
** OKL4-specific Accessors **
|
||||
*****************************/
|
||||
|
||||
int thread_id() const { return _thread_id; }
|
||||
Native_thread_id native_thread_id() const { return _l4_thread_id; }
|
||||
const char *name() const { return _name; }
|
||||
int thread_id() const { return _thread_id; }
|
||||
Okl4::L4_ThreadId_t native_thread_id() const { return _l4_thread_id; }
|
||||
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; }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -14,9 +14,10 @@
|
||||
/* Genode includes */
|
||||
#include <base/printf.h>
|
||||
|
||||
/* Core includes */
|
||||
/* core includes */
|
||||
#include <ipc_pager.h>
|
||||
#include <pager.h>
|
||||
#include <platform_thread.h>
|
||||
|
||||
namespace Okl4 { extern "C" {
|
||||
#include <l4/message.h>
|
||||
|
@ -17,6 +17,7 @@
|
||||
/* core includes */
|
||||
#include <util.h>
|
||||
#include <platform_pd.h>
|
||||
#include <platform_thread.h>
|
||||
#include <platform.h>
|
||||
|
||||
/* OKL4 includes */
|
||||
|
@ -34,7 +34,7 @@ namespace Okl4 { extern "C" {
|
||||
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,9 +54,9 @@ static inline bool thread_check_stopped_and_restart(Genode::Thread_base *thread_
|
||||
L4_ThreadId_t dummy_id;
|
||||
L4_ThreadState_t state;
|
||||
|
||||
Genode::Native_thread_id tid = thread_base ?
|
||||
thread_base->tid().l4id :
|
||||
main_thread_tid;
|
||||
Okl4::L4_ThreadId_t tid = thread_base ?
|
||||
thread_base->tid().l4id :
|
||||
main_thread_tid;
|
||||
|
||||
L4_ExchangeRegisters(tid, L4_ExReg_Resume + L4_ExReg_AbortIPC, 0, 0, 0,
|
||||
0, L4_nilthread, &state.raw, &dummy, &dummy, &dummy,
|
||||
@ -71,9 +71,9 @@ static inline bool thread_check_stopped_and_restart(Genode::Thread_base *thread_
|
||||
*/
|
||||
static inline void thread_switch_to(Genode::Thread_base *thread_base)
|
||||
{
|
||||
Genode::Native_thread_id tid = thread_base ?
|
||||
thread_base->tid().l4id :
|
||||
main_thread_tid;
|
||||
Okl4::L4_ThreadId_t tid = thread_base ?
|
||||
thread_base->tid().l4id :
|
||||
main_thread_tid;
|
||||
Okl4::L4_ThreadSwitch(tid);
|
||||
}
|
||||
|
||||
@ -84,9 +84,9 @@ static inline void thread_switch_to(Genode::Thread_base *thread_base)
|
||||
static inline void thread_stop_myself()
|
||||
{
|
||||
Genode::Thread_base *myself = Genode::Thread_base::myself();
|
||||
Genode::Native_thread_id tid = myself ?
|
||||
myself->tid().l4id :
|
||||
main_thread_tid;
|
||||
Okl4::L4_ThreadId_t tid = myself ?
|
||||
myself->tid().l4id :
|
||||
main_thread_tid;
|
||||
Okl4::L4_Stop(tid);
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,6 @@ namespace Genode {
|
||||
|
||||
class Platform_thread;
|
||||
|
||||
typedef Pistachio::L4_ThreadId_t Native_thread_id;
|
||||
|
||||
struct Cap_dst_policy
|
||||
{
|
||||
typedef Pistachio::L4_ThreadId_t Dst;
|
||||
@ -41,7 +39,7 @@ namespace Genode {
|
||||
|
||||
struct Native_thread
|
||||
{
|
||||
Native_thread_id l4id;
|
||||
Pistachio::L4_ThreadId_t l4id;
|
||||
|
||||
/**
|
||||
* Only used in core
|
||||
|
@ -16,12 +16,11 @@
|
||||
#include <base/env.h>
|
||||
|
||||
/* Pistachio includes */
|
||||
namespace Pistachio
|
||||
{
|
||||
namespace Pistachio {
|
||||
#include <l4/thread.h>
|
||||
}
|
||||
|
||||
Genode::Native_thread_id main_thread_tid;
|
||||
Pistachio::L4_ThreadId_t main_thread_tid;
|
||||
|
||||
|
||||
/*****************************
|
||||
|
@ -42,7 +42,7 @@ namespace Genode {
|
||||
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;
|
||||
size_t page_size = get_page_size();
|
||||
|
@ -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.
|
||||
@ -46,17 +46,17 @@ namespace Genode {
|
||||
{
|
||||
private:
|
||||
|
||||
int _thread_id; /* plain thread number */
|
||||
Native_thread_id _l4_thread_id; /* L4 thread ID */
|
||||
char _name[32]; /* thread name that will be
|
||||
registered at the kernel
|
||||
debugger */
|
||||
Platform_pd *_platform_pd; /* protection domain thread
|
||||
is bound to */
|
||||
unsigned _priority; /* thread priority */
|
||||
Pager_object *_pager;
|
||||
int _thread_id; /* plain thread number */
|
||||
Pistachio::L4_ThreadId_t _l4_thread_id; /* L4 thread ID */
|
||||
char _name[32]; /* thread name that will be
|
||||
registered at the kernel
|
||||
debugger */
|
||||
Platform_pd *_platform_pd; /* protection domain thread
|
||||
is bound to */
|
||||
unsigned _priority; /* thread priority */
|
||||
Pager_object *_pager;
|
||||
|
||||
Affinity::Location _location;
|
||||
Affinity::Location _location;
|
||||
|
||||
public:
|
||||
|
||||
@ -107,7 +107,7 @@ namespace Genode {
|
||||
* \param l4_thread_id final L4 thread ID
|
||||
* \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);
|
||||
|
||||
/**
|
||||
@ -174,12 +174,12 @@ namespace Genode {
|
||||
** Pistachio-specific Accessors **
|
||||
**********************************/
|
||||
|
||||
int thread_id() const { return _thread_id; }
|
||||
Native_thread_id native_thread_id() const { return _l4_thread_id; }
|
||||
const char *name() const { return _name; }
|
||||
int thread_id() const { return _thread_id; }
|
||||
Pistachio::L4_ThreadId_t native_thread_id() const { return _l4_thread_id; }
|
||||
const char *name() const { return _name; }
|
||||
|
||||
/* 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; }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ namespace Genode {
|
||||
Rm_session::Fault_type pf_type,
|
||||
unsigned long badge)
|
||||
{
|
||||
Native_thread_id tid;
|
||||
Pistachio::L4_ThreadId_t tid;
|
||||
tid.raw = badge;
|
||||
printf("%s (%s pf_addr=%p pf_ip=%p from %02lx (raw %08lx))\n", msg,
|
||||
pf_type == Rm_session::WRITE_FAULT ? "WRITE" : "READ",
|
||||
|
@ -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_ThreadState_t state;
|
||||
|
||||
Genode::Native_thread_id tid = thread_base ?
|
||||
Pistachio::L4_ThreadId_t tid = thread_base ?
|
||||
thread_base->tid().l4id :
|
||||
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)
|
||||
{
|
||||
Genode::Native_thread_id tid = thread_base ?
|
||||
Pistachio::L4_ThreadId_t tid = thread_base ?
|
||||
thread_base->tid().l4id :
|
||||
main_thread_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()
|
||||
{
|
||||
Genode::Thread_base *myself = Genode::Thread_base::myself();
|
||||
Genode::Native_thread_id tid = myself ?
|
||||
Pistachio::L4_ThreadId_t tid = myself ?
|
||||
myself->tid().l4id :
|
||||
main_thread_tid;
|
||||
Pistachio::L4_Stop(tid);
|
||||
|
@ -19,8 +19,6 @@
|
||||
|
||||
namespace Genode {
|
||||
|
||||
typedef int Native_thread_id;
|
||||
|
||||
struct Native_thread
|
||||
{
|
||||
unsigned tcb_sel = 0;
|
||||
|
@ -75,7 +75,7 @@ namespace Genode {
|
||||
{
|
||||
private:
|
||||
|
||||
Native_thread_id _last; /* faulted thread */
|
||||
addr_t _last; /* faulted thread ID */
|
||||
addr_t _pf_addr; /* page-fault address */
|
||||
addr_t _pf_ip; /* instruction pointer of faulter */
|
||||
bool _pf_write; /* true on write fault */
|
||||
|
Loading…
x
Reference in New Issue
Block a user