Hi, Cristian. There are, a kinda of ...
kernel/taskstats.c:
| late_initcall(taskstats_init);
kernel/rcu/update.c:
| early_initcall(check_cpu_stall_init);
There is a whole set of macros STAGE_initcall() in include/linux/init.h
Arguments to these macros invokations are accounted and called by kernel
initialization code at strictly defined stages of initialization. See
https://0xax.gitbooks.io/linux-insides/content/Concepts/linux-cpu-3.html
The only thing that is run before kernel is <a series of> platform-specific
boot loaders, maybe under hypervisor control. Compiler has no power to insert
something in between.
Regards, Konstantin.
CRISTIAN ANDRES VARGAS GONZALEZ, 09 Oct 2019 06:44 MSK:
Good day
I have been doing a little kernel following some repositories of GitHub,
videos and wikis, and I have found a topic that leaves me with doubts, the
theme is the global constructors.
Suppose I write a program in c, for the user space, for my code to run I must
have the main function
int main() { /*Code*/}
The gcc compiler searches for this function to run my program, but before that
happens, I can use the global constructors and write a code that runs before
the main function, but in the case of writing a kernel, why do I need to run
lines of code before the kernel is executed ?, I understand that when writing a
kernel there is no main function and that it is disabled to indicate it to the
compiler. In the Linux kernel are there global constructors? If so, what things
are executed before starting the kernel?
att: cristian vargas.
_______________________________________________
Kernelnewbies mailing list
[email protected]
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies