From 3259185bfca106a8511898c11ab76764d4d2441c Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Wed, 13 May 2015 11:30:32 +0200 Subject: [PATCH] sel4: import parent cap into non-core components --- repos/base-sel4/lib/mk/x86_32/startup.mk | 10 +++++ .../base-sel4/src/platform/_main_parent_cap.h | 39 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 repos/base-sel4/lib/mk/x86_32/startup.mk create mode 100644 repos/base-sel4/src/platform/_main_parent_cap.h diff --git a/repos/base-sel4/lib/mk/x86_32/startup.mk b/repos/base-sel4/lib/mk/x86_32/startup.mk new file mode 100644 index 000000000..5d82f2445 --- /dev/null +++ b/repos/base-sel4/lib/mk/x86_32/startup.mk @@ -0,0 +1,10 @@ +# +# Make the includes of src/base/internal/ available to the startup lib. This is +# needed because the seL4-specific src/platform/_main_parent_cap.h as included +# by the startup lib depends on the internal/capability_space_sel4.h. +# +INC_DIR += $(REP_DIR)/src/base + +include $(BASE_DIR)/lib/mk/startup.inc + +vpath crt0.s $(BASE_DIR)/src/platform/x86_32 diff --git a/repos/base-sel4/src/platform/_main_parent_cap.h b/repos/base-sel4/src/platform/_main_parent_cap.h new file mode 100644 index 000000000..f2685fa3d --- /dev/null +++ b/repos/base-sel4/src/platform/_main_parent_cap.h @@ -0,0 +1,39 @@ +/* + * \brief Obtain parent capability + * \author Norman Feske + * \date 2015-05-12 + */ + +/* + * Copyright (C) 2015 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +#ifndef _PLATFORM__MAIN_PARENT_CAP_H_ +#define _PLATFORM__MAIN_PARENT_CAP_H_ + +/* Genode includes */ +#include + +/* base-internal includes */ +#include + +namespace Genode { + + /** + * Return constructed parent capability + */ + Parent_capability parent_cap() + { + Capability_space::Ipc_cap_data const + ipc_cap_data(Rpc_obj_key(), INITIAL_SEL_PARENT); + + Native_capability cap = Capability_space::import(ipc_cap_data); + + return reinterpret_cap_cast(cap); + } +} + +#endif /* _PLATFORM__MAIN_PARENT_CAP_H_ */