mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-12 13:48:30 +00:00
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:
parent
5b90113d86
commit
4697e0e07d
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user