汇编退出

.section .data
.section .text
.global _start
_start:
pushl $5
pushl $4
call fun
addl $8, %esp

pushl %eax
pushl $7
pushl $2
call fun
addl $8, %esp
popl %ebx

addl %eax, %ebx

movl $0, %eax   //注意这一句,函数永远无线循环,改成非0的数就ok
int $0x80
.type fun, @function
fun:
pushl %ebp
movl %esp, %ebp
subl $4, %esp
movl 8(%ebp), %ecx
movl 12(%ebp), %edx
movl %edx, -4(%ebp)
fun_loop:
cmpl $1, %ecx
je end_fun
movl -4(%ebp), %eax
imull %edx, %eax
movl %eax, -4(%ebp)
decl %ecx
jmp fun_loop
end_fun:
movl -4(%ebp), %eax
movl %ebp, %esp
popl %ebp
ret

原文地址:https://www.cnblogs.com/xpylovely/p/11098779.html