Is it possible to access or modify program counter
A program counter PC is a CPU register in the computer processor which has the address of the next instruction to be executed from memory. It is a digital counter needed for faster execution of tasks as well as for tracking the current execution point. A program counter is also known as an instruction counter, instruction pointer, instruction address register or sequence control register.
All instructions as well as data in memory have a specific address. As each instruction is processed, the software application responsible updates the program counter with the upcoming instructions' address which needs to be fetched. The program counter increases the stored value by one as the next instruction is fetched. If the computer is reset or restarts, the program counter usually reverts to the value of zero. Similar to other process registers of the computer, the program counter is like a bank of binary latches, with each representing one bit of value.
The program counter works in combination with other registers to identify the current instruction. It can be modified or accessed with the help of access or jump instructions. Therefore, the destination address can be loaded to the program counter via branch instructions.
The program counter can also be loaded with the address using the data processing instructions. By: Justin Stoltzfus Contributor, Reviewer. By: Satish Balakrishnan. Dictionary Dictionary Term of the Day. Natural Language Processing. Techopedia Terms. Ask Question. Asked 9 years, 10 months ago. Active 9 years, 10 months ago. Viewed 9k times. Improve this question. Brooks Moses 8, 2 2 gold badges 28 28 silver badges 57 57 bronze badges.
Amit Singh Tomar Amit Singh Tomar 7, 25 25 gold badges silver badges bronze badges. SO gonna jumps can you access PC? Add a comment. Active Oldest Votes. Improve this answer. Clifford Clifford You might add that the call instruction modifies it, as do conditional jumps. And you can do things like jmp eax jump to the address pointed to by EAX and jmp [eax] to jump to the address stored in memory pointed to by EAX.
And the int instruction on the x86 is rather like a call. Lots of ways to modify the program counter. Jim: That is true, but an unconditional jump modifies the PC and does nothing else. Ultimately every instruction can modify the PC even if it were only to increment it.
Amit would have to specify an architecture of he wanted a more specific answer. Unconditional jump instruction directly modifies the value of the PC. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.
0コメント