Is the parameters stored on the stack preserved across function calls or volatile in the ABI of intel386 & amd64

Remus Clearwater remus.clearwater@gmail.com
Wed May 30 01:10:00 GMT 2018


Hi,

Is the parameters stored on the stack preserved across function calls or
volatile in the ABI of intel386 & amd64?

I think the answer should be 'volatile' because gcc sometimes did modify
them in the callee but couldn't found any description about it in the
specifications of Sys V ABI intel386 & amd64.

Example:

void* get(void* i){ void**p = &i; *p=(void*)0; return p; }

gcc yields:(elf32-i386)

push   ebp
mov    ebp,esp
sub    esp,0x10
lea    eax,[ebp+0x8]
mov    DWORD PTR [ebp-0x4],eax
mov    eax,DWORD PTR [ebp-0x4]
mov    DWORD PTR [eax],0x0
mov    eax,DWORD PTR [ebp-0x4]
leave
ret

Thanks a lot.



More information about the Gcc-help mailing list