📄 c-func.s
字号:
# start of the file.include "defines.h" # system call numbers.include "c-func.literals" # include the string literal file .global _start .bss .align 4_data:.text .align 4_start: pushl %ebp # save the ebp address movl %esp, %ebp subl $8, %esp # allocate space for local variables movl $50, -4(%ebp) pushl %eax popl %eax leal -8(%ebp), %eax pushl %eax pushl $50 pushl -4(%ebp) call sum # call function to get result to return pop %edx # release pushed arguments memory after call pop %edx # release pushed arguments memory after call pushl %eax popl %ebx popl %eax movl %ebx, (%eax) pushl (%eax) popl %eax movl -8(%ebp),%eax # get the integer value of the ID call ishow call newline pushl $0 popl %eax # save the return value in eax movl %ebp, %esp popl %ebp # restore the ebp address movl $SYS_exit,%eax # load the exit call number movl $0,%ebx # load the exit code int $0x80 # and exit! # end of the filesum: pushl %ebp # save the ebp address movl %esp, %ebp subl $0, %esp # allocate space for local variables pushl 8(%ebp) pushl 12(%ebp) # arithmetic calculate popl %ebx addl %ebx, (%esp) popl %eax # save the return value in eax movl %ebp, %esp popl %ebp # restore the ebp address ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -