C函数调用的汇编语言函数基本模板

/*
被调用的函数必须保留EBX、EDI、ESI、EBP和ESP寄存器
*/

 

.section .text
.type func, @function
func:
pushl %ebp
movl %esp, %ebp
subl $
12, %esp
pushl %edi
pushl %esi
pushl %ebx

<function code>

popl %ebx
popl %esi
popl %edi
movl %ebp, %esp
popl %ebp
ret

 

 

posted @ 2010-07-02 16:53  penink  阅读(208)  评论(0)    收藏  举报