on

xiaoxiao2021-03-06  88

This is when I study a very primary thing of the kernel code, the pass, maybe some mistakes, I hope everyone can correct the Pianopan Email: Pianopan@beeship.com www.beeship.com1. When watching the Linux core code, see / init / main.c inside do_initcalls function static void __init do_initcalls (void) {initcall_t * call; call = & __ initcall_start; do {(* call) (); call ;} while (call <& __ initcall_end); / * Make sure there is No pending stuff from the initCall sequence * / flush_scheduled_tasks ();} is very surprised at the time, when viewed in Source Insight, no definition of __initcall_start, then search for website search, (estimated is my search level Taiwan), There were no related articles, so I took questions about the relevant Linux Forum, some people guided us /ary/i386/vmlinux.ldslds what? Hano, unclear, check the information is LD Script. LD 2. Looks /arch/i386/vmlinux.lds, found a code __initcall_start =.; .initcall.init: {* (.initcall.init)} __initcall_end =.; Use INFO LD related to what I found, Look at the relevant information, (finally found too much trouble, I found a ld.pdf online). I found that there is such an introduction to the use of the C local Union structurer, and when the usage is the same, it is let __initcall_start point to the code section The group of .initcall.init, and __initcall_end points the tail of .initcall.init. Then the first code is logically released from the program. 3. Because DO_INITCALLS is based on the initialization of the selected drive section, how specifically, how these function pointer data is placed .initcall.INIT section. I remembered, I haven't used Grep Haha, grep -rn .initcall.init * found in include / linux / init.h: 83: There is such a definition #define __init_call __attribute__ ((unused, __ section__ (".initcall.init ")))) Wahahaha finally let me find it and discovered #define __initcall (fn) / static initCall_t __initcall _ ## fn __init_call = fn4.

转载请注明原文地址:https://www.9cbs.com/read-95891.html

New Post(0)