From 2138df2662795b64065c62c66c867f2a06e780db Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Sun, 3 Apr 2011 20:49:51 +0200 Subject: [PATCH] ARM: Fix escaping of opcodes in DynASM. --- dynasm/dasm_arm.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dynasm/dasm_arm.lua b/dynasm/dasm_arm.lua index 011757c1..780cb29c 100644 --- a/dynasm/dasm_arm.lua +++ b/dynasm/dasm_arm.lua @@ -25,7 +25,7 @@ local assert, setmetatable, rawget = assert, setmetatable, rawget local _s = string local sub, format, byte, char = _s.sub, _s.format, _s.byte, _s.char local match, gmatch, gsub = _s.match, _s.gmatch, _s.gsub -local concat, sort = table.concat, table.sort +local concat, sort, insert = table.concat, table.sort, table.insert -- Inherited tables and callbacks. local g_opt, g_arch @@ -127,6 +127,10 @@ end -- Store word to reserved position. local function wputpos(pos, n) assert(n >= 0 and n <= 0xffffffff and n % 1 == 0, "word out of range") + if n <= 0x000fffff then + insert(actlist, pos+1, n) + n = map_action.ESC * 0x10000 + end actlist[pos] = n end @@ -688,7 +692,7 @@ map_op[".template__"] = function(params, template, nparams) local n = 1 -- Limit number of section buffer positions used by a single dasm_put(). - -- A single opcode needs a maximum of 3 positions (rlwinm). + -- A single opcode needs a maximum of 3 positions. if secpos+3 > maxsecpos then wflush() end local pos = wpos()