20135130 Wangkuandong
One, add time and time-asm command to Menuos
Command: 1, forced Delete: RM MENU-RF
2. Clone: Git clone (followed by the location where the data needs to be cloned)
3, automatic compilation, automatic generation of root file system, and automatically start: Make Rootfs
Add time and Time-asm command steps to Menuos:
1. Update the menu code to the latest version
2. Add Menucongfig in main function
3. Add the corresponding time and TIME-ASM functions
4. Make Rootfs
Second, using the GDB trace call kernel function sys-time
The tracking method is the same as the previous one:
Note: Sys_time returns and enters assembly code processing, GDB cannot continue tracking
Execute system_call corresponding code after executing int 0x80
Third, the system calls in the kernel code processing process
1. Initialization of system call mechanism
\INIT\MAIN.C Start_kernel
Trap_init ()
\arch\x86\kernel\traps.c
#fdef config_x86_32
Set_system_trap_gate (Systall_vector,&system_call) (systall_vector: The working vector of the system call, &system_call: The entry of the assembly code, The system executes int 0x80 to jump to that place to execute)
Set_bit (syscall_vector,used_vectors)
#endif
2, System_call pseudo-code:
System_call Location:/ARCH/X86/KERNEL/ENTRY_32.S
System call is a special interrupt: There is a save site and a recovery site
Save_all Preservation Site
Restore_all Recovery Site
Call *sys_call_table (,%eax,4) calls the system call function: EAX is the system call number, according to the system call number to find the sys_call_table interrupt processing.
Interrupt_return, is iret.
Update the menu code to the latest version:
Add Menuconfig to the main function:
Add the corresponding Getuid function and getuidasm function
Flow chart:
Summarize:
When an interrupt occurs, the CPU suspends execution of the current program, resulting in an interrupt response. Interrupt response The main work is:(1) suspending the execution of the current procedure;(2) Save the original breakpoint site(3) go to the corresponding handler. thenThe interrupt handler is processed accordingly: (1) Save interrupt Program on-site (2) analyze the cause of the interruption and transfer to the appropriate handler (3) Call interrupt handler (4) to interrupt the return.
The fifth week of Linux kernel and analysis