Analyze assembly code to understand how computers work, assembly code to understand computers

Source: Internet
Author: User

Analyze assembly code to understand how computers work, assembly code to understand computers

For reprinted original works of Zhou yuyong, please indicate the source

Linux Kernel Analysis MOOC course http://mooc.study.163.com/course/USTC-1000029000 Decompiling C code into assembly code to analyze how the computer works.Below is the simplified assembly code for compiling C code into assembly code
1g: 2 pushl % ebp 3 movl % esp, % ebp 4 movl 8 (% ebp), % eax 5 addl $6, % eax 6 popl % ebp 7 ret 8 f: 9 pushl % ebp10 movl % esp, % ebp11 subl $4, % esp12 movl 8 (% ebp), % eax13 movl % eax, (% esp) 14 call g15 leave16 ret17 main: 18 pushl % ebp19 movl % esp, % ebp20 subl $4, % esp21 movl $4, (% esp) 22 call f23 addl $2, % eax24 leave25 ret

 

Analysis of stack changes in the working process of assembly code

Conclusion: The EIP tells the CPU which command to execute. by executing a specific sequence of commands, the computer can complete a specific computing task.

 

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.