From patchwork Tue Feb 19 16:22:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Chouteau X-Patchwork-Id: 221724 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D319A2C0292 for ; Wed, 20 Feb 2013 03:22:55 +1100 (EST) Received: from localhost ([::1]:41519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7py1-0006hR-Fp for incoming@patchwork.ozlabs.org; Tue, 19 Feb 2013 11:22:53 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7pxc-0006Mj-9o for qemu-devel@nongnu.org; Tue, 19 Feb 2013 11:22:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7pxT-0005by-U1 for qemu-devel@nongnu.org; Tue, 19 Feb 2013 11:22:28 -0500 Received: from mel.act-europe.fr ([194.98.77.210]:50649) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7pxT-0005bM-JB for qemu-devel@nongnu.org; Tue, 19 Feb 2013 11:22:19 -0500 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id CCC68290006; Tue, 19 Feb 2013 17:22:18 +0100 (CET) X-Virus-Scanned: amavisd-new at eu.adacore.com Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DksawJ3-Fg6F; Tue, 19 Feb 2013 17:22:18 +0100 (CET) Received: from PomPomGalli.act-europe.fr (pompomgalli.act-europe.fr [10.10.1.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id AD7C229004D; Tue, 19 Feb 2013 17:22:18 +0100 (CET) From: Fabien Chouteau To: qemu-devel@nongnu.org Date: Tue, 19 Feb 2013 17:22:13 +0100 Message-Id: <1361290933-4748-5-git-send-email-chouteau@adacore.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1361290933-4748-1-git-send-email-chouteau@adacore.com> References: <1361290933-4748-1-git-send-email-chouteau@adacore.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 194.98.77.210 Cc: ronald.hecht@gmx.de, blauwirbel@gmail.com, Fabien Chouteau Subject: [Qemu-devel] [PATCH V2 4/4] SPARC LEON power-down support added 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 From: Ronald Hecht Signed-off-by: Fabien Chouteau --- target-sparc/cpu.c | 2 +- target-sparc/cpu.h | 1 + target-sparc/helper.c | 11 +++++++++++ target-sparc/helper.h | 1 + target-sparc/translate.c | 5 +++++ 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c index cc1453e..50def61 100644 --- a/target-sparc/cpu.c +++ b/target-sparc/cpu.c @@ -586,7 +586,7 @@ static const sparc_def_t sparc_defs[] = { .mmu_trcr_mask = 0xffffffff, .nwindows = 8, .features = CPU_DEFAULT_FEATURES | CPU_FEATURE_TA0_SHUTDOWN | - CPU_FEATURE_ASR17 | CPU_FEATURE_CACHE_CTRL, + CPU_FEATURE_ASR17 | CPU_FEATURE_CACHE_CTRL | CPU_FEATURE_POWERDOWN, }, #endif }; diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h index 7389b03..a2f2cc8 100644 --- a/target-sparc/cpu.h +++ b/target-sparc/cpu.h @@ -270,6 +270,7 @@ typedef struct sparc_def_t { #define CPU_FEATURE_TA0_SHUTDOWN (1 << 14) /* Shutdown on "ta 0x0" */ #define CPU_FEATURE_ASR17 (1 << 15) #define CPU_FEATURE_CACHE_CTRL (1 << 16) +#define CPU_FEATURE_POWERDOWN (1 << 17) #ifndef TARGET_SPARC64 #define CPU_DEFAULT_FEATURES (CPU_FEATURE_FLOAT | CPU_FEATURE_SWAP | \ diff --git a/target-sparc/helper.c b/target-sparc/helper.c index 91ecfc7..58e7efe 100644 --- a/target-sparc/helper.c +++ b/target-sparc/helper.c @@ -225,3 +225,14 @@ target_ulong helper_tsubcctv(CPUSPARCState *env, target_ulong src1, cpu_restore_state(env, GETPC()); helper_raise_exception(env, TT_TOVF); } + +#ifndef TARGET_SPARC64 +void helper_power_down(CPUSPARCState *env) +{ + env->halted = 1; + env->exception_index = EXCP_HLT; + env->pc = env->npc; + env->npc = env->pc + 4; + cpu_loop_exit(env); +} +#endif diff --git a/target-sparc/helper.h b/target-sparc/helper.h index cfcdab1..15f7328 100644 --- a/target-sparc/helper.h +++ b/target-sparc/helper.h @@ -4,6 +4,7 @@ DEF_HELPER_1(rett, void, env) DEF_HELPER_2(wrpsr, void, env, tl) DEF_HELPER_1(rdpsr, tl, env) +DEF_HELPER_1(power_down, void, env) #else DEF_HELPER_2(wrpil, void, env, tl) DEF_HELPER_2(wrpstate, void, env, tl) diff --git a/target-sparc/translate.c b/target-sparc/translate.c index ca75e1a..26c2056 100644 --- a/target-sparc/translate.c +++ b/target-sparc/translate.c @@ -3642,6 +3642,11 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn) in the SPARCv8 manual, nop on the microSPARC II */ + if ((rd == 0x13) && (dc->def->features & + CPU_FEATURE_POWERDOWN)) { + /* LEON3 power-down */ + gen_helper_power_down(cpu_env); + } break; #else case 0x2: /* V9 wrccr */