From 3ef1f2153162402fc6abb3bf147a1abdcbcf9730 Mon Sep 17 00:00:00 2001 From: Michael Munday Date: Tue, 13 Dec 2016 11:26:53 -0500 Subject: [PATCH] Add support for SIL instructions in DynASM. --- dynasm/Examples/test_z_inst.c | 19 ++++++++++++++++++- dynasm/dasm_s390x.lua | 10 ++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/dynasm/Examples/test_z_inst.c b/dynasm/Examples/test_z_inst.c index d0939064..c09ae083 100644 --- a/dynasm/Examples/test_z_inst.c +++ b/dynasm/Examples/test_z_inst.c @@ -308,6 +308,22 @@ static void type(dasm_State *state) { | br r14 } +static void sil(dasm_State *state) { + dasm_State **Dst = &state; + + | lay sp, -16(sp) + | xc 0(16, sp), 0(sp) + | mvghi 0(sp), 5 + | mvhi 8(sp), 7 + | mvhhi 12(sp), 11 + | lghi r2, 0 + | ag r2, 0(sp) // r2 += 5 + | a r2, 8(sp) // r2 += 7 + | ah r2, 12(sp) // r2 += 11 + | la sp, 16(sp) + | br r14 +} + typedef struct { int64_t arg1; int64_t arg2; @@ -335,7 +351,8 @@ test_table test[] = { // { 2,4, load_test, 4,"load_test"}, {-1, 0, ssa, 65535<<8, "ssa"}, {-1, 0, ssa_act, 65535<<8, "ssa_act"}, - {27, 0, type, 27, "type"} + {27, 0, type, 27, "type"}, + { 0, 0, sil, 23, "sil"} }; static void *jitcode(dasm_State **state, size_t *size) diff --git a/dynasm/dasm_s390x.lua b/dynasm/dasm_s390x.lua index 60d61bd7..e3c8f263 100644 --- a/dynasm/dasm_s390x.lua +++ b/dynasm/dasm_s390x.lua @@ -971,6 +971,9 @@ map_op = { msfi_2 = "c20100000000n", msgfi_2 = "c20000000000n", maer_3 = "0000b32e0000r", + mvhhi_2 = "e54400000000SIL", + mvhi_2 = "e54c00000000SIL", + mvghi_2 = "e54800000000SIL", o_2 = "000056000000j", or_2 = "000000001600g", oy_2 = "e30000000056l", @@ -1219,6 +1222,13 @@ local function parse_template(params, template, nparams, pos) if d1a then d1a() end wputhw(op2) if d2a then d2a() end + elseif p == "SIL" then + wputhw(op0) + local d, b, a = parse_mem_b(params[1]) + op1 = op1 + shl(b, 12) + d + wputhw(op1) + if a then a() end + parse_imm16(params[2]) elseif p == "w" then local mode, n, s = parse_label(params[1]) wputhw(op1)