The Wikipedia article on processor registers mentions:
Address registers hold addresses and are used by instructions that indirectly access primary memory.
Which addresses does this sentence refer to?
Computer Science Stack Exchange is a question and answer site for students, researchers and practitioners of computer science. It only takes a minute to sign up.
Sign up to join this communityThe Wikipedia article on processor registers mentions:
Address registers hold addresses and are used by instructions that indirectly access primary memory.
Which addresses does this sentence refer to?
RAM addresses or addresses of I/O devices. For example, in x86 architecture an IP (instruction pointer) register holds the memory address of the next instruction that is going to be read and executed. This register cannot be accessed directly (it can be modified by jumps though). Also, in x86 an SP (stack pointer) register shows the top of the stack structure (mostly used to hold local variables of functions) and is implicitly modified by push
, pop
, call
, ret
instructions (and interrupts). Of course, there are more examples.
call
is a special kind of jump. You can call one function from anywhere and after executing it you want to go back to where you called it. The solution to this problem is to write down the address of the instruction which has to be executed after the call
. Note that one procedure may call another so that a writing down a single address is not enough. Hence a stack is used.
$\endgroup$
Jan 5, 2013 at 10:24