Linux kernel Design Week fourth--clawed system call three layer leather by Su Zhengshen Original works reproduced please specify the source "Linux kernel Analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000 One, Knowledge Point collation 1. User-State kernel state and interrupt Handler
We generally use system calls in general through library functions
User-State and kernel-State distinction:
"The CPU has different execution levels, and at high execution level, the code can execute privileged instructions, access any physical address, and at a low level of execution, there will be a certain limit." (for system security and stability purposes) The Intel X86 CPU has four different execution levels 0-3;linux uses only the 0 and 3 levels to represent the kernel state and the user state. 】
A significant distinction: the lowest two bits of the CS register indicate the privilege level of the current code
In Linux, the address space is a significant sign:
The address space above 0xc0000000 can only be accessed in the kernel State,
The 0XC00000000--0XBFFFFFFF address space can be accessed in both states.
Interrupt Occurrence Process:
Interrupt processing is the primary way to enter the kernel state from the user state, and the system call is only a special interrupt.
The first thing that happens after an outage is to save the scene:
The interrupt/int instruction stores the value of some registers on the stack (user-state stack top address, current state word, then CS:EIP value)
The first thing to do before the break ends is to resume the scene.
Save_all:
Kernel code to complete interrupt service.
2. Overview of system calls and three-layer skins for system calls:
System invocation: Provides a set of interfaces for interacting with user-state processes and hardware devices.
Fourth week of Linux kernel design--clawed system calls three layers of skin