Giter VIP home page Giter VIP logo

Comments (1)

NyxCode avatar NyxCode commented on August 20, 2024

With some help, I was able to figure out what's going on.
This seems to be either a documentation issue or a bug here. The documentation states

Opcodes/opcodes/x86_64.py

Lines 1104 to 1113 in b606dde

class DataOffset:
"""Absolute data offset embedded into instruction encoding.
Only MOV instruction has forms that use direct data offset.
:ivar size: size of the offset in bytes. Possible values are 4 or 8.
:ivar value: value of the offset. Must be a reference to an instruction operand.
The instruction operand has "moffs" type of the matching size.
"""

Either I misunderstood the docs of the size field here, or it's incorrect.
The Intel manual states

The moffs8, moffs16, moffs32, and moffs64 operands specify a simple offset relative to the segment base, where 8, 16, 32, and 64 refer to the size of the data. The address-size attribute of the instruction determines the size of the offset, either 16, 32, or 64 bits.

So on x86-64, the moffs32 offset needs to be 8 bytes, and it's name moffs32 only refers to the size of the data to be MOVed.

Besides that, using a 4byte offset seems possible, but requires an address size override prefix.

So TL;DR: The size field in DataOffset doesn't do what i thought it did.

from opcodes.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.