Browse Source

DynASM: x86/x64: Fix vreg in opcode. x64: Fix imm "I" after abs addr.

Mike Pall 14 years ago
parent
commit
7ff8409797
1 changed files with 3 additions and 2 deletions
  1. 3 2
      dynasm/dasm_x86.lua

+ 3 - 2
dynasm/dasm_x86.lua

@@ -525,12 +525,13 @@ local function wputmrmsib(t, imark, s, vsreg)
       -- Pure 32 bit displacement.
       -- Pure 32 bit displacement.
       if x64 and tdisp ~= "table" then
       if x64 and tdisp ~= "table" then
 	wputmodrm(0, s, 4) -- [disp] -> (0, s, esp) (0, esp, ebp)
 	wputmodrm(0, s, 4) -- [disp] -> (0, s, esp) (0, esp, ebp)
+	if imark == "I" then waction("MARK") end
 	wputmodrm(0, 4, 5)
 	wputmodrm(0, 4, 5)
       else
       else
 	riprel = x64
 	riprel = x64
 	wputmodrm(0, s, 5) -- [disp|rip-label] -> (0, s, ebp)
 	wputmodrm(0, s, 5) -- [disp|rip-label] -> (0, s, ebp)
+	if imark == "I" then waction("MARK") end
       end
       end
-      if imark == "I" then waction("MARK") end
       if vsreg then waction("VREG", vsreg); wputxb(2) end
       if vsreg then waction("VREG", vsreg); wputxb(2) end
     end
     end
     if riprel then -- Emit rip-relative displacement.
     if riprel then -- Emit rip-relative displacement.
@@ -1521,7 +1522,7 @@ local function dopattern(pat, args, sz, op, needrex)
 	if szov == "q" and rex == 0 then rex = rex + 8 end
 	if szov == "q" and rex == 0 then rex = rex + 8 end
 	if needrex then rex = rex + 16 end
 	if needrex then rex = rex + 16 end
 	if addin and addin.reg == -1 then
 	if addin and addin.reg == -1 then
-	  wputop(szov, opcode + 1, rex)
+	  wputop(szov, opcode - 7, rex)
 	  waction("VREG", addin.vreg); wputxb(0)
 	  waction("VREG", addin.vreg); wputxb(0)
 	else
 	else
 	  if addin and addin.reg > 7 then rex = rex + 1 end
 	  if addin and addin.reg > 7 then rex = rex + 1 end