Date: Fri, 24 Aug 2001 11:08:05 -0700 From: "David O'Brien" <obrien@freebsd.org> To: Steve Roome <stephen_roome@yahoo.com> Cc: freebsd-hackers@freebsd.org Subject: Re: function calls/rets in assembly Message-ID: <20010824110805.C88259@dragon.nuxi.com> In-Reply-To: <20010824010139.E365@dylan.home>; from stephen_roome@yahoo.com on Fri, Aug 24, 2001 at 01:01:39AM %2B0100 References: <20010824010139.E365@dylan.home>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 24, 2001 at 01:01:39AM +0100, Steve Roome wrote: > How exactly should functions work in assembly, afaict, the > following C : > > void printasint(int p) { printf ("print this %d\n", (int)p);} Why not just ask the compiler?? $ cc -S -O0 printasint.c $ cat printasint.s .file "foo.c" .version "01.01" gcc2_compiled.: .section .rodata .LC0: .byte 0x70,0x72,0x69,0x6e,0x74,0x20,0x74,0x68,0x69,0x73 .byte 0x20,0x25,0x64,0xa,0x0 .text .p2align 2,0x90 .globl printasint .type printasint,@function printasint: pushl %ebp movl %esp,%ebp subl $8,%esp addl $-8,%esp movl 8(%ebp),%eax pushl %eax pushl $.LC0 call printf addl $16,%esp .L2: leave ret .Lfe1: .size printasint,.Lfe1-printasint .ident "GCC: (c) 2.95.3 20010315 (release)" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010824110805.C88259>