parent
105ff5dfed
commit
83039267fa
|
@ -34,12 +34,6 @@ namespace Genode {
|
||||||
void kill_thread(Thread_capability thread) {
|
void kill_thread(Thread_capability thread) {
|
||||||
call<Rpc_kill_thread>(thread); }
|
call<Rpc_kill_thread>(thread); }
|
||||||
|
|
||||||
Thread_capability first() {
|
|
||||||
return call<Rpc_first>(); }
|
|
||||||
|
|
||||||
Thread_capability next(Thread_capability curr) {
|
|
||||||
return call<Rpc_next>(curr); }
|
|
||||||
|
|
||||||
int set_pager(Thread_capability thread, Pager_capability pager) {
|
int set_pager(Thread_capability thread, Pager_capability pager) {
|
||||||
return call<Rpc_set_pager>(thread, pager); }
|
return call<Rpc_set_pager>(thread, pager); }
|
||||||
|
|
||||||
|
|
|
@ -38,11 +38,6 @@ namespace Genode {
|
||||||
void kill_thread(Thread_capability thread) {
|
void kill_thread(Thread_capability thread) {
|
||||||
call<Rpc_kill_thread>(thread); }
|
call<Rpc_kill_thread>(thread); }
|
||||||
|
|
||||||
Thread_capability first() {
|
|
||||||
return call<Rpc_first>(); }
|
|
||||||
|
|
||||||
Thread_capability next(Thread_capability curr) {
|
|
||||||
return call<Rpc_next>(curr); }
|
|
||||||
|
|
||||||
int set_pager(Thread_capability thread, Pager_capability pager) {
|
int set_pager(Thread_capability thread, Pager_capability pager) {
|
||||||
return call<Rpc_set_pager>(thread, pager); }
|
return call<Rpc_set_pager>(thread, pager); }
|
||||||
|
|
|
@ -126,7 +126,7 @@ void Thread_base::start()
|
||||||
throw Cpu_session::Thread_creation_failed();
|
throw Cpu_session::Thread_creation_failed();
|
||||||
|
|
||||||
/* request native EC thread cap */
|
/* request native EC thread cap */
|
||||||
Genode::Nova_cpu_connection cpu;
|
Genode::Cpu_session_client cpu(env()->cpu_session_cap());
|
||||||
Native_capability ec_cap = cpu.native_cap(_thread_cap);
|
Native_capability ec_cap = cpu.native_cap(_thread_cap);
|
||||||
if (!ec_cap.valid())
|
if (!ec_cap.valid())
|
||||||
throw Cpu_session::Thread_creation_failed();
|
throw Cpu_session::Thread_creation_failed();
|
||||||
|
|
|
@ -131,8 +131,6 @@ namespace Genode {
|
||||||
Ram_dataspace_capability utcb(Thread_capability thread);
|
Ram_dataspace_capability utcb(Thread_capability thread);
|
||||||
|
|
||||||
void kill_thread(Thread_capability);
|
void kill_thread(Thread_capability);
|
||||||
Thread_capability first();
|
|
||||||
Thread_capability next(Thread_capability);
|
|
||||||
int set_pager(Thread_capability, Pager_capability);
|
int set_pager(Thread_capability, Pager_capability);
|
||||||
int start(Thread_capability, addr_t, addr_t);
|
int start(Thread_capability, addr_t, addr_t);
|
||||||
void pause(Thread_capability thread_cap);
|
void pause(Thread_capability thread_cap);
|
||||||
|
|
|
@ -33,12 +33,6 @@ namespace Genode {
|
||||||
void kill_thread(Thread_capability thread) {
|
void kill_thread(Thread_capability thread) {
|
||||||
call<Rpc_kill_thread>(thread); }
|
call<Rpc_kill_thread>(thread); }
|
||||||
|
|
||||||
Thread_capability first() {
|
|
||||||
return call<Rpc_first>(); }
|
|
||||||
|
|
||||||
Thread_capability next(Thread_capability curr) {
|
|
||||||
return call<Rpc_next>(curr); }
|
|
||||||
|
|
||||||
int set_pager(Thread_capability thread, Pager_capability pager) {
|
int set_pager(Thread_capability thread, Pager_capability pager) {
|
||||||
return call<Rpc_set_pager>(thread, pager); }
|
return call<Rpc_set_pager>(thread, pager); }
|
||||||
|
|
||||||
|
|
|
@ -82,16 +82,6 @@ namespace Genode {
|
||||||
*/
|
*/
|
||||||
virtual void kill_thread(Thread_capability thread) = 0;
|
virtual void kill_thread(Thread_capability thread) = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve thread list of CPU session
|
|
||||||
*
|
|
||||||
* The next() function returns an invalid capability if the
|
|
||||||
* specified thread does not exists or if it is the last one
|
|
||||||
* of the CPU session.
|
|
||||||
*/
|
|
||||||
virtual Thread_capability first() = 0;
|
|
||||||
virtual Thread_capability next(Thread_capability curr) = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set paging capabilities for thread
|
* Set paging capabilities for thread
|
||||||
*
|
*
|
||||||
|
@ -213,8 +203,6 @@ namespace Genode {
|
||||||
Name const &, addr_t);
|
Name const &, addr_t);
|
||||||
GENODE_RPC(Rpc_utcb, Ram_dataspace_capability, utcb, Thread_capability);
|
GENODE_RPC(Rpc_utcb, Ram_dataspace_capability, utcb, Thread_capability);
|
||||||
GENODE_RPC(Rpc_kill_thread, void, kill_thread, Thread_capability);
|
GENODE_RPC(Rpc_kill_thread, void, kill_thread, Thread_capability);
|
||||||
GENODE_RPC(Rpc_first, Thread_capability, first,);
|
|
||||||
GENODE_RPC(Rpc_next, Thread_capability, next, Thread_capability);
|
|
||||||
GENODE_RPC(Rpc_set_pager, int, set_pager, Thread_capability, Pager_capability);
|
GENODE_RPC(Rpc_set_pager, int, set_pager, Thread_capability, Pager_capability);
|
||||||
GENODE_RPC(Rpc_start, int, start, Thread_capability, addr_t, addr_t);
|
GENODE_RPC(Rpc_start, int, start, Thread_capability, addr_t, addr_t);
|
||||||
GENODE_RPC(Rpc_pause, void, pause, Thread_capability);
|
GENODE_RPC(Rpc_pause, void, pause, Thread_capability);
|
||||||
|
@ -238,8 +226,6 @@ namespace Genode {
|
||||||
typedef Meta::Type_tuple<Rpc_create_thread,
|
typedef Meta::Type_tuple<Rpc_create_thread,
|
||||||
Meta::Type_tuple<Rpc_utcb,
|
Meta::Type_tuple<Rpc_utcb,
|
||||||
Meta::Type_tuple<Rpc_kill_thread,
|
Meta::Type_tuple<Rpc_kill_thread,
|
||||||
Meta::Type_tuple<Rpc_first,
|
|
||||||
Meta::Type_tuple<Rpc_next,
|
|
||||||
Meta::Type_tuple<Rpc_set_pager,
|
Meta::Type_tuple<Rpc_set_pager,
|
||||||
Meta::Type_tuple<Rpc_start,
|
Meta::Type_tuple<Rpc_start,
|
||||||
Meta::Type_tuple<Rpc_pause,
|
Meta::Type_tuple<Rpc_pause,
|
||||||
|
@ -251,7 +237,7 @@ namespace Genode {
|
||||||
Meta::Type_tuple<Rpc_num_cpus,
|
Meta::Type_tuple<Rpc_num_cpus,
|
||||||
Meta::Type_tuple<Rpc_affinity,
|
Meta::Type_tuple<Rpc_affinity,
|
||||||
Meta::Empty>
|
Meta::Empty>
|
||||||
> > > > > > > > > > > > > > Rpc_functions;
|
> > > > > > > > > > > > Rpc_functions;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
using namespace Genode;
|
using namespace Genode;
|
||||||
|
|
||||||
|
|
||||||
Thread_capability Cpu_session_component::create_thread(Name const &name, addr_t utcb)
|
Thread_capability Cpu_session_component::create_thread(Name const &name,
|
||||||
|
addr_t utcb)
|
||||||
{
|
{
|
||||||
Lock::Guard thread_list_lock_guard(_thread_list_lock);
|
Lock::Guard thread_list_lock_guard(_thread_list_lock);
|
||||||
Lock::Guard slab_lock_guard(_thread_alloc_lock);
|
Lock::Guard slab_lock_guard(_thread_alloc_lock);
|
||||||
|
@ -70,28 +71,6 @@ void Cpu_session_component::kill_thread(Thread_capability thread_cap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Thread_capability Cpu_session_component::first()
|
|
||||||
{
|
|
||||||
Lock::Guard lock_guard(_thread_list_lock);
|
|
||||||
|
|
||||||
return _thread_list.first() ? _thread_list.first()->cap()
|
|
||||||
: Thread_capability();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Thread_capability Cpu_session_component::next(Thread_capability thread_cap)
|
|
||||||
{
|
|
||||||
Lock::Guard lock_guard(_thread_list_lock);
|
|
||||||
|
|
||||||
Cpu_thread_component *thread = _lookup_thread(thread_cap);
|
|
||||||
|
|
||||||
if (!thread || !thread->next())
|
|
||||||
return Thread_capability();
|
|
||||||
|
|
||||||
return Thread_capability(thread->next()->cap());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Cpu_session_component::set_pager(Thread_capability thread_cap,
|
int Cpu_session_component::set_pager(Thread_capability thread_cap,
|
||||||
Pager_capability pager_cap)
|
Pager_capability pager_cap)
|
||||||
{
|
{
|
||||||
|
@ -152,9 +131,9 @@ int Cpu_session_component::state(Thread_capability thread_cap,
|
||||||
return thread->platform_thread()->state(state_dst);
|
return thread->platform_thread()->state(state_dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
void Cpu_session_component::exception_handler(Thread_capability thread_cap,
|
Cpu_session_component::exception_handler(Thread_capability thread_cap,
|
||||||
Signal_context_capability sigh_cap)
|
Signal_context_capability sigh_cap)
|
||||||
{
|
{
|
||||||
Cpu_thread_component *thread = _lookup_thread(thread_cap);
|
Cpu_thread_component *thread = _lookup_thread(thread_cap);
|
||||||
if (!thread || !thread->platform_thread()->pager()) return;
|
if (!thread || !thread->platform_thread()->pager()) return;
|
||||||
|
|
|
@ -159,19 +159,19 @@ namespace Genode {
|
||||||
|
|
||||||
Cpu_session *cpu_session()
|
Cpu_session *cpu_session()
|
||||||
{
|
{
|
||||||
PWRN("not implemented");
|
PWRN("%s:%u not implemented", __FILE__, __LINE__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Cpu_session_capability cpu_session_cap() {
|
Cpu_session_capability cpu_session_cap() {
|
||||||
PWRN("not implemented");
|
PWRN("%s:%u not implemented", __FILE__, __LINE__);
|
||||||
return Cpu_session_capability();
|
return Cpu_session_capability();
|
||||||
}
|
}
|
||||||
|
|
||||||
Pd_session *pd_session()
|
Pd_session *pd_session()
|
||||||
{
|
{
|
||||||
PWRN("not implemented");
|
PWRN("%s:%u not implemented", __FILE__, __LINE__);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -124,8 +124,6 @@ namespace Genode {
|
||||||
Thread_capability create_thread(Name const &, addr_t utcb);
|
Thread_capability create_thread(Name const &, addr_t utcb);
|
||||||
Ram_dataspace_capability utcb(Thread_capability thread);
|
Ram_dataspace_capability utcb(Thread_capability thread);
|
||||||
void kill_thread(Thread_capability);
|
void kill_thread(Thread_capability);
|
||||||
Thread_capability first();
|
|
||||||
Thread_capability next(Thread_capability);
|
|
||||||
int set_pager(Thread_capability, Pager_capability);
|
int set_pager(Thread_capability, Pager_capability);
|
||||||
int start(Thread_capability, addr_t, addr_t);
|
int start(Thread_capability, addr_t, addr_t);
|
||||||
void pause(Thread_capability thread_cap);
|
void pause(Thread_capability thread_cap);
|
||||||
|
|
|
@ -164,9 +164,8 @@ int l4lx_irq_dev_set_affinity(struct irq_data *data,
|
||||||
if (target_cpu == p->cpu)
|
if (target_cpu == p->cpu)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
unsigned long flags;
|
unsigned long flags = 0;
|
||||||
l4x_migrate_lock(&flags);
|
l4x_migrate_lock(&flags);
|
||||||
|
|
||||||
{
|
{
|
||||||
Linux::Irq_guard guard;
|
Linux::Irq_guard guard;
|
||||||
if (l4_error(l4_irq_detach(p->irq_cap)))
|
if (l4_error(l4_irq_detach(p->irq_cap)))
|
||||||
|
|
|
@ -103,9 +103,11 @@ static void prepare_l4re_env()
|
||||||
{
|
{
|
||||||
using namespace Fiasco;
|
using namespace Fiasco;
|
||||||
|
|
||||||
Genode::Foc_cpu_connection cpu;
|
Genode::Foc_cpu_session_client cpu(Genode::env()->cpu_session_cap());
|
||||||
static Genode::Native_capability main_thread_cap
|
|
||||||
= cpu.native_cap(Genode::env()->cpu_session()->first());
|
Genode::Thread_capability main_thread = Genode::env()->parent()->main_thread_cap();
|
||||||
|
static Genode::Native_capability main_thread_cap = cpu.native_cap(main_thread);
|
||||||
|
|
||||||
l4re_env_t *env = l4re_env();
|
l4re_env_t *env = l4re_env();
|
||||||
env->first_free_utcb = (l4_addr_t)l4_utcb() + L4_UTCB_OFFSET;
|
env->first_free_utcb = (l4_addr_t)l4_utcb() + L4_UTCB_OFFSET;
|
||||||
env->utcb_area = l4_fpage((l4_addr_t)l4_utcb(),
|
env->utcb_area = l4_fpage((l4_addr_t)l4_utcb(),
|
||||||
|
|
|
@ -108,7 +108,7 @@ extern "C" {
|
||||||
int genode_config_audio()
|
int genode_config_audio()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Genode::Xml_node _node = node("audio");
|
node("audio");
|
||||||
return 1;
|
return 1;
|
||||||
} catch (Genode::Xml_node::Invalid_syntax) {
|
} catch (Genode::Xml_node::Invalid_syntax) {
|
||||||
PWRN("Malformed entry in Linux config.");
|
PWRN("Malformed entry in Linux config.");
|
||||||
|
@ -121,7 +121,7 @@ extern "C" {
|
||||||
int genode_config_nic()
|
int genode_config_nic()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Genode::Xml_node _node = node("nic");
|
node("nic");
|
||||||
return 1;
|
return 1;
|
||||||
} catch (Genode::Xml_node::Invalid_syntax) {
|
} catch (Genode::Xml_node::Invalid_syntax) {
|
||||||
PWRN("Malformed entry in Linux config.");
|
PWRN("Malformed entry in Linux config.");
|
||||||
|
@ -133,7 +133,7 @@ extern "C" {
|
||||||
int genode_config_block()
|
int genode_config_block()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Genode::Xml_node _node = node("block");
|
node("block");
|
||||||
return 1;
|
return 1;
|
||||||
} catch (Genode::Xml_node::Invalid_syntax) {
|
} catch (Genode::Xml_node::Invalid_syntax) {
|
||||||
PWRN("Malformed entry in Linux config.");
|
PWRN("Malformed entry in Linux config.");
|
||||||
|
|
|
@ -35,29 +35,17 @@ static Thread_capability oklx_pager_cap; /* cap to the Linux main thread */
|
||||||
*/
|
*/
|
||||||
static Thread_capability my_cap()
|
static Thread_capability my_cap()
|
||||||
{
|
{
|
||||||
/*
|
Okl4::L4_Word_t tid = thread_myself();
|
||||||
* Get the thread-list of the cpu_session containing
|
|
||||||
* all OKLinux kernel threads
|
|
||||||
*/
|
|
||||||
Thread_capability invalid, cap =
|
|
||||||
Oklx_thread_list::thread_list()->cpu()->first();
|
|
||||||
|
|
||||||
/* Get the OKL4 thread id of the active thread */
|
Oklx_kernel_thread * thread = Genode::Oklx_thread_list::thread_list()->first();
|
||||||
Okl4::L4_Word_t tid = thread_myself();
|
while (thread) {
|
||||||
Thread_state state;
|
if (thread->tid().raw == tid)
|
||||||
|
return thread->cap();
|
||||||
/*
|
thread = thread->next();
|
||||||
* Now, iterate through the thread-list and return the cap of the thread
|
|
||||||
* withe same OKL4 thread id as the active one
|
|
||||||
*/
|
|
||||||
while(cap.valid())
|
|
||||||
{
|
|
||||||
Oklx_thread_list::thread_list()->cpu()->state(cap, &state);
|
|
||||||
if(tid == state.tid.raw)
|
|
||||||
return cap;
|
|
||||||
cap = Oklx_thread_list::thread_list()->cpu()->next(cap);
|
|
||||||
}
|
}
|
||||||
return invalid;
|
|
||||||
|
/* invalid cap */
|
||||||
|
return Thread_capability();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,6 +79,7 @@ L4_ThreadId_t Oklx_thread_list::add()
|
||||||
/* Get the OKL4 thread id of the new thread */
|
/* Get the OKL4 thread id of the new thread */
|
||||||
Thread_state state;
|
Thread_state state;
|
||||||
_cpu.state(cap,&state);
|
_cpu.state(cap,&state);
|
||||||
|
thd->set_tid(state.tid);
|
||||||
|
|
||||||
/* Acknowledge startup and return */
|
/* Acknowledge startup and return */
|
||||||
L4_Send(state.tid);
|
L4_Send(state.tid);
|
||||||
|
|
|
@ -54,6 +54,8 @@ namespace Genode {
|
||||||
enum { STACK_SIZE=1024 };
|
enum { STACK_SIZE=1024 };
|
||||||
|
|
||||||
Thread_capability _cap; /* Genodes thread capability */
|
Thread_capability _cap; /* Genodes thread capability */
|
||||||
|
Okl4::L4_ThreadId_t _tid;
|
||||||
|
|
||||||
char _stack[STACK_SIZE]; /* stack for startup code */
|
char _stack[STACK_SIZE]; /* stack for startup code */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -65,6 +67,11 @@ namespace Genode {
|
||||||
void* stack_addr() { return (void*)&_stack[STACK_SIZE-1]; };
|
void* stack_addr() { return (void*)&_stack[STACK_SIZE-1]; };
|
||||||
|
|
||||||
static void entry();
|
static void entry();
|
||||||
|
|
||||||
|
void set_tid(Okl4::L4_ThreadId_t tid) { _tid = tid; }
|
||||||
|
|
||||||
|
Okl4::L4_ThreadId_t tid() { return _tid; }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,6 +95,8 @@ namespace Genode {
|
||||||
* Get the global list of OKLinux kernel threads
|
* Get the global list of OKLinux kernel threads
|
||||||
*/
|
*/
|
||||||
static Oklx_thread_list *thread_list();
|
static Oklx_thread_list *thread_list();
|
||||||
|
|
||||||
|
Oklx_kernel_thread * first() { return _threads.first(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,12 +93,6 @@ namespace Noux {
|
||||||
void kill_thread(Thread_capability thread) {
|
void kill_thread(Thread_capability thread) {
|
||||||
_cpu.kill_thread(thread); }
|
_cpu.kill_thread(thread); }
|
||||||
|
|
||||||
Thread_capability first() {
|
|
||||||
return _cpu.first(); }
|
|
||||||
|
|
||||||
Thread_capability next(Thread_capability curr) {
|
|
||||||
return _cpu.next(curr); }
|
|
||||||
|
|
||||||
int set_pager(Thread_capability thread,
|
int set_pager(Thread_capability thread,
|
||||||
Pager_capability pager) {
|
Pager_capability pager) {
|
||||||
return _cpu.set_pager(thread, pager); }
|
return _cpu.set_pager(thread, pager); }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user