0% found this document useful (0 votes)
47 views

Creating Your System Calls in Linux

1. There are 358 system calls in the 32-bit Linux kernel version 3.19 and 322 system calls in the 64-bit version. 2. Without the asmlinkage tag, only 6 of the parameters for a system call can be passed via registers due to limitations of the x86 architecture. The asmlinkage tag allows system calls to access additional arguments from the CPU stack. 3. A custom header file can be included from a home directory and then moved to the /usr/include directory to make it accessible for use in applications by including the header file.

Uploaded by

Abhijeet Shome
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Creating Your System Calls in Linux

1. There are 358 system calls in the 32-bit Linux kernel version 3.19 and 322 system calls in the 64-bit version. 2. Without the asmlinkage tag, only 6 of the parameters for a system call can be passed via registers due to limitations of the x86 architecture. The asmlinkage tag allows system calls to access additional arguments from the CPU stack. 3. A custom header file can be included from a home directory and then moved to the /usr/include directory to make it accessible for use in applications by including the header file.

Uploaded by

Abhijeet Shome
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment 4-System Calls

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

Assignment 4-System Calls


parameters passed via registers, faster syscall instruction) while using 32-bit
pointers and thus avoiding the overhead of 64-bit pointers.
64 ABI Tag
The 64 ABI(Application Binary interface) is a binary interface of linux kernel.
This is used for the system calls which are to be executed specically for 64 bit
operation.
Common ABI Tag
The common ABI(Application Binary Interface) is basically a binary interface
of the linux kernel. This is used for the system calls which are common for 64
bit operation as well as the 32 bit operation.
5. Two system calls were added for 32-bit and 64-bit system as follows:
1. int sys_abhijeetadd (int num1,num2);
2. int sys_abhijeetmult (int num1,num2);

You might also like