site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Hi folks, .text .globl _addNumbers _addNumbers: pushl %ebp movl %esp, %ebp subl $8, %esp ### HERE movl 12(%ebp), %eax addl 8(%ebp), %eax leave ret .globl _main _main: pushl %ebp movl %esp, %ebp subl $40, %esp ### HERE movl $7, 4(%esp) movl $5, (%esp) call _addNumbers movl %eax, -12(%ebp) movl -12(%ebp), %eax leave ret .subsections_via_symbols Cheers, -- M. Uli Kusterer http://www.zathras.de _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... I'm trying to learn Intel assembler for OS X, and since I couldn't find any Mac tutorials and the calling conventions appear rather different, I've tried learning by dissecting code generated using gcc -S simle_c_program.c ... I mostly understand the output, but I'd be very grateful if one of you could help me by explaining why the marked spots below move the stack pointer by that much? I would have expected that to be maybe 8 bytes for the parameters, and since the stack according to all docs I could find is 4-byte aligned, that would be 8. Instead it's 40. Does anyone know a bare- bones-beginner tutorial that is written in a way that I can actually follow along on my Intel Mac? I know 68000 assembler, but Intel assembler is completely new territory for me. This email sent to site_archiver@lists.apple.com
participants (1)
-
Uli Kusterer