Linux Kernel Analysis-System Call implementation code analysis-Linux general technology-Linux programming and kernel information. The following is a detailed description. The startup has been read for a long time. Now, to write the notes, you can roughly read them again after the startup. There are several major modules: startup and initialization, interrupt signal, process and scheduling, and memory management, file systems, networks, drivers, modules, etc. I mainly start with these. Since the startup part involves a lot of compilation knowledge related to the x86 system before start_kernel, it takes a lot of time, so I skipped it, first grasp the general context of the entire system, and then do it twice, three analyses. I will analyze the network part from the 4.4BSD-Lite code.
System call:
First, let's talk about system calls. It's strange that all the read-core data has not put forward the system calls separately. I think it is more important. A key hub for communication between users and the system kernel. Take a closer look at its mechanism, prepare for three days, and have some books and materials at hand to help me understand it.
Concept: (clarify the basic concept) system calls occur in the user process and request the kernel to provide services through some special functions (such as open). In this case, the user process suspends and the kernel verifies the user request, click "try" and report the result to the user process. Then, restart the user process. These mechanisms are available in general programming books. I will discuss these mechanisms through the implementation of source code.
Specific implementation code: arch/i386/kernel/entry. S (kernel version 2.2.14) from entry. the first line of S is system_call, and the code lines 171-248 are pasted out. The analysis is in the form of a comment: ENTRY (system_call) \ All System Call ENTRY points, the system_call parameter is the number of system calls you want to activate pushl % eax # Save orig_eax. This value is the number of system calls you want SAVE_ALL. The SAVE_ALL macro is defined as follows: