How computers work ——— the process of turning high-level language into machine language
20135304 Liu Xipeng
"Linux kernel Analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000 "
Experimental process
Write C language code
Get assembly code after executing gcc-s-o main.s main.c-m32 instruction
Delete with "." Get clean assembly code after opening additional items
Analysis process
Analysis of the working process after the pure assembly code is obtained
The first few steps are simpler, and the arrow color of the values pointed to by EBP and ESP corresponds to the color of the outer border of the code
It is worth emphasizing that after the main function executes to the "call F" instruction, the EIP points to the "F function", and the code executes into the F function,
In the F function, the EAX calculator stores the value "5304"
The "Call g" instruction points the EIP to the "G function" and starts executing the instruction of the G function.
In the G function, eax modifies 5307 to store the value
The pop%ebp instruction points ebp to 4,esp up one
The RET command exits the "G function", enters the position where the "f function" is removed, and the ESP moves up one
Executes the leave instruction of the F function, assigns the value of EBP to ESP, then points to 1 for the EBP, and then the ESP moves one
Exit the F function, execute the code after leaving the main function, modify EAX to 5308
The leave and RET instructions continue to be executed, allowing ESP and EBP to finally return to their initial state. The whole process is over.
Experimental experience
In the study of information security system in the "Buffer Overflow" experiment in the assembly code implementation process has a preliminary understanding, after this semester's course, let me have a clear understanding of the previously vague concept, the course video time is not long, but the explanation is very thorough, let us learn to assemble the core idea of code work. A deeper understanding of how the computer works. May be before the compilation of learning is not solid, in the video analysis process can not understand the knowledge point on the video repeatedly see clear ideas, finally learned.
How computers work ——— high-level languages into machine-language processes (20135304 Liu Xipeng)