GNU汇编程序(Mac OS X的64位):非法指令:4 [英] GNU Assembler (Mac OS X 64-bit): Illegal instruction: 4
本文介绍了GNU汇编程序(Mac OS X的64位):非法指令:4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新来的GNU汇编器,我试图执行这块code:
I am new to GNU Assembler and I'm trying to execute this piece of code:
.globl _main
_main:
movl $1, %eax
movl $0, %ebx
int $0x80
这PROGRAMM应该由系统调用exit退出( 1
)。编译它(无警告):
This programm should exit by the system call exit (1
). Compiled it (no warnings):
gcc test.s
但运行它给我的错误:非法指令:4
感谢您的帮助!
推荐答案
如果你正在编译64位可执行文件,那么你应该这样写:
If you're compiling a 64-bit executable, then you should write something like this:
movq $0x2000001, %rax
movq $0, %rdi
syscall
来源。
这篇关于GNU汇编程序(Mac OS X的64位):非法指令:4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文