I just started to study assembly at school, and we begin to plunge into registers and how to use them. The point I cannot understand is how the instruction pointer gets the address of the next instruction? For example, enter the following code:
nop
pushl %ebp
movl %esp, %ebp
subl $4, %esp
In the previous code, the instruction pointer is incremented after each line, and I would like to know how he knows, what team do next (eg mov, sub, push, ... etc ..)? All the previous instructions are first loaded into RAM at the first start of the program, and the address of the first command ( nopin this case) is automatically loaded into eip, and then just iterates over them one by one? Or am I missing something?
Any help is appreciated.
source
share