Given a number, this program computes the factorial, but it no long works with number bigger than 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
after compile and run the program, echo $? should return the result, but this is returning 0 instead of the right result, do anyone know what's wrong with this code?