考虑 c 中的这个函数: long arithEx(long, long, long, long, long, long, long, long);
long main()
{
long a,b,c,d,e,f,g,h,w;
a=100;
b=12345;
c=98765;
d=23;
e=25;
f=27;
g=29;
h=31;
w=arithEx(a,b,c,d,e,f,g,h);
w++;
return w;
}
在 X-86 中,汇编代码如下所示:
main:
subq $24, %rsp
movq $31, 8(%rsp)
movq $29, (%rsp)
movq$27, %r9
movq$25, %r8
movq$23, %rcx
movq$98765, %rdx
movq$12345, %rsi
movq$100, %rdi
call arithEx
addq $1, %rax
addq $24, %rsp
ret
这对我来说很有意义,因为 X-86 和 Y-86 只有 6 个寄存器来接收函数参数。而对于 X-86,由于它支持立即到内存寻址模式,我们可以将其余参数存储到内存中。
但是,对于 Y-86,我们没有可以将立即数移动到内存的指令,那么其余的参数应该去哪里呢?