【发布时间】:2012-06-12 18:47:20
【问题描述】:
我正在使用 NASM following this tutorial(第 4 节)开发一个更深入的 hello world。本教程主要教您如何处理命令行输入。
这是相关代码的sn-p:
section .text
global _start
_start:
pop ebx ; arg count
pop ebx ; arg[0] the program name
pop ebx ; arg[1-n] the remainder of the args
; must each be indiviually popped
error: instruction not supported in 64-bit mode 在编译过程中出现代码错误,参考上面的 3 条弹出指令。 Upon viewing the docs 看来此代码仅适用于 32 位系统。
是否有 64 位 pop 指令?有人有使用pop 的 64 位教程吗?
【问题讨论】:
-
您知道本教程是针对 32 位的吗?我相信您可以通过将输出格式设置为
elf32而不是elf来生成 32 位代码,这应该让您即使在 64 位机器上也可以遵循本教程... -
@Aedin - 是的,如果遵循该教程,您应该保持 32 位模式。使用 64 位时不仅寄存器名称不同,调用约定也不同。仅替换
pop不太可能奏效。
标签: assembly x86-64 nasm 32bit-64bit