Where is the system call table in linux kernel v3.9?
From: Srinivas Ganji <hidden>
Date: 2013-07-24 11:49:13
Hi Iker Pedrosa, Please look at how to write the Kconfig files. We need to write a new Kconfig file for our own implementation. Regards, Srinivas G. On Tue, Jul 23, 2013 at 3:15 PM, Iker Pedrosa [off-list ref]wrote:
Hi Srinivas Ganji, I've already done it. It wasn't very difficult as I have already worked with makefiles. Have you got any other suggestion of an exercise I can do? Thanks you very much again On Tue, 23 Jul 2013 11:11:16 +0530 Srinivas Ganji [off-list ref] wrote:quoted
Hi Iker Pedrosa, Have you completed with your own directory implementation? If you see any issues, please let me know. Regards, Srinivas. On Sat, Jul 20, 2013 at 4:13 PM, Iker Pedrosa <ikerpedrosam@gmail.com wrote:quoted
Thank you very much to everybody. I've tried Sudip Mukherjee's approach and it has worked (the table is in arch/x86/syscalls/syscall_32.tbl).Now,quoted
quoted
I'm going to try to create my own directory in kernel source whichcontainsquoted
quoted
my system call implementation files as Srinivas Ganji has proposed. On Fri, 19 Jul 2013 12:15:44 +0530 Srinivas Ganji [off-list ref] wrote:quoted
Hi Iker Pedrosa, In old versions of Linux kernels like 2.6.xx, the approach wasdifferentquoted
quoted
quoted
from Linux version 3.3 on wards. There are two different approaches to implement own system call. Each approach involves several steps. The difference between twoapproachesquoted
quoted
is,quoted
in one approach, we implement our system call in already existingfile ofquoted
quoted
quoted
kernel sources. In another approach, we created our own directory inkernelquoted
source which contains our system call implementation files. Ans inthisquoted
quoted
quoted
second approach, we need to modify the Kernel Makefiles andConfigurationquoted
quoted
quoted
files to include our newly created directory and its contents. Firstletquoted
quoted
usquoted
implement using the first approach. The following approach was successfully tested in Linux kernel 3.5.7 version sources for x86 32-bit architecture. Here are the steps to create our own system call in the existingkernelquoted
quoted
quoted
sources. The paths given below are relative paths from/usr/src/linux.quoted
quoted
quoted
1. Generally, add the function (system call) definition inkernel/sys.cquoted
quoted
quoted
file. /* this is the implementation of our system call */ asmlinkage long sys_helloworld(void) { printk(KERN_EMERG "Hello, world!\n"); return 0; } 2. Add the function prototype in the header fileinclude/linux/syscalls.hquoted
quoted
quoted
asmlinkage long sys_helloworld(void); 3. Create an entry in system call table in the file arch/x86/syscalls/syscall_32.tbl 350 i386 helloworld sys_helloworld Note: In my case already table had 349 offsets, so I added it as 350. 4. If we want to create our own kernel images, then change theEXTRAVERSIONquoted
in the main Makefile available at /usr/src/linux EXTRAVERSION = .ownsyscall 5. Then, build the modules from the main directory with thefollowing.quoted
quoted
quoted
make menuconfig --- Just save and exit. make modules make modules_install make install 6. Now, reboot with our own image. 7. Write a simple C application for calling the our own system call. #include <stdio.h> /* sys_helloworld 350 */ int main () { syscall(350); /* 350 is our system calls offset number */ return 0; } I hope, you understand it clearly and it helps you. Based on this,youquoted
quoted
canquoted
practice the second approach. It needs of creating our own directoryandquoted
quoted
quoted
files (C, Makefile, Kconfig) and modifications required inarchitecturequoted
quoted
quoted
specific Kconfig. Regards, Srinivas. On Thu, Jul 18, 2013 at 2:34 PM, Iker Pedrosa <ikerpedrosam at gmail.comquoted
quoted
quoted
wrote:quoted
Hi Guys, I am a newbie to linux kernel and I am trying to do some of the exercises/examples of the Linux Kernel Development book by RobertLove. Forquoted
quoted
the moment I'm trying to create a system call (Chapter 5) but I amunablequoted
quoted
to do the first step which states the following: "Add an entry to the end of the system call table.This needs to bedonequoted
quoted
quoted
quoted
for each architecture that supports the system call (which, formostquoted
quoted
calls,quoted
quoted
is all the architectures).The position of the syscall in the table, starting at zero, is its system call number. For example, the tenthentryquoted
quoted
in the list is assigned syscall number nine." My problem is that I am unable to find the file that holds thetable.quoted
quoted
Inquoted
quoted
the book the file that needs to be changed is the entry.S but it nolongersquoted
quoted
exists in v3.9. In an example that I have found on the internet,whichquoted
quoted
isquoted
quoted
done using v3.0, the file to change is syscall_table_32.S. But I'vegot thequoted
quoted
same problem, it doesn't exist. So anybody can help me to find thetable? Iquoted
quoted
know that I should be using v2.6 of the kernel but I don't know ifthatquoted
quoted
quoted
quoted
version will work with the distribution that I'm using. The question is also in stackoverflow so if someone wants to answertherequoted
quoted
I won't have any problem. The link to the page is the following:http://stackoverflow.com/questions/17652555/where-is-the-system-call-table-in-linux-kernel-v3-9quoted
quoted
quoted
quoted
-- Iker Pedrosa [off-list ref] _______________________________________________ Kernelnewbies mailing list Kernelnewbies at kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies-- Iker Pedrosa [off-list ref]-- Iker Pedrosa [off-list ref]
-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130724/6ea33481/attachment.html