LittleKernel学习笔记(6)
call_constructors这个函数是干啥的?简单了解一下
1 static void call_constructors(void) { 2 void **ctor;//我的天,上来一个指针的指针 3 4 ctor = &__ctor_list;//某个list的取址 5 while (ctor != &__ctor_end) {//循环 6 void (*func)(void);//函数指针 7 8 func = (void ( *)(void))*ctor;//拿出函数 9 10 func();//函数跑起来 11 ctor++;//+1,我理解就是__ctor_list里面每一个都跑一下
12 } 13 }
无耻呀无耻
__ctor_list = .
行 7: . = %KERNEL_BASE% + %KERNEL_LOAD_OFFSET%; 行 102: . = ALIGN(4); 行 107: . = ALIGN(4); 行 113: . = %KERNEL_BASE% + %MEMSIZE%;
static void call_constructors(void) { void **ctor;
ctor = &__ctor_list; while (ctor != &__ctor_end) { void (*func)(void);
func = (void ( *)(void))*ctor;
func(); ctor++; }}
浙公网安备 33010602011771号