Creating Your System Calls in Linux
Creating Your System Calls in Linux
1. Number of system calls that exist in linux kernel version 3.19 are
in 32 bit - 358
in 64 bit - 322
- 545
2.
Without asmlinkage, all the parameters for the syscall will be passed in
registers. Since there are only 6 general purpose registers in x86/x86_64, more
than 6 parameters cannot be passed without asmlinkage.
system_call achieves this feat simply by leaving its other arguments
(which were passed to it in registers) on the CPU stack. All system calls are
marked with the asmlinkage tag, so they all look to the CPU stack for
arguments. It is also used to allow calling a function from assembly files.
3. Header file in the home directory(home/abhijeet/abhijeet.h) can be included
in the directory(/usr/include) and can be removed from the home directory as
indicated .Doing so,we can use the "abhijeet.h" header file in the Application
implemented by including the #include<abhijeet.h> tag for accessing the system
call.
4. significance of using common, x32 and 64(ABI's) in the 64-bit kernel system
call declarations :
ABI (Application Binary Interface)
An application binary interface (ABI) is the interface between two
program modules, one of which is often a library or operating system, at the
level of machine code. An ABI determines such details as how functions are
called and in which binary format information should be passed from one
program component to the next, or to the operating system in the case of a
system call.
x32 ABI Tag
The x32 ABI (x32 application binary interface) is a new application binary
interface project and one of the interfaces of the Linux kernel. It is basically 32bit code running in x86-x64 mode on the CPU so that it has access to the
additional 8 registers to boost program speed while remaining memory ecient
via the use of 32-bit pointers. So it allows programs to take advantage of the
benets of x86-64 (larger number of CPU registers, better oating-point
performance, faster position independent code shared libraries, function