So, I am a noob in assembly language and machine instructions.

When the discussion came up as to how funtion calls are implemented at the processor level, someone said that the CALL instruction pushes the address of the next instruction to be executed on the stack before updating the EIP and then someone asked how do we know the address of the next instruction.

And then someone asked while EIP points to the current instruction in memory how does the processor know how many bytes from EIP need to be read so that the whole instruction is read.

I assumed that all instructions are fixed length so the processor would read those many bytes as would constitute the instruction and then the decoding process would determine how many more bytes need to be read to fetch the operands. However when searching about the instructions I came to know that the instruction sizes vary.

So we are back to the same question: How does the processor know the number of bytes to read to get the instruction from memory to the instruction cache?

  • the hardware knows every instruction and places the correct value on the stack for architectures that work that way, others may place the return value in a register.
    – old_timer
    Commented Feb 20, 2014 at 20:45

1 Answer 1


In most CPUs, the next-instruction-pointer is updated as the first part of executing the instruction. The CPU, of course, can determine the length of the instruction from its opcode and/or modifier bits. Every architecture has a different way of indicating this, but it is always well defined.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.