Programming <4>

zhaozj2021-02-16  51

Programming <4>

This code, we can use the previous figure. To use LDT, we need to use MOV AX, GDTSEG, LLDT AX these two commands are sent to the global description table into the local descriptor table register. In implementing these two After the command, I can use it.

The various paragraphs in the table in the local descriptor. Oh, huh.

The following code demonstrates the transformation of the inner privilege level in this program, I demonstrate how to achieve the privilege level of the task by calling the door and RETF. Every privileged level has its own stack. In my program I use 0 and level 3, in a non-committed privileged transformation, I use the stack to implement the transformation. First build a level 0 stack, then press the 3-level stack of pointers into this level 0 stack. In theory, it is also necessary to press the parameters used by the 3 segment into the 0-level stack. This makes it easy to call these parameters directly, but my programs do not do this because the program can be pressed. Then use RETF to point to the segment described by the VCODE_SEL descriptor, and EIP points to compile VSTART, which is implemented in the segment.

Then use the write screen technology to display what I want to display, and use the calling door to achieve the level 3 from 0. I will introduce the call gate.

The door is also one of the descriptor. His structure is as follows:

Gate struch

OFFSETL DW 0; 32-bit offset low 16 bits

Selector dw 0; selector

DCOUNT DB 0; double word calculation field

GTYPE DB 0; Type

OFFSEth DW 0; 32-bit offset high 16-bit

Gate Ends

Such as Tovbuf Gate , tojump indicates the low 16 bits of 32-bit offset, the last 0 is a high 16 bit of 32-bit offset, and Codek_sel is the target's selection, which is the target. Descriptor of the segment. The DPL of the door describes the segment that can access the outermost layer of the segment. You can use the inter-period call command Call, and the task can be used to transform from the outer privilege to the inner privilege.

Since the file plus coded is very long, the code should see the protection mode programming five

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

New Post(0)