Code: Select all
int some3( int im_expectin_int ){ return im_expectin_int; }
gcc -m32 -g -ffreestanding -nostdlib -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -nostdinc -fno-builtin -nostartfiles -nodefaultlibs -S -O0 -c file.c -o file.S
Code: Select all
.globl some3
.type some3, @function
some3:
pushl %ebp
movl %esp, %ebp
// Expecting the %edi register to be the standard 1st argument, like always
movl %edi, %eax
// Cleanup
movl %ebp, %esp
popl %ebp
ret
Code: Select all
.globl some3
.type some3, @function
some3:
pushl %ebp
movl %esp, %ebp
// Wait WHAAAAT?
movl 8(%ebp), %eax
popl %ebp
ret
.... edit ....
You know what, now that I think about it ... it kinda makes sense. When doing 64-Bit assembly you have 16 GP registers and in 32-Bit you only have 8 and some are for specific uses. But does anybody know where to find a website that actually documents the the way functions communicate with each other in 32-bit mode?