printf 寄存器

在汇编代码中使用 call printf的时候,一定要先将寄存器push到堆栈中,否则printf会改变各寄存器的值。

 12 loop1:
 13         pushl   %eax
 14         pushl   %ecx
 15
 16         addl    $4,     %ebx
 17         pushl   (%ebx)
 18         pushl   %eax
 19         pushl   $output
 20         call    printf
 21         addl    $12,    %esp
 22
 23         popl    %ecx
 24         popl    %eax
 25         addl    $1,     %eax
 26         loop    loop1

posted @ 2010-12-26 16:25  CuiXS  阅读(424)  评论(0编辑  收藏  举报