From f0dd40dc50b626bf58acdba70b65572c11485dce Mon Sep 17 00:00:00 2001 From: niravthakkar Date: Fri, 2 Dec 2016 17:37:20 +0530 Subject: [PATCH] Adding support for Immediate add mode The masking in immediate mode might not be proper. I could understand that you had masked 12bits and then 8bits to get the displacement in place for 20-bit displacement ( cp[-2] |= n&0xfff; cp[-1] |= (n>>4)&0xff00;) But in my case I need all the 32bits, so not sure how to go about it. Currently I have just used "n" since no point in "and with 0xffff" But I am getting core dump. Please Let me know your comments on these. --- dynasm/dasm_s390x.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dynasm/dasm_s390x.h b/dynasm/dasm_s390x.h index 66dfd79a..6314ff80 100644 --- a/dynasm/dasm_s390x.h +++ b/dynasm/dasm_s390x.h @@ -233,7 +233,10 @@ void dasm_put(Dst_DECL, int start, ...) break; case DASM_IMM16: case DASM_IMM32: - fprintf(stderr, "not implemented\n"); + CK((n>>32) == 0, RANGE_I); + b[pos++]=n; + break; + //fprintf(stderr, "not implemented\n"); case DASM_DISP20: CK(-(1<<19) <= n && n < (1<<19), RANGE_I); b[pos++] = n; @@ -368,7 +371,9 @@ int dasm_encode(Dst_DECL, void *buffer) case DASM_LABEL_PC: break; case DASM_IMM16: case DASM_IMM32: - fprintf(stderr, "not implemented\n"); + //pintf(stderr, "not implemented\n"); + cp[-1] |= n + cp[-2] |= n break; case DASM_DISP20: cp[-2] |= n&0xfff;