hw: make bootstrap save against multiple calls

In programs with dynamic linker, _main and thus also platform_main_bootstrap
are called twice. By now, platform_main_bootstrap tried to always access the
startup message in the UTCB of the main thread that gets overridden till the
second call.

fix #967
This commit is contained in:
Martin Stein 2013-11-25 11:31:39 +01:00 committed by Norman Feske
parent 5b90113d86
commit 4697e0e07d

View File

@ -32,6 +32,11 @@ Native_thread_id Genode::thread_get_my_native_id()
void Genode::platform_main_bootstrap()
{
Native_utcb * const utcb = Thread_base::myself()->utcb();
_main_thread_id = utcb->startup_msg.thread_id();
/* go save against multiple calls e.g. for programs with dynamic linker */
static bool main_thread_id_valid = 0;
if (!main_thread_id_valid) {
Native_utcb * const utcb = Thread_base::myself()->utcb();
_main_thread_id = utcb->startup_msg.thread_id();
main_thread_id_valid = 1;
}
}