summaryrefslogtreecommitdiff
path: root/dynasm
diff options
context:
space:
mode:
authorMike Pall <mike>2011-04-03 20:49:51 +0200
committerMike Pall <mike>2011-04-03 20:49:51 +0200
commit2138df2662795b64065c62c66c867f2a06e780db (patch)
tree88f22b54214c729797ade9e83c114c76697c0237 /dynasm
parent5b06b298a2ddd95b0512c483d78589a84faad4e6 (diff)
downloadluajit2-2138df2662795b64065c62c66c867f2a06e780db.tar.gz
ARM: Fix escaping of opcodes in DynASM.
Diffstat (limited to 'dynasm')
-rw-r--r--dynasm/dasm_arm.lua8
1 files 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()