## ============================================================ ## hello.s ## Fundamentals ## Calling Functions Using the C Calling Conventions ## ============================================================ ## ============================================================ .section ".rodata" ## ============================================================ pcGreeting: .asciz "Hello\n" ## ============================================================ .section ".data" ## ============================================================ ## ============================================================ .section ".bss" ## ============================================================ ## ============================================================ .section ".text" ## ============================================================ ## ------------------------------------------------------------ ## int main(int argc, char *argv[]) ## ## Write "Hello\n" to stdout. ## ## Formal parameter offsets: .equ ARGC, 8 .equ ARGV, 12 ## ------------------------------------------------------------ .globl main .type main,@function main: pushl %ebp movl %esp, %ebp ## printf("Hello\n"); pushl $pcGreeting call printf addl $4, %esp ## return 0; movl $0, %eax movl %ebp, %esp popl %ebp ret