<div dir="ltr"><pre class="gmail-tw-data-text gmail-tw-text-large gmail-tw-ta" id="gmail-tw-target-text" dir="ltr" style="unicode-bidi:isolate;line-height:36px;background-color:rgb(248,249,250);border:none;padding:2px 0.14em 2px 0px;font-family:inherit;overflow:hidden;width:283.011px;white-space:pre-wrap"><span tabindex="0" lang="en" style="">Thank you very much, I understand better, I will continue checking the links that happened to me</span></pre><pre class="gmail-tw-data-text gmail-tw-text-large gmail-tw-ta" id="gmail-tw-target-text" dir="ltr" style="unicode-bidi:isolate;line-height:36px;background-color:rgb(248,249,250);border:none;padding:2px 0.14em 2px 0px;font-family:inherit;overflow:hidden;width:283.011px;white-space:pre-wrap"><span tabindex="0" lang="en" style="">regards
att cristian vargas</span></pre></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mié., 9 oct. 2019 a las 11:00, <<a href="mailto:kernelnewbies-request@kernelnewbies.org">kernelnewbies-request@kernelnewbies.org</a>> escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send Kernelnewbies mailing list submissions to<br>
<a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:kernelnewbies-request@kernelnewbies.org" target="_blank">kernelnewbies-request@kernelnewbies.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:kernelnewbies-owner@kernelnewbies.org" target="_blank">kernelnewbies-owner@kernelnewbies.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Kernelnewbies digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: Are there global constructors in the Linux kernel?<br>
(Konstantin Andreev)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Wed, 09 Oct 2019 11:54:26 +0300<br>
From: Konstantin Andreev <<a href="mailto:andreev@swemel.ru" target="_blank">andreev@swemel.ru</a>><br>
To: CRISTIAN ANDRES VARGAS GONZALEZ <<a href="mailto:vargascristian@americana.edu.co" target="_blank">vargascristian@americana.edu.co</a>>,<br>
<a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a><br>
Subject: Re: Are there global constructors in the Linux kernel?<br>
Message-ID: <<a href="mailto:5D9DA042.2090205@swemel.ru" target="_blank">5D9DA042.2090205@swemel.ru</a>><br>
Content-Type: text/plain; charset=utf-8; format=flowed<br>
<br>
Hi, Cristian. There are, a kinda of ...<br>
<br>
kernel/taskstats.c:<br>
| late_initcall(taskstats_init);<br>
<br>
kernel/rcu/update.c:<br>
| early_initcall(check_cpu_stall_init);<br>
<br>
There is a whole set of macros STAGE_initcall() in include/linux/init.h<br>
<br>
Arguments to these macros invokations are accounted and called by kernel initialization code at strictly defined stages of initialization. See <a href="https://0xax.gitbooks.io/linux-insides/content/Concepts/linux-cpu-3.html" rel="noreferrer" target="_blank">https://0xax.gitbooks.io/linux-insides/content/Concepts/linux-cpu-3.html</a><br>
<br>
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.<br>
<br>
Regards, Konstantin.<br>
<br>
CRISTIAN ANDRES VARGAS GONZALEZ, 09 Oct 2019 06:44 MSK:<br>
><br>
> Good day<br>
><br>
> 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.<br>
><br>
> Suppose I write a program in c, for the user space, for my code to run I must have the main function<br>
> int main() { /*Code*/}<br>
><br>
> 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?<br>
> att: cristian vargas.<br>
<br>
<br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
<a href="https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" rel="noreferrer" target="_blank">https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br>
<br>
------------------------------<br>
<br>
End of Kernelnewbies Digest, Vol 107, Issue 9<br>
*********************************************<br>
</blockquote></div>