Giter VIP home page Giter VIP logo

Comments (2)

langston-barrett avatar langston-barrett commented on July 26, 2024

Note to self:

FWIW, all of these variants also fail:

                    , ("mov %rdi,0x601000", ["mov %rdi,0x601000"])
                    , ("mov %rsi,0x601000", ["mov %rsi,0x601000"])
                    , ("mov %rdi,0x501000", ["mov %rdi,0x501000"])
                    , ("mov %edi,0x501000", ["mov %edi,0x501000"])
                    , ("mov %rdi,0x401000", ["mov %rdi,0x401000"])

Using #22, we see:

mov %rdi,0x601000: FAIL (0.01s)

  AssembledInstruction 
    { legacyPrefixes = ""
    , assembledRequiredPrefix = ""
    , rexPrefix = "H"
    , opcode = "\137"
    , modRmSibDisp = Just (AssembledModRmSibDisp {modRm = "=", sib = Just "", disp = Just "\NUL\DLE`\NUL"})
    , immediates = ["",""]
    }

  tests/Roundtrip.hs:309:
  Assembled bytes:
  Length: 7 (0x7) bytes
  0000:   48 89 3d 00  10 60 00                                H.=..`.

  Original bytes:
  Length: 8 (0x8) bytes
  0000:   48 89 3c 25  00 10 60 00                             H.<%..`.

  Instruction instances:
  [ II { iiLockPrefix = NoLockPrefix, iiAddrSize = Size64
       , iiOp = "mov"
       , iiArgs = 
           [ ( Mem64 (Addr_64 ds Nothing Nothing (Disp32 0x601000))
             , OpType ModRM_rm VSize
             ) 
           , (QWordReg rdi
             , OpType ModRM_reg VSize 
             )
           ]
       , iiPrefixes = 
           Prefixes {_prLockPrefix = NoLockPrefix, _prSP = SegmentPrefix {unwrapSegmentPrefix = 0}, _prREX = 0b01001000, _prVEX = Nothing, _prASO = False, _prOSO = False}
       , iiRequiredPrefix = Nothing
       , iiOpcode = [137]
       , iiRequiredMod = Nothing
       , iiRequiredReg = Nothing
       , iiRequiredRM = Nothing 
       }
  ]

  expected: "H\137<%\NUL\DLE`\NUL"
   but got: "H\137=\NUL\DLE`\NUL"

From the ASCII table:

  • =: 3d
  • <%: 3c 25

from flexdis86.

langston-barrett avatar langston-barrett commented on July 26, 2024

XED says that:

  • The number of legacy prefixes is zero
  • The Mod/RM byte should be 3c. Flexdis is messing this up.
  • The displacement is 0x601000
  • The scale is 1 (represented by b00 in the SIB byte)

The Mod/RM byte in the original is 0x3c, or in binary:

00 111 100

The SIB byte in the original is 0x25, or in binary:

00 100 101

In summary, I think I've narrowed it down to improper encoding of the RM part of the Mod/RM byte, and the lack of the SIB byte.

from flexdis86.

Related Issues (16)

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.