Skip to content

Issues uncovered assembling V8-generated code #2

@jseaton

Description

@jseaton

Cool project! However, plugging the first bit of assembly code available to me, namely some V8 code, into it, produced a few issues. V8's output is a bit quirky anyway ("int3" for "int 3"? Huh?), so I'd be interested to see what people think before I go change any code.

mov rcx, [rsp+0x10] compiles to "UN DE FI NE D4 88 BU ND EF IN ED".

The -q suffix on cmp (and possibly others) isn't recognised, e.g. "cmpq rcx, [r13-0x58]". Nasm doesn't recognise this, but it doesn't recognise movq either, which pasm does.

Some instructions fail to compile with "No opcode found for instruction" when a literal value is used, e.g.:
movq rbx,0x11ce96004aa1 (but mov is fine?)
call 0x10e4a6716b00
jnc 24 etc.
I'm not entirely sure of the semantics of the latter two, but nasm appears to accept them.

V8 output uses explicit REX prefixes, e.g. "REX.W movq rcx,[rsp+0x10]" which cause syntax errors. I can't find anything other than V8 that uses these, but again, nasm seems to accept them.

Raw V8 output: https://gist.github.com/jseaton/10981441

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions