Search code examples
cassemblydecompiling

understanding decompiling assembly code


I have the following code that I was to decompile:

movl $0x2feaf, -0x18(%ebp)
mov  0x8(%ebp), %eax
mov  %eax, -0x14(%ebp)

my problem is, I don't understand what 0x8(%ebp) means in the context. I tried the following c code:

int b = 196271;
int a = b;

but that gives me

movl $0x2feaf, -0x8(%ebp)
mov  -0x8(%ebp), $eax
mov  %eax, -0x4(%ebp)

what does 0x8(%ebp) mean? Thanks!


Solution

  • It means move whatever is at [EBP+8] into the EAX register.

    In most contexts, [EBP+8] will be a parameter to the current function.