给定一个数字,这个程序计算阶乘,但它不再适用于大于 9 的数字
.section .data
.section .text
.globl _start
_start:
pushl $10
movl %eax, %ebx
call func
addl $4, %esp
movl %eax, %ebx
movl $1, %eax
int $0x80
.type func,@function
func:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
cmpl $1, %eax
je fim_loop
decl %eax
pushl %eax
call func
movl 8(%ebp), %ebx
imull %ebx, %eax
fim_loop:
movl %ebp, %esp
popl %ebp
ret
编译运行程序后,回显 $? 应该返回结果,但这是返回 0 而不是正确的结果,有人知道这段代码有什么问题吗?