【问题标题】:Why doesn't YASM doesn't recognize the keyword "offset"?为什么 YASM 不能识别关键字“offset”?
【发布时间】:2012-01-26 23:05:51
【问题描述】:

我正在尝试编译Heaven's Gate:

yasm-1.2.0-win64.exe "Heaven's Gate.asm"

使用下面的代码:

global main
section .text
main:
    bits 32
        db      9ah ;call 33:in64
        dd      offset in64
        dw      33h
        ;32-bit code continues here

    bits 64
    in64:
        gs mov rax, qword [30h] ;gs not fs
        mov rax, qword [rax+60h]
        mov rax, qword [rax+18h]
        mov rax, qword [rax+30h]
        mov rax, qword [rax+10h]

    bits 32
        retf

但 YASM 告诉我:

Heaven's Gate.asm:6: error: undefined symbol `offset' (first use)  
Heaven's Gate.asm:6: error:  (Each undefined symbol is reported only once.)

offset 不是关键字吗?为什么会出现此错误?

【问题讨论】:

    标签: assembly nasm wow64 yasm


    【解决方案1】:

    offset 在 yasm/nasm 语法中是多余的。删除它们,因为标签本身代表它的偏移量。

    【讨论】:

    • 至于为什么他们在一个明确针对 yasm 的示例中有偏移,我不知道。早期版本中可能已经支持 masm 语法。
    • 可能,是的。 dword ptr 等也存在错误,删除 ptr 也解决了这个问题。
    猜你喜欢
    • 1970-01-01
    • 2014-11-02
    • 1970-01-01
    • 1970-01-01
    • 2013-06-22
    • 1970-01-01
    • 1970-01-01
    • 2014-10-28
    • 2011-07-25
    相关资源
    最近更新 更多