Received: from eggs.gnu.org ([140.186.70.92]:57825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXaHQ-00049e-4E for qemu-devel@nongnu.org; Fri, 17 Jun 2011 10:44:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXaHI-0002gF-P0 for qemu-devel@nongnu.org; Fri, 17 Jun 2011 10:44:14 -0400 Received: from cantor.suse.de ([195.135.220.2]:42704 helo=mx1.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXaHH-0002fP-Bo for qemu-devel@nongnu.org; Fri, 17 Jun 2011 10:44:07 -0400 From: Alexander Graf Date: Fri, 17 Jun 2011 16:44:01 +0200 Message-Id: <1308321844-11699-7-git-send-email-agraf@suse.de> In-Reply-To: <1308321844-11699-1-git-send-email-agraf@suse.de> References: <1308321844-11699-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH 6/9] PPC: Only set lower 32bits with mtmsr List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "qemu-devel@nongnu.org Developers" Cc: Aurelien Jarno As Nathan pointed out correctly, the mtmsr instruction does not modify the high 32 bits of MSR. It also doesn't matter if SF is set or not, the instruction always behaves the same. This patch moves it a bit closer to the spec. Reported-by: Nathan Whitehorn Signed-off-by: Alexander Graf --- target-ppc/translate.c | 17 ++++++----------- 1 files changed, 6 insertions(+), 11 deletions(-) diff --git a/target-ppc/translate.c b/target-ppc/translate.c index 59aef85..7e318e3 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -3878,24 +3878,19 @@ static void gen_mtmsr(DisasContext *ctx) tcg_gen_or_tl(cpu_msr, cpu_msr, t0); tcg_temp_free(t0); } else { + TCGv msr = tcg_temp_new(); + /* XXX: we need to update nip before the store * if we enter power saving mode, we will exit the loop * directly from ppc_store_msr */ gen_update_nip(ctx, ctx->nip); #if defined(TARGET_PPC64) - if (!ctx->sf_mode) { - TCGv t0 = tcg_temp_new(); - TCGv t1 = tcg_temp_new(); - tcg_gen_andi_tl(t0, cpu_msr, 0xFFFFFFFF00000000ULL); - tcg_gen_ext32u_tl(t1, cpu_gpr[rS(ctx->opcode)]); - tcg_gen_or_tl(t0, t0, t1); - tcg_temp_free(t1); - gen_helper_store_msr(t0); - tcg_temp_free(t0); - } else + tcg_gen_deposit_tl(msr, cpu_msr, cpu_gpr[rS(ctx->opcode)], 0, 32); +#else + tcg_gen_mov_tl(msr, cpu_gpr[rS(ctx->opcode)]); #endif - gen_helper_store_msr(cpu_gpr[rS(ctx->opcode)]); + gen_helper_store_msr(msr); /* Must stop the translation as machine state (may have) changed */ /* Note that mtmsr is not always defined as context-synchronizing */ gen_stop_exception(ctx); -- 1.6.0.2