Deep understanding of the Linux kernel-system calls

Source: Internet
Author: User
System call: The user state process to the kernel, to implement the user-state process calls the hardware Device function or interrupt;
Advantages: Making programming easier, freeing users from learning the low-level programming features of hardware devices, improving system-to-security, and enabling the kernel to check for correctness before satisfying requests; improve portability;

The difference between a system call and an API call:
1. The API call is a function definition; the system call is an explicit request to the kernel via a soft interrupt
2. The kernel can not access library functions

Kernel, the return value is positive or 0 indicates a successful end of the system call, otherwise indicates an error condition

Two ways to enter the kernel state: 1, execute int $0x80 instruction, 2, execute sysenter instruction
The kernel launches the system call way: 1, executes iret instruction, 2, uses sysexit instruction

System call Pass Parameters:
1, it saves the parameter in the CPU register, then reads by the kernel, cannot directly say the parameter from the user state stack passes to the kernel state stack, because this is more complex
2, the limit of the register, the number of parameters can not exceed 6; More than 6 May pass the address of a parameter collection
3, the length of the parameter is limited by the register, not more than 32bit, also can be addressed by the address.

Parameter check:
1.

Deep understanding of the Linux kernel-system calls

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.