Questions tagged [program-counter]

The program counter (PC), commonly called the instruction pointer (IP) in Intel x86 and Itanium microprocessors, and sometimes called the instruction address register (IAR), the instruction counter, or just part of the instruction sequencer, is a processor register that indicates where a computer is in its program sequence.

The program counter (PC), commonly called the instruction pointer (IP) in Intel x86 and Itanium microprocessors, and sometimes called the instruction address register (IAR), the instruction counter, or just part of the instruction sequencer, is a processor register that indicates where a computer is in its program sequence.

105 questions
4
votes
1 answer

Meaning of pc in gdb (alias?)

I have a small x86_64 assembly program and I don't see any register specifically called pc (program counter?), though there is the instruction pointer, in the rip register However, when I type in: >>> p/x $rip $15 = 0x4000c5 >>> p/x $pc $16 =…
carl.hiass
  • 1,526
  • 1
  • 6
  • 26
4
votes
2 answers

Break at address "0xXXXXXX" with no debug information available, or outside of program code

Configuration: Using Nucleo-L476RG. Using GNU ARM Eclipse. I have generated a minimalist code from STM32CubeMX. I have flashed J-link driver in my on board ST-Link. Have been trying to run debugger for my code but my program counter is not setting…
Abhishek Behera
  • 41
  • 1
  • 1
  • 5
4
votes
0 answers

Find program counter of process in kernel

I'm trying to track the value of the PC of a particular process within the kernel. To do this, I looked at the kernel source and figured out that the pc is being stored inside task_struct->stack and that to make sense of the stack, I need to type…
Guru Prasad
  • 4,053
  • 2
  • 25
  • 43
3
votes
1 answer

What does RISC-V do on PC overflow?

What happens on a RISC-V CPU when the program counter (PC) overflows? For example, what happens on RV32G IALIGN = 32 after a (32-bit) NOP at 0xFFFF’FFFC has been executed? Or on RV32GC after a 16-bit NOP at 0xFFFF’FFFE has been executed? The easiest…
Alex Shpilkin
  • 776
  • 7
  • 17
3
votes
2 answers

PIC 16F84 PCLATH Bit3+4 unnecessary for CALL/GOTO?

I am trying to simulate the PIC16F84 and now need to implement PCL / PCLATH registers. The PIC16F84 has 1K of Program memory. The PCL is 8Bit wide, so in this case Bit 0 and 1 of PCLATH is used to switch between the four Pages each having a size of…
3
votes
1 answer

"PC" on Mips Reference Sheet

I'm practicing converting a Mips instruction (beq $t5, $s0, loop) to binary based on the Mips reference sheet and there are a series of instructions (PC=PC + 4 + branch address) for computing the immediate value for an "I" type instruction and it…
kocho84
  • 91
  • 1
  • 10
3
votes
1 answer

Why are we adding 0 to a double void pointer here?

For context, this is code called from a bootloader that is supposed to boot into the main application. This snippet is from a function with an argument uintptr_t address that specifies the address of where the main application has been written to. I…
Capn Jack
  • 1,201
  • 11
  • 28
3
votes
1 answer

How to get the instruction pointer in x86_64 without 0x00 or 0xFF bytes?

Is there a way to access the value in the instruction pointer (RIP) without using a call followed by a pop in assembly language? Or is there a machine code opcode that can do it? I have been googling with no clear results. My problem is that I…
Madness
  • 41
  • 1
  • 2
3
votes
1 answer

How to save program counter address without using J-Type instructions in MIPS architecture

I have to implement jal instruction as pseudo-instruction without using J-Type instructions. I can implement it with jr but I know that jal stores current PC+8 in $ra. How can I implement that? How can I store PC address in ra without J-type?
Vlad
  • 8,225
  • 5
  • 33
  • 45
3
votes
4 answers

Where the program counter goes after returning the interrupt handler?

Hi I am wondering where the program counter goes when the program returns from interrupt service routine? I know when the interrupt event occurs the PC is pushed into the stack. But what address is pushed into the stack the next one or the same…
Radoslaw Krasimirow
  • 1,833
  • 2
  • 18
  • 28
3
votes
2 answers

How to get current program counter inside mprotect handler and update it

I want to get the current program counter(PC) value inside mprotect handler. From there I want to increase the value of PC by 'n' number of instruction so that the program will skip some instructions. I want to do all that for linux kernel version…
azizulhakim
  • 658
  • 7
  • 24
2
votes
2 answers

Trying to understand an assembly line of ARM7

I have this assembly line : 01000AD8: 979FF103 LDRLS PC,[PC,R3,LSL #2] With PC = 0x01000AD8 R3 = 0x00000008 CDPS = 800000D3 (so C=0, Z=0) When I execute this line, the new value for PC should be(if I understand LDRLS correctly*) PC =…
Martin Allard
  • 283
  • 1
  • 7
  • 16
2
votes
1 answer

Does the fetch phase in the x86 CPU increment eip(PC) to the next instruction?

During the fetch phase of the instruction cycle in an x86 CPU, I've wondered if the eip(PC) register gets incremented to store the next instruction at the end of that phase(fetch phase) or after the execution phase? I know that MIPS CPUs increment…
AngryJohn
  • 576
  • 4
  • 10
2
votes
1 answer

Why the Frame's value represents the program counter + 1 in the pc function

I am confused when studying the pkg/errors. In the file stack.go, we can see the comment about the struct Frame as below: // Frame represents a program counter inside a stack frame. // For historical reasons if Frame is interpreted as a uintptr //…
RocketMan
  • 21
  • 2
2
votes
1 answer

in ARMv6, why the value of PC is current instruction plus 8?

what if the stages of pipeline is not 3, such as in ARM1156T2-S (also is ARMv6), it has 9 stages: Fe1 Fe2 De Iss Fe3 Sh ALU Sat WBex the PC is still address of current instruction plus 8?
wenlujon
  • 673
  • 1
  • 6
  • 16