Linux kernel and analysis How does the second week operating system work?

Source: Internet
Author: User

How does a computer work?

Stored program computer working model, the most basic logical structure of computer system;

The function call stack, the high-level language to run the foundation, only the machine language and the assembly language when the stack mechanism for the computer is not so important, but with the high-level language and functions, the stack becomes the basic function of the computer;

Enter

--PUSHL%EBP

--MOVL%ESP,%EBP

Leave

--MOVL%ebp,%esp

--POPL%EBP

function parameter passing mechanism and local variable storage

Interrupt, multi-channel program operating system base point, no interrupt mechanism program can only run from the beginning to the end of the possibility to start running other programs.

♦ Stack-related registers

–ESP, stacking pointer (stack pointer)

–EBP, Base point pointer (base pointer)

♦ Stack Operations

–push

Stack top address reduced by 4 bytes (32 bits)

–pop

Add 4 bytes to the top address of the stack

♦EBP is used in C to record the current function call base

♦ Other key registers

–CS:EIP: Always point to the next instruction address

• Sequential execution: Always point to the next instruction in consecutive addresses

• Jump/Branch: When executing such an instruction, the value of the CS:EIP is

Modified as required by the program

call: Pushes the value of the current CS:EIP into the top of the stack, Cs:eip points to the

The entry address of the calling function

ret: Eject the value from the top of the stack that was originally saved here, and put the CS:EIP

Into the CS:EIP

The following are the experimental contents:

The Qemu window can see that the my_start_kernel is executing while the My_timer_handler clock interrupt handler is executed periodically.

Kernel header file;

Before executing the MY_START_KERNEL,83 line is hardware initialization, 83 rows and later the operating system.

It's easier to print "My_start_kernel here" 100,000 times per cycle

The same is the initialization of hardware;

Each time the clock interrupt is called once PRINTK, output a ">>>>>>>>my_timer_handler here<<<<<<<<", Interrupt processing action

Wang Xue Cheng

Original works reproduced please indicate the source

"Linux kernel Analysis" MOOC course http://mooc.study.163.com/course/USTC-1000029000

Linux kernel and analysis How does the second week operating system work?

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.