【问题标题】:Which is the illegal instruction?哪个是非法指令?
【发布时间】:2013-11-25 12:18:29
【问题描述】:

嗯,我完全从第 17 页复制了这段代码 http://www.tutorialspoint.com/assembly_programming/assembly_tutorial.pdf 但是当我用 NASM 编译它时(在 Windows 上,即使在 pdf 中他们使用 linux) 使用命令nasm -f elf test.asm -o test.com,然后运行它会向我吐出这个:

16 位 MS-DOS 子系统 dir NTVDM CPU 遇到非法指令。 CS:0000 IP:0077 OP:fo 37 05 0a 02 选择“关闭”以终止应用程序。

dir 是我编译和运行程序的位置(nasm 目录)。我希望我不会因此而自欺欺人,但这确实让我感到困惑。 提前谢谢!

【问题讨论】:

    标签: assembly x86 64-bit nasm


    【解决方案1】:
    int 0x80 ;call kernel
    

    您在 Windows 上 - 甚至在 dos 上。您在本指令中使用的地址 (0x80) 是特定于 Linux/Unix 的。

    http://en.wikipedia.org/wiki/INT_(x86_instruction)

    【讨论】:

    • 实际上是在 DOS 上。其基于中断的 API 已被广泛记录;只需找到一个或多或少与您尝试执行的任何系统调用匹配的系统即可。
    猜你喜欢
    • 1970-01-01
    • 2021-07-07
    • 2019-01-20
    • 2021-02-01
    • 2020-12-20
    • 2013-04-05
    • 2021-06-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多