From patchwork Sun May 24 23:47:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 476034 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4228A1402B4 for ; Mon, 25 May 2015 09:52:29 +1000 (AEST) Received: from localhost ([::1]:41228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ywfgx-0002yx-Gz for incoming@patchwork.ozlabs.org; Sun, 24 May 2015 19:52:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwfcL-000387-FF for qemu-devel@nongnu.org; Sun, 24 May 2015 19:47:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YwfcJ-00080u-9q for qemu-devel@nongnu.org; Sun, 24 May 2015 19:47:41 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:101::1]:40630) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YwfcJ-000809-3j for qemu-devel@nongnu.org; Sun, 24 May 2015 19:47:39 -0400 Received: from weber.rr44.fr ([2001:470:d4ed:0:7e05:7ff:fe0d:f152]) by hall.aurel32.net with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1YwfcG-0006oH-RE; Mon, 25 May 2015 01:47:37 +0200 Received: from aurel32 by weber.rr44.fr with local (Exim 4.85) (envelope-from ) id 1YwfcF-0005tS-TW; Mon, 25 May 2015 01:47:35 +0200 From: Aurelien Jarno To: qemu-devel@nongnu.org Date: Mon, 25 May 2015 01:47:29 +0200 Message-Id: <1432511251-22515-9-git-send-email-aurelien@aurel32.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1432511251-22515-1-git-send-email-aurelien@aurel32.net> References: <1432511251-22515-1-git-send-email-aurelien@aurel32.net> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:bc8:30d7:101::1 Cc: Alexander Graf , Aurelien Jarno , Richard Henderson Subject: [Qemu-devel] [PATCH 08/10] target-s390x: implement STFLE instruction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Cc: Alexander Graf Cc: Richard Henderson Signed-off-by: Aurelien Jarno --- target-s390x/cpu.h | 2 +- target-s390x/helper.h | 1 + target-s390x/insn-data.def | 2 ++ target-s390x/misc_helper.c | 19 +++++++++++++++++++ target-s390x/translate.c | 7 +++++++ 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index 35bfdec..3110c1f 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -174,7 +174,7 @@ static const uint64_t facilities_dw[] = { (0ULL << 59) | /* b 4: IDTE selective clearing when segtab invalidated */ (0ULL << 58) | /* b 5: IDTE selective clearing when regtab invalidated */ (0ULL << 57) | /* b 6: ASN-and-LX-reuse facility */ - (0ULL << 56) | /* b 7: Store-facility-list-extended facility */ + (1ULL << 56) | /* b 7: Store-facility-list-extended facility */ (0ULL << 55) | /* b 8: Enhanced-DAT facility */ (0ULL << 54) | /* b 9: Sense-running-status facility */ (0ULL << 53) | /* b10: Conditional-SSKE facility */ diff --git a/target-s390x/helper.h b/target-s390x/helper.h index e6f2afb..2dc01a0 100644 --- a/target-s390x/helper.h +++ b/target-s390x/helper.h @@ -79,6 +79,7 @@ DEF_HELPER_FLAGS_5(calc_cc, TCG_CALL_NO_RWG_SE, i32, env, i32, i64, i64, i64) DEF_HELPER_FLAGS_2(sfpc, TCG_CALL_NO_RWG, void, env, i64) DEF_HELPER_FLAGS_2(sfas, TCG_CALL_NO_WG, void, env, i64) DEF_HELPER_FLAGS_1(popcnt, TCG_CALL_NO_RWG_SE, i64, i64) +DEF_HELPER_2(stfle, i32, env, i64) #ifndef CONFIG_USER_ONLY DEF_HELPER_3(servc, i32, env, i64, i64) diff --git a/target-s390x/insn-data.def b/target-s390x/insn-data.def index 72c3a2e..fd45730 100644 --- a/target-s390x/insn-data.def +++ b/target-s390x/insn-data.def @@ -827,6 +827,8 @@ /* STORE CPU TIMER */ C(0xb209, STPT, S, Z, la2, 0, new, m1_64, stpt, 0) /* STORE FACILITY LIST */ + C(0xb2b0, STFLE, S, SFLE, 0, a2, 0, 0, stfle, 0) +/* STORE FACILITY LIST */ C(0xb2b1, STFL, S, Z, 0, 0, 0, 0, stfl, 0) /* STORE PREFIX */ C(0xb211, STPX, S, Z, la2, 0, new, m1_32, stpx, 0) diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c index b375ab7..711f365 100644 --- a/target-s390x/misc_helper.c +++ b/target-s390x/misc_helper.c @@ -76,6 +76,25 @@ void HELPER(exception)(CPUS390XState *env, uint32_t excp) cpu_loop_exit(cs); } +/* Store faciliy list extended */ +uint32_t HELPER(stfle)(CPUS390XState *env, uint64_t dest) +{ + int nf = sizeof(facilities_dw) / sizeof(facilities_dw[0]); + int rf = (env->regs[0] & 0xff) + 1; + int i; + + for (i = 0; i < MIN(nf, rf); i++) { + cpu_stq_data(env, dest, facilities_dw[i]); + dest += 8; + } + + if (rf > nf) { + env->regs[0] = (env->regs[0] & ~0xff) | (nf - 1); + } + + return (rf < nf) ? 3 : 0; +} + #ifndef CONFIG_USER_ONLY void program_interrupt(CPUS390XState *env, uint32_t code, int ilen) diff --git a/target-s390x/translate.c b/target-s390x/translate.c index 542da53..78b8cdc 100644 --- a/target-s390x/translate.c +++ b/target-s390x/translate.c @@ -3382,6 +3382,13 @@ static ExitStatus op_stfl(DisasContext *s, DisasOps *o) return NO_EXIT; } +static ExitStatus op_stfle(DisasContext *s, DisasOps *o) +{ + gen_helper_stfle(cc_op, cpu_env, o->in2); + set_cc_static(s); + return NO_EXIT; +} + static ExitStatus op_stpt(DisasContext *s, DisasOps *o) { check_privileged(s);