In one of my class examples, a function that takes in int parameter integer begins like:
recursive_sum:
push ebp
mov ebp, esp ;set EBP=ESP
pusha ;save all registers(probably overkill)
mov ebx, [ebp+8] ;ebx=integer(parameter #1)
But in a different class example, a function that takes in int parameter num begins like:
f:
enter 8,0 ;num in [ebp+8] ,local var x, sum in [ebp-4],[ebp-8]
push ebx
push ecx
push edx
mov eax, [ebp+8] ;eax=num
In what case would one need the mov ebp, esp
instruction? Please explain in terms of C, java, or through an example. And I am not looking for a basic definition of the ESP register