hw: no asserts in platform PD

ref #528
This commit is contained in:
Martin Stein 2013-08-30 14:15:13 +02:00 committed by Norman Feske
parent 36c453aa17
commit 2afa25be1d
2 changed files with 22 additions and 15 deletions

View File

@ -16,6 +16,7 @@
/* Genode includes */
#include <base/printf.h>
#include <root/root.h>
/* Core includes */
#include <platform.h>
@ -56,11 +57,16 @@ namespace Genode
bool kernel_pd_ok =
ram->alloc_aligned(Kernel::pd_size(), &kernel_pd,
Kernel::pd_alignm_log2()).is_ok();
assert(kernel_pd_ok);
if (!kernel_pd_ok) {
PERR("failed to allocate kernel object");
throw Root::Quota_exceeded();
}
/* create kernel object */
_id = Kernel::new_pd(kernel_pd, this);
assert(_id);
if (!_id) {
PERR("failed to create kernel object");
throw Root::Unavailable();
}
}
/**
@ -86,19 +92,15 @@ namespace Genode
return t->join_pd(_id, 0, Address_space::weak_ptr());
}
/**
* Unbind thread from protection domain
*
* Free the thread's slot and update thread object.
*/
void unbind_thread(Platform_thread * t);
/**
* Assign parent interface to protection domain
*/
int assign_parent(Native_capability parent)
{
assert(parent.valid());
if (!parent.valid()) {
PERR("parent invalid");
return -1;
}
_parent = parent;
return 0;
}

View File

@ -21,8 +21,13 @@ using namespace Genode;
** Platform PD **
*****************/
void Platform_pd::unbind_thread(Platform_thread *thread) { assert(0); }
Platform_pd::~Platform_pd() { assert(0); }
Platform_pd::~Platform_pd()
{
/*
* FIXME: throwing exceptions is not declared for
* 'Pd_root::close' wich is why we can only
* print an error
*/
PERR("not implemented");
}