From patchwork Fri Jan 31 19:34:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Musta X-Patchwork-Id: 315820 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 1CC5B2C03AC for ; Sat, 1 Feb 2014 06:35:32 +1100 (EST) Received: from localhost ([::1]:57705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9Js8-0008Oa-TZ for incoming@patchwork.ozlabs.org; Fri, 31 Jan 2014 14:35:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9JrL-0006m9-Bh for qemu-devel@nongnu.org; Fri, 31 Jan 2014 14:34:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W9JrC-0005v6-NL for qemu-devel@nongnu.org; Fri, 31 Jan 2014 14:34:39 -0500 Received: from mail-qa0-x230.google.com ([2607:f8b0:400d:c00::230]:54437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9JrC-0005um-KO; Fri, 31 Jan 2014 14:34:30 -0500 Received: by mail-qa0-f48.google.com with SMTP id f11so6898577qae.35 for ; Fri, 31 Jan 2014 11:34:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wZNu7QpaNIN8vFUdCkyXMToATZw4VVn/ABw3fIz5irs=; b=VrUmvHZaplVZ8xKKetFggt5j6KfS0kZzivVFeJtECFGQVpipg0K+zx1WIBgchbRCIh tUYarJ1j3mDPjMj3L4Vc+6EJlRaEAnQatPGcdrkYz0mMXbW659TE6/PM0LGUwIpCMJs4 i29WIDMut3l3euMpCWvWG+R8678xhM6IvqmsV/uhBDTZAu4zmVqNdrt3xGV5u2j3g0E7 s4jEVLXw+ZIO/Pc2zDZYx5CYo/IkJ4U5iHCuFHWDbjXVu8xFPHtzwbI+R8aS7R2fJRS2 1peHLebG/6OWdnwHDUeQ4BWpEBDNSBYqdhkjpcNStmzqLLnyBuArdE5D5mlL62I1CTND trPQ== X-Received: by 10.224.128.4 with SMTP id i4mr35137884qas.63.1391196870197; Fri, 31 Jan 2014 11:34:30 -0800 (PST) Received: from tmusta-sc.rchland.ibm.com (rchp4.rochester.ibm.com. [129.42.161.36]) by mx.google.com with ESMTPSA id v33sm14756588qgd.10.2014.01.31.11.34.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Jan 2014 11:34:29 -0800 (PST) From: Tom Musta To: qemu-devel@nongnu.org Date: Fri, 31 Jan 2014 13:34:02 -0600 Message-Id: <1391196846-12188-6-git-send-email-tommusta@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1391196846-12188-1-git-send-email-tommusta@gmail.com> References: <1391196846-12188-1-git-send-email-tommusta@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c00::230 Cc: Tom Musta , qemu-ppc@nongnu.org Subject: [Qemu-devel] [V2 PATCH 5/9] target-ppc: Add is_user_mode Utility Routine 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 This patch adds a boolean function is_user_mode that can be re-used in translation code that is sensitive to the MSR[PR] (user-mode) state. Signed-off-by: Tom Musta --- target-ppc/translate.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/target-ppc/translate.c b/target-ppc/translate.c index b89b4ba..6ec4127 100644 --- a/target-ppc/translate.c +++ b/target-ppc/translate.c @@ -622,6 +622,20 @@ static opc_handler_t invalid_handler = { .handler = gen_invalid, }; +#if defined(TARGET_PPC64) +/* NOTE: as this time, the only use of is_user_mode() is in 64 bit code. And */ +/* so the function is wrapped in the standard 64-bit ifdef in order to */ +/* avoid compiler warnings in 32-bit implementations. */ +static bool is_user_mode(DisasContext *ctx) +{ +#if defined(CONFIG_USER_ONLY) + return true; +#else + return ctx->mem_idx == 0; +#endif +} +#endif + /*** Integer comparison ***/ static inline void gen_op_cmp(TCGv arg0, TCGv arg1, int s, int crf)