<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;">Hi,</div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;">I had some confusion/doubts regarding Linux kernel / OS and I <span style="background-color: transparent;">want to be completely sure that my understanding is right for below, and need your inputs (would be really glad for your help):</span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span style="background-color: transparent;"><br></span></div><div
style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span style="background-color: transparent;">- There are functions defined in linux kernel. Some of these functions have a line "EXPORT_SYMBOL(<function_name>);" after them.</span><br></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span style="background-color: transparent;"> These are the functions which are exported, so they can be directly called from a linux kernel module - right ? (we just need to include header files which define</span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span style="background-color: transparent;">
them</span><span style="background-color: transparent;"> in</span><span style="background-color: transparent;"> our kernel module)</span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px; color: rgb(0, 0, 0); background-color: transparent; font-style: normal;"><span style="background-color: transparent;"><br></span></div><div style="background-color: transparent;"><span style="color: rgb(0, 0, 0); font-family: 'times new roman', 'new york', times, serif; font-size: 16px; font-style: normal; background-color: transparent;">- There are some functions </span><span style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px;">defined in linux kernel</span><span style="background-color: transparent; font-family: 'times new roman', 'new york', times, serif; font-size: 16px;">, which are not static and are not exported, like "</span><span style="background-color:
transparent;"><font face="times new roman, new york, times, serif">migrate_pages" in migrate.c and it is mentioned in</font></span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: normal;"><span style="background-color: transparent;"><font face="times new roman, new york, times, serif"> include/linux/migrate.h file.</font></span><span style="background-color: transparent;"> </span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: normal;"><span style="background-color: transparent;"> Is there a way to call these functions, directly from kernel module ?? (even if I include the header file) ??</span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman',
'new york', times, serif; font-style: normal;"><span style="background-color: transparent;"> If no, </span><span style="background-color: transparent;">What is the technique used there, which prevents the module from calling this function (even though I have included the header file)??</span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: normal;"><span style="background-color: transparent;"><br></span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: normal;"><span style="background-color: transparent;">- We have kernel header files defined in include/linux/ and there are user space header files (the C libraries).</span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; font-style: normal;"><span style="background-color: transparent;"> Can a user space program include kernel header file and call a kernel function directly?? No , right ??</span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: normal;"><span style="background-color: transparent;"> Again, what is there which prevents a user space program from doing so?? How this technique is implemented ??</span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: normal;"><span style="background-color: transparent;"><font face="times new roman, new york, times, serif"> </font></span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family:
'times new roman', 'new york', times, serif; font-style: normal;"><span style="background-color: transparent;"><font face="times new roman, new york, times, serif">- I understand that, a struct page exists for each physical page in RAM. And this linked list of struct pages are stored together at the beginning of a zone. After this</font></span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: normal;"><span style="background-color: transparent;"><font face="times new roman, new york, times, serif"> storage, does the real data (content) of pages is stored.</font></span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: normal;"><span style="background-color: transparent;"><font face="times new roman, new york, times, serif"> Now each
of these pages must be pointing to the data area/page which they define ? Which is this field in the struct page, which points to this data area, a physical</font></span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: normal;"><span style="background-color: transparent;"><font face="times new roman, new york, times, serif"> address + length of the page ?</font></span></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; font-style: normal;"><span style="background-color: transparent;"><font face="times new roman, new york, times, serif"> </font></span></div><div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><span style="background-color: transparent; font-size: 12pt;">Thanks,</span></div><div
style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"><span style="background-color: transparent; font-size: 12pt;">Ajay</span></div></div></body></html>