|
/* C 的过程函数 */
u16_t add(u16_t a, u16_t b){
return a+b;
}
/* gas 汇编的代码 */
.text
.align 2
.globl _add
.def _add;
.scl 2;
.type 32;
.endef
_add:
pushl %ebp
movl %esp, %ebp
subl $4, %esp ; 这句有什么作用?不解?!
movl 8(%ebp), %eax ; 为什么第一个参数a在SP+8的位置?!
movl 12(%ebp), %edx
movw %ax, -2(%ebp)
movw %dx, -4(%ebp)
movl -4(%ebp), %eax
addw -2(%ebp), %ax
andl $65535, %eax
leave ; 这句什么意思?
ret
请熟悉的大侠给讲解,小弟先谢谢了! |
|