What happens if i say 'call ' instead of jump? Since there is no return statement written, does control just pass over to the next line below, or is it still returned to the line after the call?
start:
mov $0, %eax
jmp two
one:
mov $1, %eax
two:
cmp %eax, $1
call one
mov $10, %eax
Your intuition is correct: the control just passes to the next line below after the function returns.
In your case, after call one
, your function will jump to mov $1, %eax
and then continue down to cmp %eax, $1
and end up in an infinite loop as you will call one
again.
Beyond just an infinite loop, your function will eventually go beyond its memory constraints since a call
command writes the current rip
(instruction pointer) to the stack. Eventually, you'll overflow the stack.