Home  >  Article  >  What is the register that stores the offset address in the code segment?

What is the register that stores the offset address in the code segment?

青灯夜游
青灯夜游Original
2021-01-22 13:54:019969browse

The register that stores the offset address in the code segment is: the instruction pointer register. The instruction pointer register IP is used to control the execution sequence of instructions in the program; during normal operation, the IP contains the offset address of the next instruction (byte) to be fetched by the BIU. Under normal circumstances, the instruction code is accessed from memory every time , the IP will automatically increase by 1 to ensure the sequential execution of instructions.

What is the register that stores the offset address in the code segment?

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

The function of the register is to store binary code, which is composed of a combination of flip-flops with storage function. A flip-flop can store 1-bit binary code, so a register that stores n-bit binary codes needs to be composed of n flip-flops.

The register that stores the offset address in the code segment is: the instruction pointer register.

The instruction pointer register IP (X86 CPU) is equivalent to the program counter PC in the ARM CPU and is used to control the execution sequence of instructions in the program. During normal operation, the IP contains the offset address of the next instruction (byte) to be fetched by the BIU. Under normal circumstances, every time an instruction code is accessed from the memory, the IP is automatically incremented by 1 to ensure the sequential execution of instructions. IP is actually the address pointer where the instruction machine code stores the memory unit. The content of IP can be forcibly rewritten by transfer instructions (such as JMP) to change the order of program execution.

Notice! The program we compiled cannot directly access IP, that is, we cannot use instructions to retrieve the value of IP or set a value for IP (for example, we cannot use the mov instruction to assign a value to IP).

Extended knowledge: Concept distinction

Instruction Register (IR, Instruction Register), used to temporarily store the current process instructions to execute. The clock signal of the instruction register is clk, which is triggered on the rising edge of clk. The instruction register stores the instructions sent from the data bus into a 16-bit register, but not every data on the data bus needs to be registered, because sometimes instructions are transmitted on the data bus, and sometimes data is transmitted. Whether the data needs to be registered is controlled by the Ir_ena signal of the CPU state controller. On reset, the instruction register is cleared.

The instruction pointer register IP (Instruction Pointer) is used to store the address offset of the instruction to be fetched. Only when combined with the CS register can it form the real physical address pointing to the instruction.

If you want to read more related articles, please visit PHP Chinese website! !

The above is the detailed content of What is the register that stores the offset address in the code segment?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What does reset key mean?Next article:What does reset key mean?