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
2
votes
1 answer

ARM PC overwritten with incorrect value in buffer overflow

I am working on stack smashing on ARM and I have a buffer declared as: char buff[12]; in my code. In order to find the location where the PC gets overwritten in gdb I write AAAABBBBCCCCDDDDEEEEFFFF to buff I expected DDDD to overwrite FP(r11) as…
dbayoxy
  • 33
  • 7
2
votes
1 answer

How do the two program counter registers work in the 6502?

I am currently developing a subset of the 6502 in LogiSim and at the current stage I am determining which parts to implement and what can be cut out. One of my main resources is Hanson's Block Diagram. I am currently trying to determine how exactly…
Clink123
  • 124
  • 10
2
votes
1 answer

How to determine the program counter when decoding from assembly to machine code (Y86)?

Im having trouble understanding how the address location is determined when decoding from assembly to Y86. In the example, 0x030 0x030: 6300 # xorq %rax , %rax 0x032: 50030001000000000000 # mrmovq 0x100(%rax ) ,…
2
votes
2 answers

Why 32-bit processor can only address 4GiB of memory, even with large word size?

Until now I thought that a 32-bit processor can use 4 GiB of memory because 232 is 4 GiB, but this approach means processor have word size = 1 byte. So a process with 32-bit program counter can address 232 different memory words and hence we have 4…
mightyWOZ
  • 7,946
  • 3
  • 29
  • 46
2
votes
1 answer

Is it possible to read another thread's program counter?

Is is possible (in a C or C++ program, running under Linux on a 64-bit-Intel architecture) for thread A to read the value of thread B's program counter register, without requiring any special instrumentation of to thread B's code? (I realize that's…
Jeremy Friesner
  • 70,199
  • 15
  • 131
  • 234
2
votes
1 answer

How to modify return address on Stack in C or Assembly

As you know, when a subroutine calls, current PC (program counter) value stores in stack. I want to modify it inside the subroutine, like below. I want do this on Intel Core-i7 3632QM using gcc compiler. void main() { foo(); } void foo() { …
Javad Yousefi
  • 2,250
  • 4
  • 35
  • 52
2
votes
1 answer

Program Counter Overflow?

Is it possible for the Program Counter (PC) in a processor to overflow, and if so, what happens? That is, if it can hold 1 byte, what happens when it is increased beyond 255?
hnefatl
  • 5,860
  • 2
  • 27
  • 49
2
votes
4 answers

GPGPU: Consequence of having a common PC in a warp

I read in a book that in a wavefront or warp, all threads share a common program counter. So what is its consequence? Why does that matter?
user25108
  • 383
  • 5
  • 15
2
votes
1 answer

Execute a piece of code from the data-section

I want to take a piece of code, copy it into a global array and execute it from there. In other words, I am trying to to copy a bunch of instructions from the code-section into the data-section, and then set the program-counter to continue the…
barak manos
  • 29,648
  • 10
  • 62
  • 114
2
votes
2 answers

Atmel Studio executes instructions outside my source files

I'm trying to write and debug a C program for an ATMega8 device using the Atmel Studio Simulator. For example, let's say I'm trying to debug this piece of code: int main(void) { while(1) { SPI_transaction(0xFF); } } uint8_t…
Aldridge1991
  • 1,326
  • 6
  • 24
  • 51
2
votes
1 answer

Program Counter values of an executing Java Program

Possible Duplicate: Program Counter register values for a Java program Is it possible to obtain the program counter (PC) register values of a running Java application?
Daanish
  • 1,061
  • 7
  • 18
  • 29
1
vote
2 answers

How does the value of the program counter increment?

I have a block of instructions for which I wanted to know how the pc register works. It says on Wikipedia, the pc register holds the value of the next instruction to be executed, however, looking at the disassembly graph of binary ninja for the same…
1
vote
2 answers

Equivalent eip/rip, ebp/rpb, UESP/rsp registers for ARM / Aarchh64 processor

Heading ##What is the equivalent of eip, rip registers used for Intel CPU but for ARM/Aaarch64 CPU ? I need to translate a application written for Intel CPU that uses the 32 bit eip or the 64 bit rip register. Thoses methods use intel…
fredvs
  • 29
  • 6
1
vote
1 answer

Program counter in processes

I'm having some issue understanding this passage in Tanenbaum Modern Operating system book: "we see four processes, each with its own flow of control (i.e., its own logical program counter), and each one running independently of the other ones. Of…
swittuth
  • 77
  • 2
  • 5
1
vote
0 answers

What happens when ADDS PC, #-4 is executed? Infinite loop?

So I'm trying to write an emulator for Arm instructions in a special context and I would like to understand the full behavior of the program counter in an Arm processor. Specs have the statement below The Program Counter (PC) is accessed as PC (or…