Init startup sequence

Stefan Kalkowski stefan.kalkowski at ...1...
Fri May 21 15:41:10 CEST 2010

Hello Steffen

On Friday, 21. May 2010 14:44:41 Steffen Liebergeld wrote:
> Now init(1) calls init(0), does some initialization in finally gets
> stuck in __cxa_guard_acquire. The stack trace looks like this:

what do you mean with 'it gets stuck', does it spin at: 
base/src/base/cxx/ ?

> It is unclear to me, why init has to grab a lock. Is it using data
> structures that reside in shared memory with core? What should happen next?

This is a generic implementation of the c++ support library for all 
applications, regardless of running single- or multi-threaded (in fact init 
also becomes multi-threaded after its first initialization).
The functions __cxa_guard_aquire and __cxa_guard_release are used to guard the 
construction of static objects in C++ and are required by gcc. Imagine a 
static single object used by different threads (singleton pattern), like the 
Genode::env() function returns one:

Env *env()                                                                           
  static Genode::Platform_env _env;                                                
  return &_env;                                                                    

This pattern is often found in Genode components, which prevailing run 
multi-threaded, that's why you need this lock-like mechanism.

regards Stefan

Stefan Kalkowski
Genode Labs Developer

More information about the users mailing list