Hi, Ivan, __ctor_list and __ctor_end are defined by the linker script, for a special section for 'constructors' defined in the kernel.
William Liang http://www.ntut.edu.tw/~wyliang 2011/9/27 ivan <ivan.9ki...@gmail.com> > Hi, guys > > When I read the code of lk/kernel/main.c, I feel confused about using > "call_constructors()" during the > initialization, as below. Could anyone interpret it to me? Your kind > help will be appreciated very much. > > ****************************** > void kmain(void) > { > // get us into some sort of thread context > thread_init_early(); > > ..... > > call_constructors(); > ...... > } > > static void call_constructors(void) > { > void **ctor; > ctor = &__ctor_list; > while(ctor != &__ctor_end) { > void (*func)(void); > > func = (void (*)())*ctor; > > func(); > ctor++; > } > } > > ****************************** > > -- > unsubscribe: android-kernel+unsubscr...@googlegroups.com > website: http://groups.google.com/group/android-kernel -- unsubscribe: android-kernel+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-kernel