Read the nuclear diary (5)

xiaoxiao2021-03-06  101

Nuclear read the diary (E) This article comes from: http: //os.silversand.net Author: sunmoon (2001-09-01 08:05:00)

I can't get busy. At this time, I will experience the work and I am really different in school. Sometimes I want to do it, but I have not been lazy for a while. For Linux 386 protection mode, memory management, I made a preliminary study. When I learned the operating system class, I didn't use the theory. Today, I really know how the theoretical knowledge is. Maybe it is a book to use time to hate less gossip, Linux is transplanted Go to various machines. Such as Apple, but I personally think that Linux is really charming. Still in the i386 machine. Because the original intention of Llinus in Linux is, ITEL 80386 on the 386 platform. "Protection Mode" of the series of processors. Management and allocation of the resource of the operating system. The virtual memory is implemented by the 80386 hardware storage management and protection mechanism, which is a design plan for the memory. He comes from the original main memory very expensive era. The partial principle of the program is used, that is, the program is not necessary to load memory at runtime. The part of the branch is currently running into the memory can be actually, the entire storage system is cached by cache --- memory --- Multi-level storage media such as hard drives, but this is the original transparent, such as we implement such an instruction in the program.

MOV BX, 1997MOV AX, [BX]

This way is the content of 1997 to copy to AX, which is virtualized by the address generated by the program. This address is different from the actual physical address. To have this address to the actual physical address, you need to have a conversion mechanism. The hardware unit that is usually called MMU does this task so-called protection mechanism is based on this basis. Its purpose is to make different blocks do not interfere. The system process is strictly separated by the system security and more users. Process requirements. In Linux, different virtual addresses to different virtual addresses to different tasks in Linux. To achieve switching and protection of different tasks. At the same time .linux "possibilities" is separated by the system process with the user process (I am not too OK, it may be to control the address of the system process within 100,000? Of course, shared memory in the IIPV pass, due to improper consequences of operations). In addition, Linux also has different degrees of protection against the unified task. Using priority is determined. For example, the priority of the kernel is 0, system call: 1 library: 2 User process 3. When the program is read and written, the county checks the priority, and decided it Running priority or access rights. I think this priority will be associated with some parameters of Struct_Task's parameters. For memory management, it is usually three ways of segment, page, and segment formulas. The virtual-physical conversion mechanism discussed herein is different. Because Linux implements segment-type memory management. Therefore, these two mapping mechanisms must have segment management, using a series of available Change the size of the address set for management. It is the advantage that it can make full use of physical memory. Detappread is difficult to manage, usually we can define a segment in c (this definition is just the concept of interpretation, not this is not the case) Typedf StuCrt Duan {struct duan * next, * pre; / * required pointer * / int Tag; il; ilin, end / * starting point * / int size; data data; / * content * / .......} It is the data structure of the paragraphs that may be used in the actual memory. In the protection mode, the so-called segment is protection management. Some of the baseline addressing in the assembly language is similar: he is the foundation for virtual-physical address transformation (To put it bluntly, I personally think that all the paragraphs are defined as the page, but I don't actually see how Linux is doing, so don't be misleaded by me, there is a base address (Base Address). The start address in linear physical memory has a restriction bits, and the maximum offset in the segment (the attribute) indicating the segment (that is, the size) Whether this segment will be read and write these three attributes, which are called a so-called descriptor in the descriptor. It is a storage unit of 8 sub-sections, and its structure is as follows: byte 0 ----- 0-7 Description 苻 byte 1 ------ 8-15 Bit Descriptor Bytes 2 ----- 0-7 Based Access Bytes 3 ----- 8-15 Based bytes 4 - --- 16-24 Segment base byte 5 ----- Storage permission byte byte 6 ----- G | D | 0 | 0 | 16-19 Bit Different Birace 7 --- --31--24 Substatic base lists are the 5th bytes, which contain several flag bits. It is used to mark that the paragraph is in memory, still not. The latter is the user Section or system segment. It is limited by the level. This is not illustrated here. I hope interest-to-interest can check the information. I will listen to us in the system segment. There is a byte. Can be used to define the system The type of segment seems to have a 16-class image logo as a valid 386.tss, 386 interrupt door, 386 trap door, etc., this is not included here. To figure out the two rank TSS (system status) LDT (Local Descriptive Script), in the relevant information, there is often a series of descriptions in the core of Linux. Like global description 苻 table (GDT), interrupt description 苻 table (IDT) has the above introduction LDT Wait, in them. Define the description of the system, interrupt door, and so on. Its role is to make the compatibility of the machine to be guaranteed in LDT. The code segment is defined and the specific task is associated. Data segments, etc. Describe the internal data structure of the table is approximately as follows: typedef struct dec_struct {Unsigned long A, b;} Rear definitions of the description table after the following two lines are completed and the definition of external description 苻: DESC_TABLE [256];

转载请注明原文地址:https://www.9cbs.com/read-104127.html

New Post(0)