Types and functions of segment registers: 1. The code segment register CS is used to store the segment of the currently running program code. 2. Data segment register DS, used to store data segments. 3. The stack segment register SS stores the stack segment. 4. The additional segment register ES stores the additional data segment used by the current program.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
The segment register is set for segmented management of memory. Computers need to segment memory to allocate it to different programs (similar to hard disk paging). When describing memory segmentation, the following segment information is required: 1. Size of the segment; 2. Starting address of the segment; 3. Management attributes of the segment (writing prohibited/execution prohibited/system exclusive, etc.). It is necessary to use 8 bytes (64 bits) to store this information, but the segment register only has 16 bits, so only the segment number (segment selector, also translated as "segment selector") can be stored in the segment register, and then the segment number is mapped to the existence GDT (global (segment) descriptor table, global segment number record table) in memory reads segment information.
Segment register: In the 8086 system, the address code for accessing the memory consists of two parts: the segment address and the offset address within the segment. The segment register is used to store the logical base value of each segment and indicates the four logical segments currently in use, including code segment register CS, stack segment register SS, data segment register DS and additional segment data register ES.
Types and functions:
1. Code segment register CS (Code Segment)
stores the segment base of the segment where the currently running program code is located address, indicating that the currently used instruction code can be obtained from the memory segment specified by the segment register, and the corresponding offset is provided by IP.
2. Data segment register DS (Data Segment)
indicates the lowest address of the segment where the data used by the current program is stored, that is, the base address of the segment where the data segment is stored.
3. Stack segment register SS (Stack Segment)
indicates the bottom address of the current stack, which is the segment base address where the stack segment is stored.
4. Additional segment register ES (Extra Segment)
indicates the segment base address of the additional data segment used by the current program. This segment is the segment where the destination string in the string operation instruction is located.
If you want to read more related articles, please visitPHP Chinese website! !
The above is the detailed content of What are the types and functions of segment registers?. For more information, please follow other related articles on the PHP Chinese website!