base: remove integer return codes from PD-session

The return code of assign_parent remained unused. So this patch
removes it.

The bind_thread function fails only due to platform-specific limitations
such as the exhaustion of ID name spaces, which cannot be sensibly
handled by the PD-session client. If occurred, such conditions used to
be reflected by integer return codes that were used for diagnostic
messages only. The patch removes the return codes and leaves the
diagnostic output to core.

Fixes #1842
This commit is contained in:
Norman Feske
2016-04-14 16:29:07 +02:00
committed by Christian Helmuth
parent 93b82c14ac
commit e20bbe7002
29 changed files with 83 additions and 145 deletions

View File

@ -188,8 +188,8 @@ Process::Process(Dataspace_capability elf_ds_cap,
enum Local_exception
{
THREAD_FAIL, ELF_FAIL, ASSIGN_PARENT_FAIL, THREAD_ADD_FAIL,
THREAD_BIND_FAIL, THREAD_PAGER_FAIL, THREAD_START_FAIL,
THREAD_FAIL, ELF_FAIL, THREAD_ADD_FAIL,
THREAD_PAGER_FAIL, THREAD_START_FAIL,
};
/* XXX this only catches local exceptions */
@ -240,24 +240,17 @@ Process::Process(Dataspace_capability elf_ds_cap,
}
/* register parent interface for new protection domain */
if (_pd_session_client.assign_parent(parent_cap)) {
PERR("Could not assign parent interface to new PD");
throw ASSIGN_PARENT_FAIL;
}
_pd_session_client.assign_parent(parent_cap);
/* bind thread0 */
err = _pd_session_client.bind_thread(_thread0_cap);
if (err) {
PERR("Thread binding failed (%d)", err);
throw THREAD_BIND_FAIL;
}
_pd_session_client.bind_thread(_thread0_cap);
/* register thread0 at region manager session */
Pager_capability pager;
try {
pager = _rm_session_client.add_client(_thread0_cap);
} catch (...) {
PERR("Pager setup failed (%d)", err);
PERR("Pager setup failed");
throw THREAD_ADD_FAIL;
}
@ -290,8 +283,6 @@ Process::Process(Dataspace_capability elf_ds_cap,
case THREAD_START_FAIL:
case THREAD_PAGER_FAIL:
case THREAD_ADD_FAIL:
case THREAD_BIND_FAIL:
case ASSIGN_PARENT_FAIL:
case ELF_FAIL:
_cpu_session_client.kill_thread(_thread0_cap);

View File

@ -64,8 +64,7 @@ void Thread_base::start()
throw Cpu_session::Thread_creation_failed();
/* assign thread to protection domain */
if (env()->pd_session()->bind_thread(_thread_cap))
throw Cpu_session::Thread_creation_failed();
env()->pd_session()->bind_thread(_thread_cap);
/* create new pager object and assign it to the new thread */
Pager_capability pager_cap = env()->rm_session()->add_client(_thread_cap);

View File

@ -45,12 +45,12 @@ class Genode::Core_pd_session_component : public Rpc_object<Pd_session>
_signal_source_ep(signal_source_ep)
{ }
int bind_thread(Thread_capability thread) override
void bind_thread(Thread_capability thread) override
{
ASSERT_NEVER_CALLED;
}
int assign_parent(Capability<Parent> parent) override
void assign_parent(Capability<Parent> parent) override
{
ASSERT_NEVER_CALLED;
}

View File

@ -106,8 +106,8 @@ class Genode::Pd_session_component : public Rpc_object<Pd_session>
** PD session interface **
**************************/
int bind_thread(Thread_capability) override;
int assign_parent(Capability<Parent>) override;
void bind_thread(Thread_capability) override;
void assign_parent(Capability<Parent>) override;
bool assign_pci(addr_t, uint16_t) override;
Signal_source_capability alloc_signal_source() override

View File

@ -24,30 +24,26 @@
using namespace Genode;
int Pd_session_component::bind_thread(Thread_capability thread)
void Pd_session_component::bind_thread(Thread_capability thread)
{
return _thread_ep.apply(thread, [&] (Cpu_thread_component *cpu_thread) {
if (!cpu_thread) return -1;
if (!cpu_thread) return;
if (cpu_thread->bound()) {
PWRN("rebinding of threads not supported");
return -2;
return;
}
Platform_thread *p_thread = cpu_thread->platform_thread();
int res = _pd.bind_thread(p_thread);
if (res)
return res;
_pd.bind_thread(p_thread);
cpu_thread->bound(true);
return 0;
});
}
int Pd_session_component::assign_parent(Parent_capability parent)
void Pd_session_component::assign_parent(Parent_capability parent)
{
return _pd.assign_parent(parent);
_pd.assign_parent(parent);
}