From b9651b4ba2a7a76d722acbb4e13d29866d517868 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Mon, 23 Jan 2012 19:06:58 +0100 Subject: [PATCH] MIPS: Add missing opcodes to the DynASM MIPS module plus minor fixes. Allow single dot as macro name. --- dynasm/dasm_mips.lua | 17 ++++++++++++++--- dynasm/dynasm.lua | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/dynasm/dasm_mips.lua b/dynasm/dasm_mips.lua index 5cbae8ba..d8ce3b0c 100644 --- a/dynasm/dasm_mips.lua +++ b/dynasm/dasm_mips.lua @@ -11,7 +11,7 @@ local _info = { description = "DynASM MIPS module", version = "1.3.0", vernum = 10300, - release = "2011-12-16", + release = "2012-01-23", author = "Mike Pall", license = "MIT", } @@ -278,7 +278,9 @@ local map_op = { -- Opcode SPECIAL. nop_0 = "00000000", sll_3 = "00000000DTA", + movf_2 = "00000001DS", movf_3 = "00000001DSC", + movt_2 = "00010001DS", movt_3 = "00010001DSC", srl_3 = "00000002DTA", rotr_3 = "00200002DTA", @@ -309,10 +311,12 @@ local map_op = { move_2 = "00000021DS", addu_3 = "00000021DST", sub_3 = "00000022DST", + negu_2 = "00000023DT", subu_3 = "00000023DST", and_3 = "00000024DST", or_3 = "00000025DST", xor_3 = "00000026DST", + not_2 = "00000027DS", nor_3 = "00000027DST", slt_3 = "0000002aDST", sltu_3 = "0000002bDST", @@ -341,6 +345,7 @@ local map_op = { teqi_2 = "040c0000SI", tnei_2 = "040e0000SI", bltzal_2 = "04100000SB", + bal_1 = "04110000B", bgezal_2 = "04110000SB", bltzall_2 = "04120000SB", bgezall_2 = "04130000SB", @@ -659,8 +664,14 @@ end local function parse_disp(disp) local imm, reg = match(disp, "^(.*)%(([%w_:]+)%)$") if imm then - local r = parse_gpr(reg) - return r*2^21 + parse_imm(imm, 16, 0, 0, true) + local r = parse_gpr(reg)*2^21 + local extname = match(imm, "^extern%s+(%S+)$") + if extname then + waction("REL_EXT", map_extern[extname], nil, 1) + return r + else + return r + parse_imm(imm, 16, 0, 0, true) + end end local reg, tailr = match(disp, "^([%w_:]+)%s*(.*)$") if reg and tailr ~= "" then diff --git a/dynasm/dynasm.lua b/dynasm/dynasm.lua index 8ff98513..34974c06 100644 --- a/dynasm/dynasm.lua +++ b/dynasm/dynasm.lua @@ -390,7 +390,7 @@ map_coreop[".macro_*"] = function(mparams) -- Split off and validate macro name. local name = remove(mparams, 1) if not name then werror("missing macro name") end - if not (match(name, "^[%a_][%w_%.]*$") or match(name, "^%.[%w_%.]+$")) then + if not (match(name, "^[%a_][%w_%.]*$") or match(name, "^%.[%w_%.]*$")) then wfatal("bad macro name `"..name.."'") end -- Validate macro parameter names. -- 2.11.4.GIT