Operating system implementation (Netease open class) operating system interface L4 + L5 system call

 Laboratory building: lab report: https: //www.shiyanlou.com/courses/reports/1356557/

About system call: https://www.cnblogs.com/yiyide266/p/5538079.html

head.s initializes the GDT, IDT table.

Linux, the main function initializes over other parameters, will open shell. shell is a program, but does not terminate.

Get command, execute the command.

Achieve graphical interface it is to use a message handling mechanism.

The operating system is how to invoke hardware? Essentially C language program coupled with the C language in a number of important functions such as (printf) and so on.

Applications and operating system interfaces as well.

This program is called the C language system calls. System call is the operating system interface.

printf is packaged write, write system call is genuine.

This course does not require all the interfaces you will be back, but requires that you know how to check what interfaces. (-> POSIX)

 


 

 

There is such a question: the operating system and the application code in memory, the application if it is to directly access the operating system why not go directly to access the operating system where the memory space?

The first question: how can control the application can not be free of jmp

The second question: Since I can not jmp, then how access to the operating system?

 

Not random jmp, hardware control.

Hardware to split the memory of the user mode and kernel mode.

By a segment register (e.g., CS) controlled.

DPL (purpose privilege level), CPL (current (current) privilege level)

Stored in the GDT.

head.s during initialization, set to put the GDT 0

 

Only if the current privilege level is less than the purpose of the privilege level can be accessed.

Once system initialization is over, the user mode will be performed, this time for the CS segment register, the CS will CPL is set to 3.

Every jmp, mov must visit the GDT, because it will access the segment registers.

 

Answer Question 2:

It is the only way to break into the system kernel.

The surface is a function of open, (open systems function calls the function), in fact, which also includes int 0x80 interrupt instruction to enter the kernel. Before making the kernel interrupt handler returns to user mode.

 系统调用是由宏来展开的。

 

是IDT表

Guess you like

Origin www.cnblogs.com/JasonPeng1/p/12110074.html