Where is the system call table in linux kernel v3.9?
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 Robert Love. For the moment I'm trying to create a system call (Chapter 5) but I am unable to do the first step which states the following:
"Add an entry to the end of the system call table.This needs to be done for each architecture that supports the system call (which, for most calls, is all the architectures).The position of the syscall in the table, starting at zero, is its system call number. For example, the tenth entry in the list is assigned syscall number nine."
My problem is that I am unable to find the file that holds the table. In the book the file that needs to be changed is the entry.S but it no longers exists in v3.9. In an example that I have found on the internet, which is done using v3.0, the file to change is syscall_table_32.S. But I've got the same problem, it doesn't exist. So anybody can help me to find the table? I know that I should be using v2.6 of the kernel but I don't know if that version will work with the distribution that I'm using.
The question is also in stackoverflow so if someone wants to answer there 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-9
Signature · 1 line
Iker Pedrosa <[email protected]>
Hi
In 3.10.1 the system call table is in arch/x86/syscalls/syscall_32.tbl
. Should be same in 3.9 also.
Regards
Sudip
Quoted 16 lines · Iker Pedrosa
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 Robert Love. For the moment I'm trying to create a system call (Chapter 5) but I am unable to do the first step which states the following:
"Add an entry to the end of the system call table.This needs to be done for each architecture that supports the system call (which, for most calls, is all the architectures).The position of the syscall in the table, starting at zero, is its system call number. For example, the tenth entry in the list is assigned syscall number nine."My problem is that I am unable to find the file that holds the table. In the book the file that needs to be changed is the
entry.Sbut it no longers exists in v3.9. In an example that I have found on the internet, which is done using v3.0, the file to change issyscall_table_32.S. But I've got the same problem, it doesn't exist. So anybody can help me to find the table? I know that I should be using v2.6 of the kernel but I don't know if that version will work with the distribution that I'm using.The question is also in stackoverflow so if someone wants to answer there 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-9
--
Iker Pedrosa <[email protected]>_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Quoted 2 lines · Sudip Mukherjee
Hi
In 3.10.1 the system call table is inarch/x86/syscalls/syscall_32.tbl
Only for x86. You're on an ARM or PowerPC or MIPS or any of the other 27
or so architectures we support, it's elsewhere. ;)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130718/1a766505/attachment.bin
Hi Iker Pedrosa,
In old versions of Linux kernels like 2.6.xx, the approach was different 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 two approaches is, in one approach, we implement our system call in already existing file of kernel sources. In another approach, we created our own directory in kernel source which contains our system call implementation files. Ans in this second approach, we need to modify the Kernel Makefiles and Configuration files to include our newly created directory and its contents. First let us 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 existing kernel sources. The paths given below are relative paths from /usr/src/linux.
1. Generally, add the function (system call) definition in kernel/sys.c 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 file include/linux/syscalls.h
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 the EXTRAVERSION in the main Makefile available at /usr/src/linux
EXTRAVERSION = .ownsyscall
5. Then, build the modules from the main directory with the following.
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, you can practice the second approach. It needs of creating our own directory and files (C, Makefile, Kconfig) and modifications required in architecture specific Kconfig.
Regards,
Srinivas.
Quoted 24 lines · Iker Pedrosa
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 Robert Love. For the moment I'm trying to create a system call (Chapter 5) but I am unable to do the first step which states the following:
"Add an entry to the end of the system call table.This needs to be done for each architecture that supports the system call (which, for most calls, is all the architectures).The position of the syscall in the table, starting at zero, is its system call number. For example, the tenth entry in the list is assigned syscall number nine."My problem is that I am unable to find the file that holds the table. In the book the file that needs to be changed is the
entry.Sbut it no longers exists in v3.9. In an example that I have found on the internet, which is done using v3.0, the file to change issyscall_table_32.S. But I've got the same problem, it doesn't exist. So anybody can help me to find the table? I know that I should be using v2.6 of the kernel but I don't know if that version will work with the distribution that I'm using.The question is also in stackoverflow so if someone wants to answer there 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-9
Quoted 8 lines
--
Iker Pedrosa <[email protected]>_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130719/6d28098b/attachment.html
Dear Srinivas,
Thank you for the excellent explanation here. Now I need to
ask a question in this context since we are discussing system calls. We all know that system-calls are for user-space.
I have a file-system driver where I have to use system calls in kernel-space.
Normally, we DON'T do any high level IOs from Kernel space (file
creation/reading, and so on). But here in my driver I am stacking FS drivers, I can't avoid this. This is partly because Linux kernel can't handle FS stacking (this wouldn't be an issue for Windows, for instance, which supports stacking),
The simple (and legal) way to create a dir/file whatever is to call system calls, like, for instance sys_mkdir. The problem is that I am not in a context where I can call these. Because they expect a call from user mode, while I am in kernel mode. This is even why I implemented macros such as:
https://github.com/HeisSpiter/hepunion/blob/master/fs/hepunion/hepunion.h#L399.
This one disables all checks from user mode calls, since I am in kernel. And this allows calling system calls.
This is not a good way so can you provide any alternative.
Regards,
Saket Sinha
Quoted 110 lines · Srinivas Ganji
Hi Iker Pedrosa,
In old versions of Linux kernels like 2.6.xx, the approach was different 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 two approaches is, in one approach, we implement our system call in already existing file of kernel sources. In another approach, we created our own directory in kernel source which contains our system call implementation files. Ans in this second approach, we need to modify the Kernel Makefiles and Configuration files to include our newly created directory and its contents. First let us 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 existing kernel sources. The paths given below are relative paths from
/usr/src/linux.1. Generally, add the function (system call) definition in
kernel/sys.cfile./* 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 file
include/linux/syscalls.hasmlinkage long
sys_helloworld(void);3. Create an entry in system call table in the
filearch/x86/syscalls/syscall_32.tbl350 i386 helloworld
sys_helloworldNote: 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 the EXTRAVERSION in the main
Makefileavailable at/usr/src/linuxEXTRAVERSION = .ownsyscall
5. Then, build the modules from the main directory with the following.
make menuconfig --- Just save and exit.
make modules
makemodules_install
make install6. Now, reboot with our own image.
7. Write a simple C application for calling the our own system call.
#include <
stdio.h>/*
sys_helloworld350 */
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, you can practice the second approach. It needs of creating our own directory and files (C,
Makefile,Kconfig) and modifications required in architecture specificKconfig.Regards,
Srinivas.Quoted 24 lines · Iker Pedrosa
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 Robert Love. For the moment I'm trying to create a system call (Chapter 5) but I am unable to do the first step which states the following:
"Add an entry to the end of the system call table.This needs to be done for each architecture that supports the system call (which, for most calls, is all the architectures).The position of the syscall in the table, starting at zero, is its system call number. For example, the tenth entry in the list is assigned syscall number nine."My problem is that I am unable to find the file that holds the table. In the book the file that needs to be changed is the
entry.Sbut it no longers exists in v3.9. In an example that I have found on the internet, which is done using v3.0, the file to change issyscall_table_32.S. But I've got the same problem, it doesn't exist. So anybody can help me to find the table? I know that I should be using v2.6 of the kernel but I don't know if that version will work with the distribution that I'm using.The question is also in stackoverflow so if someone wants to answer there 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 8 lines
--
Iker Pedrosa <[email protected]>_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Quoted 6 lines
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130719/5df76a59/attachment-0001.html
Hi,
Quoted 6 lines · Saket Sinha
Normally, we DON'T do any high level IOs from Kernel space (file
creation/reading, and so on). But here in my driver I am stacking FS drivers, I can't avoid this. This is partly because Linux kernel can't handle FS stacking (this wouldn't be an issue for Windows, for instance, which supports stacking),
You can even use filp_open(), vfs_read(), vfs_write() if sys_* is not available
https://github.com/prashants/km/blob/master/filerw/filerw.c
Regards.
Quoted 2 lines · Prashant Shah
You can even use
filp_open(),vfs_read(),vfs_write()if sys_* is not available
https://github.com/prashants/km/blob/master/filerw/filerw.c
The reasons to not do file I/O from inside the kernel are many and well documented. Of course, if you're trying to do something like unionfs or fuse, you may not have a choice.
And if you're doing something like that, it is probablly better to *avoid* using the sys_* calls even if they are available, but instead use filp_open() and the vfs_ functions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130719/b6ea845f/attachment.bin
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, I'm going to try to create my own directory in kernel source which contains my system call implementation files as Srinivas Ganji has proposed.
Quoted 108 lines · On Fri, 19 Jul 2013 12:15:44 +0530 Srinivas Ganji…
Hi Iker Pedrosa,
In old versions of Linux kernels like 2.6.xx, the approach was different 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 two approaches is, in one approach, we implement our system call in already existing file of kernel sources. In another approach, we created our own directory in kernel source which contains our system call implementation files. Ans in this second approach, we need to modify the Kernel Makefiles and Configuration files to include our newly created directory and its contents. First let us 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 existing kernel sources. The paths given below are relative paths from
/usr/src/linux.1. Generally, add the function (system call) definition in
kernel/sys.cfile./* 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 file
include/linux/syscalls.hasmlinkage long
sys_helloworld(void);3. Create an entry in system call table in the
filearch/x86/syscalls/syscall_32.tbl350 i386 helloworld
sys_helloworldNote: 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 the EXTRAVERSION in the main
Makefileavailable at/usr/src/linuxEXTRAVERSION = .ownsyscall
5. Then, build the modules from the main directory with the following.
make menuconfig --- Just save and exit.
make modules
makemodules_install
make install6. Now, reboot with our own image.
7. Write a simple C application for calling the our own system call.
#include <
stdio.h>/*
sys_helloworld350 */
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, you can practice the second approach. It needs of creating our own directory and files (C,
Makefile,Kconfig) and modifications required in architecture specificKconfig.Regards,
Srinivas.Quoted 32 lines · Iker Pedrosa
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 Robert Love. For the moment I'm trying to create a system call (Chapter 5) but I am unable to do the first step which states the following:
"Add an entry to the end of the system call table.This needs to be done for each architecture that supports the system call (which, for most calls, is all the architectures).The position of the syscall in the table, starting at zero, is its system call number. For example, the tenth entry in the list is assigned syscall number nine."My problem is that I am unable to find the file that holds the table. In the book the file that needs to be changed is the
entry.Sbut it no longers exists in v3.9. In an example that I have found on the internet, which is done using v3.0, the file to change issyscall_table_32.S. But I've got the same problem, it doesn't exist. So anybody can help me to find the table? I know that I should be using v2.6 of the kernel but I don't know if that version will work with the distribution that I'm using.The question is also in stackoverflow so if someone wants to answer there 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-9--
Iker Pedrosa <[email protected]>_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Signature · 1 line
Iker Pedrosa <[email protected]>
Hi Iker Pedrosa,
Have you completed with your own directory implementation? If you see any issues, please let me know.
Regards,
Srinivas.
Quoted 135 lines · Iker Pedrosa
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, I'm going to try to create my own directory in kernel source which contains my system call implementation files as Srinivas Ganji has proposed.Quoted 7 lines · On Fri, 19 Jul 2013 12:15:44 +0530 Srinivas Ganji…
Hi Iker Pedrosa,
In old versions of Linux kernels like 2.6.xx, the approach was different 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 two approaches
is,
Quoted 2 lines
in one approach, we implement our system call in already existing file of kernel sources. In another approach, we created our own directory in
kernel
Quoted 3 lines
source which contains our system call implementation files. Ans in this second approach, we need to modify the Kernel Makefiles and Configuration files to include our newly created directory and its contents. First let
us
Quoted 21 lines
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 existing kernel sources. The paths given below are relative paths from
/usr/src/linux.1. Generally, add the function (system call) definition in
kernel/sys.cfile./* 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 file
include/linux/syscalls.hasmlinkage long
sys_helloworld(void);Quoted 8 lines
3. Create an entry in system call table in the
filearch/x86/syscalls/syscall_32.tbl350 i386 helloworld
sys_helloworldNote: 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 the
EXTRAVERSION
Quoted 17 lines
in the main
Makefileavailable at/usr/src/linuxEXTRAVERSION = .ownsyscall
5. Then, build the modules from the main directory with the following.
make menuconfig --- Just save and exit.
make modules
makemodules_install
make install6. Now, reboot with our own image.
7. Write a simple C application for calling the our own system call.
#include <
stdio.h>Quoted 8 lines
/*
sys_helloworld350 */
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, you
can
Quoted 4 lines
practice the second approach. It needs of creating our own directory and files (C,
Makefile,Kconfig) and modifications required in architecture specificKconfig.Quoted 11 lines
Regards,
Srinivas.Quoted 4 lines · On Thu, Jul 18, 2013 at 2:34 PM, Iker Pedrosa <[email protected] wrote:
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 Robert
Love. For
Quoted 1 line
Quoted 1 line
the moment I'm trying to create a system call (Chapter 5) but I am
unable
Quoted 3 lines
Quoted 3 lines
to do the first step which states the following:
"Add an entry to the end of the system call table.This needs to be done for each architecture that supports the system call (which, for mostcalls,
Quoted 2 lines
Quoted 2 lines
is all the architectures).The position of the syscall in the table, starting at zero, is its system call number. For example, the tenth
entry
Quoted 3 lines
Quoted 3 lines
in the list is assigned syscall number nine."
My problem is that I am unable to find the file that holds the table.
In
Quoted 1 line
Quoted 1 line
the book the file that needs to be changed is the
entry.Sbut it nolongers
Quoted 1 line
Quoted 1 line
exists in v3.9. In an example that I have found on the internet, which
is
Quoted 1 line
Quoted 1 line
done using v3.0, the file to change is
syscall_table_32.S. But I'vegot the
Quoted 1 line
Quoted 1 line
same problem, it doesn't exist. So anybody can help me to find the
table? I
Quoted 4 lines
Quoted 4 lines
know that I should be using v2.6 of the kernel but I don't know if that version will work with the distribution that I'm using.
The question is also in stackoverflow so if someone wants to answer
there
Quoted 2 lines
Quoted 2 lines
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-9
Quoted 9 lines
Quoted 9 lines
--
Iker Pedrosa <[email protected]>_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Quoted 3 lines
--
Iker Pedrosa <[email protected]>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130723/5b27f09b/attachment.html
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
Quoted 149 lines · On Tue, 23 Jul 2013 11:11:16 +0530 Srinivas Ganji…
Hi Iker Pedrosa,
Have you completed with your own directory implementation? If you see any issues, please let me know.
Regards,
Srinivas.Quoted 138 lines · Iker Pedrosa
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, I'm going to try to create my own directory in kernel source which contains my system call implementation files as Srinivas Ganji has proposed.Quoted 7 lines · On Fri, 19 Jul 2013 12:15:44 +0530 Srinivas Ganji…
Hi Iker Pedrosa,
In old versions of Linux kernels like 2.6.xx, the approach was different 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 two approaches
is,
Quoted 2 lines
in one approach, we implement our system call in already existing file of kernel sources. In another approach, we created our own directory in
kernel
Quoted 3 lines
source which contains our system call implementation files. Ans in this second approach, we need to modify the Kernel Makefiles and Configuration files to include our newly created directory and its contents. First let
us
Quoted 21 lines
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 existing kernel sources. The paths given below are relative paths from
/usr/src/linux.1. Generally, add the function (system call) definition in
kernel/sys.cfile./* 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 file
include/linux/syscalls.hasmlinkage long
sys_helloworld(void);Quoted 8 lines
3. Create an entry in system call table in the
filearch/x86/syscalls/syscall_32.tbl350 i386 helloworld
sys_helloworldNote: 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 the
EXTRAVERSION
Quoted 17 lines
in the main
Makefileavailable at/usr/src/linuxEXTRAVERSION = .ownsyscall
5. Then, build the modules from the main directory with the following.
make menuconfig --- Just save and exit.
make modules
makemodules_install
make install6. Now, reboot with our own image.
7. Write a simple C application for calling the our own system call.
#include <
stdio.h>Quoted 8 lines
/*
sys_helloworld350 */
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, you
can
Quoted 4 lines
practice the second approach. It needs of creating our own directory and files (C,
Makefile,Kconfig) and modifications required in architecture specificKconfig.Quoted 11 lines
Regards,
Srinivas.Quoted 4 lines · On Thu, Jul 18, 2013 at 2:34 PM, Iker Pedrosa <[email protected] wrote:
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 Robert
Love. For
Quoted 1 line
Quoted 1 line
the moment I'm trying to create a system call (Chapter 5) but I am
unable
Quoted 3 lines
Quoted 3 lines
to do the first step which states the following:
"Add an entry to the end of the system call table.This needs to be done for each architecture that supports the system call (which, for mostcalls,
Quoted 2 lines
Quoted 2 lines
is all the architectures).The position of the syscall in the table, starting at zero, is its system call number. For example, the tenth
entry
Quoted 3 lines
Quoted 3 lines
in the list is assigned syscall number nine."
My problem is that I am unable to find the file that holds the table.
In
Quoted 1 line
Quoted 1 line
the book the file that needs to be changed is the
entry.Sbut it nolongers
Quoted 1 line
Quoted 1 line
exists in v3.9. In an example that I have found on the internet, which
is
Quoted 1 line
Quoted 1 line
done using v3.0, the file to change is
syscall_table_32.S. But I'vegot the
Quoted 1 line
Quoted 1 line
same problem, it doesn't exist. So anybody can help me to find the
table? I
Quoted 4 lines
Quoted 4 lines
know that I should be using v2.6 of the kernel but I don't know if that version will work with the distribution that I'm using.
The question is also in stackoverflow so if someone wants to answer
there
Quoted 2 lines
Quoted 2 lines
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-9
Quoted 9 lines
Quoted 9 lines
--
Iker Pedrosa <[email protected]>_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies--
Iker Pedrosa <[email protected]>
Signature · 1 line
Iker Pedrosa <[email protected]>
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.
Quoted 180 lines · Iker Pedrosa
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
Quoted 5 lines · On Tue, 23 Jul 2013 11:11:16 +0530 Srinivas Ganji…
Hi Iker Pedrosa,
Have you completed with your own directory implementation? If you see any issues, please let me know.
Quoted 9 lines
Regards,
Srinivas.Quoted 2 lines · On Sat, Jul 20, 2013 at 4:13 PM, Iker Pedrosa <[email protected] wrote:
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 1 line
Quoted 1 line
I'm going to try to create my own directory in kernel source which
contains
Quoted 8 lines
Quoted 8 lines
my system call implementation files as Srinivas Ganji has proposed.
Quoted 3 lines · On Fri, 19 Jul 2013 12:15:44 +0530 Srinivas Ganji…
Hi Iker Pedrosa,
In old versions of Linux kernels like 2.6.xx, the approach was
different
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
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 two
approaches
Quoted 2 lines
Quoted 2 lines
is,
Quoted 1 line
in one approach, we implement our system call in already existing
file of
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
kernel sources. In another approach, we created our own directory in
kernel
Quoted 1 line
source which contains our system call implementation files. Ans in
this
Quoted 1 line
Quoted 1 line
Quoted 1 line
second approach, we need to modify the Kernel Makefiles and
Configuration
Quoted 1 line
Quoted 1 line
Quoted 1 line
files to include our newly created directory and its contents. First
let
Quoted 7 lines
Quoted 7 lines
us
Quoted 6 lines
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 existing
kernel
Quoted 1 line
Quoted 1 line
Quoted 1 line
sources. The paths given below are relative paths from
/usr/src/linux.Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
1. Generally, add the function (system call) definition in
kernel/sys.cQuoted 9 lines
Quoted 9 lines
Quoted 9 lines
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 file
include/linux/syscalls.hQuoted 10 lines
Quoted 10 lines
Quoted 10 lines
asmlinkage long
sys_helloworld(void);3. Create an entry in system call table in the
filearch/x86/syscalls/syscall_32.tbl350 i386 helloworld
sys_helloworldNote: In my case already table had 349 offsets, so I added it as 350.
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
4. If we want to create our own kernel images, then change the
EXTRAVERSION
Quoted 5 lines
in the main
Makefileavailable at/usr/src/linuxEXTRAVERSION = .ownsyscall
5. Then, build the modules from the main directory with the
following.
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
make menuconfig --- Just save and exit.
make modules
makemodules_install
make install6. Now, reboot with our own image.
7. Write a simple C application for calling the our own system call.
#include <
stdio.h>Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
/*
sys_helloworld350 */
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,
you
Quoted 2 lines
Quoted 2 lines
can
Quoted 1 line
practice the second approach. It needs of creating our own directory
and
Quoted 1 line
Quoted 1 line
Quoted 1 line
files (C,
Makefile,Kconfig) and modifications required inarchitecture
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
specific
Kconfig.Regards,
Srinivas.On Thu, Jul 18, 2013 at 2:34 PM, Iker Pedrosa <
ikerpedrosam at gmail.com
Quoted 11 lines
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines · wrote:
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 Robert
Love. For
Quoted 1 line
Quoted 1 line
the moment I'm trying to create a system call (Chapter 5) but I am
unable
Quoted 2 lines
Quoted 2 lines
to do the first step which states the following:
"Add an entry to the end of the system call table.This needs to bedone
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
for each architecture that supports the system call (which, for
most
Quoted 7 lines
Quoted 7 lines
calls,
Quoted 2 lines
Quoted 2 lines
is all the architectures).The position of the syscall in the table, starting at zero, is its system call number. For example, the tenth
entry
Quoted 3 lines
Quoted 3 lines
in the list is assigned syscall number nine."
My problem is that I am unable to find the file that holds the
table.
Quoted 4 lines
Quoted 4 lines
In
Quoted 1 line
Quoted 1 line
the book the file that needs to be changed is the
entry.Sbut it nolongers
Quoted 1 line
Quoted 1 line
exists in v3.9. In an example that I have found on the internet,
which
Quoted 6 lines
Quoted 6 lines
is
Quoted 1 line
Quoted 1 line
done using v3.0, the file to change is
syscall_table_32.S. But I'vegot the
Quoted 1 line
Quoted 1 line
same problem, it doesn't exist. So anybody can help me to find the
table? I
Quoted 1 line
Quoted 1 line
know that I should be using v2.6 of the kernel but I don't know if
that
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines
version will work with the distribution that I'm using.
The question is also in stackoverflow so if someone wants to answer
there
Quoted 2 lines
Quoted 2 lines
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-9
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
Quoted 9 lines
--
Iker Pedrosa <[email protected]>_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
--
Iker Pedrosa <[email protected]>--
Iker Pedrosa <[email protected]>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130724/6ea33481/attachment.html
Quoted 9 lines · On Wed, 24 Jul 2013 17:19:13 +0530 Srinivas Ganji…
Hi Iker Pedrosa,
Please look at how to write the
Kconfigfiles. We need to write a newKconfigfile for our own implementation.Regards,
Srinivas G.
Hi again,
I've just created the Kconfig and I have pend it from General setup, it's been a little bit difficult, mainly the part to pend it from General setup. Now, I've got some questions, which is the difference between the following statements?
1)
ifdef CONFIG_MY_SYSTEM_CALL
obj-y += my_system_calls.o
endif
2)
obj-(CONFIG_MY_SYSTEM_CALL) += my_system_calls.o
Where do I build the object in the object in the second option? Is it done in the same Makefile or in another one?
Regards,
Signature · 1 line
Iker Pedrosa <[email protected]>
Generally,
obj-y += foo.o
This tells kbuild that there is one object in that directory, named foo.o. foo.o will be built from foo.c or foo.S.
If foo.o shall be built as a module, the variable obj-m is used.
obj-$(CONFIG_FOO) += foo.o
$(CONFIG_FOO) evaluates to either y (for built-in) or m (for module). If CONFIG_FOO is neither y nor m, then the file will not be compiled nor linked.
The #1 in your case, ifdef i.e. if the compilation flag (in your case CONFIG_MY_SYSTEM_CALL) is defined then only the module is included into the image.
I hope this helps you.
Regards,
Srinivas G.
Quoted 27 lines · Iker Pedrosa
Quoted 9 lines · On Wed, 24 Jul 2013 17:19:13 +0530 Srinivas Ganji…
Hi Iker Pedrosa,
Please look at how to write the
Kconfigfiles. We need to write a newKconfigfile for our own implementation.Regards,
Srinivas G.Hi again,
I've just created the
Kconfigand I have pend it from General setup, it's been a little bit difficult, mainly the part to pend it from General setup. Now, I've got some questions, which is the difference between the following statements?
1)
ifdefCONFIG_MY_SYSTEM_CALL
obj-y += my_system_calls.o
endif2)
obj-(CONFIG_MY_SYSTEM_CALL) += my_system_calls.o
Quoted 7 lines
Where do I build the object in the object in the second option? Is it done in the same
Makefileor in another one?Regards,
--
Iker Pedrosa <[email protected]>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130812/1dc2b1f5/attachment.html