Process of system call System_call

Source: Internet
Author: User

Zhu Shushu Original works reproduced please specify the source "Linux kernel Analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000

Typically, in the core of the OS, a set of subroutines (procedures) are set up to implement various system functions, and they are made available to the user to invoke the system procedure whenever the user needs to provide a service to the system. After invoking the system procedure, the program runs from the user state to the kernel state, the corresponding stack is also transferred from the user stack to the kernel stack, and the equivalent of the work of the protection site, the current state, stack top pointer, Cs:eip saved to the kernel stack. By breaking into the kernel state, the return time needs to be re-dispatched (so not necessarily directly back to the calling process), while recovering the scene through the iret operation.

The system call procedure is simple, it is entered by the 0x80 interrupt vector into the system call portal, which is implemented by using the system call table to save the address of the system service function. The specific process can be as follows:

0x80 Pass control to the core. A 0x80 is a vector address of a system call. This interrupt vector table is initialized at the start of the system, as well as some vector addresses, such as the system clock. When the user system is called, do the following:

Each system call is represented by the Lib library. Each system call in the Lib library is typically a macro syscallx (), and X is a numeric parameter for a specific invocation. Some system calls are more complex because they have variable
Parameter list, but they still use the same entry pointer. Each system call macro expands into a assembly segment that is used to establish the calling stack segment and then calls--entry (System_call) by calling break int $0x80.

System call Processing "Understanding: It is entered by the 0x80 interrupt vector into the system call portal, by using the system call table to save the address of the system service function in the form of implementation .

Process of system call System_call

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.