有什么不对的x86-64的这句话? [英] What's wrong with this statement on x86-64?
本文介绍了有什么不对的x86-64的这句话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此功能的目的是获得堆栈的开始地址:
无符号长find_start(无效){
__asm __(MOVQ%RSP,%eax中);
}
当我编译它,得到一个错误:
错误:后缀或`MOVQ无效操作数
解决方案
MOVQ
是预计的64位操作数的指令。 RSP
是一个64位寄存器,而 EAX
是一个32位的寄存器。
也许尝试 RAX
?
This function aims to get the start address of the stack:
unsigned long find_start(void){
__asm__("movq %rsp, %eax");
}
When I compile it,getting an error:
Error: suffix or operands invalid for `movq'
解决方案
movq
is an instruction that expects 64-bit operands. rsp
is a 64-bit register, while eax
is a 32-bit register.
Perhaps try rax
?
这篇关于有什么不对的x86-64的这句话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文