From patchwork Mon Jan 18 07:12:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 8052971 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A045A9F6FA for ; Mon, 18 Jan 2016 07:17:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CCD8920263 for ; Mon, 18 Jan 2016 07:17:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D0A12025A for ; Mon, 18 Jan 2016 07:17:02 +0000 (UTC) Received: from localhost ([::1]:58023 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL43h-0001hd-BG for patchwork-qemu-devel@patchwork.kernel.org; Mon, 18 Jan 2016 02:17:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL3zw-0003KV-Qc for qemu-devel@nongnu.org; Mon, 18 Jan 2016 02:13:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aL3zv-00076I-Ry for qemu-devel@nongnu.org; Mon, 18 Jan 2016 02:13:08 -0500 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]:35229) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aL3zv-00076C-Io; Mon, 18 Jan 2016 02:13:07 -0500 Received: by mail-pa0-x22c.google.com with SMTP id ho8so168648094pac.2; Sun, 17 Jan 2016 23:13:07 -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 :in-reply-to:references; bh=nZGKhYQOodwKlwRDt+ijnpQA9AuHDiwYHiZbJcgoQsY=; b=ChVId9FInMDg1m1N4tto/031JI9DbTDegTfJIf0QkxQYcU59GyGxlsgMkSP9rnDStH DP4zwnLci6R9hJnKoeNK8Hdn1fpH14rCZUCQTgZVVfWI9FHDt9vaKH4VgmJzAR9mIS+A 3CkIdx+aX8ptw82f1wxkP/vJ6T9TvpbRzoGbUxeavxlPs8+BDhBMjPziMHIXEPMXh22O V1W6/rsETIKF2zY8wW6s08ROTbLysDm5pMhlFyFB7c0mw0KzTf9BppWCld4+yzRaV4vC BD1GFQz4v5TgYhoG1CHodwlmiqnCPvF/gszttK8GEt1DbZ6urGkkicGNBzvFi06vIGnn 7T3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=nZGKhYQOodwKlwRDt+ijnpQA9AuHDiwYHiZbJcgoQsY=; b=dMvDsMNN7YWqcYfQbtZb6zs98c5nCPSRT2J5T1Zj4TOZsTEgQInbLw37DF/fZbhsBU V2cWEb1sm60JZ/nvchLsRj3zDSlngArGI3QaOeku2ZFuw5ElgR/0xcjLethYI0xfGx4H Je/ci2oht+k8nlaVYMpq29d2WmfjwRVUVpBf6ktyhACZ673KZy12cZkkLbUH79G7UI7y nvUZfuIKElE9Q7yFsd3rwgrS70dgfaIMWG7rKgPcKu68lMhxm8YHzWSzP2XHHBkA7E1S OooKdeZciMf+vf9bVtxKNH06irh6pNSa+0IQ57BkdUaQFMdMvz1RZEfUx71PCpy52Tbn Zleg== X-Gm-Message-State: ALoCoQnbNvdKIh3l3Za3hk7s6Fsdnj4oKhvICvl4PWIRyAiOJMA45IDWpAb4CEvJOTM54SBwz+sT14bGLNE0dwUPi6WSPVT5dw== X-Received: by 10.66.102.73 with SMTP id fm9mr34659625pab.32.1453101187038; Sun, 17 Jan 2016 23:13:07 -0800 (PST) Received: from localhost.localdomain (c-73-70-184-119.hsd1.ca.comcast.net. [73.70.184.119]) by smtp.gmail.com with ESMTPSA id xv2sm31471880pab.10.2016.01.17.23.13.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 Jan 2016 23:13:05 -0800 (PST) From: Peter Crosthwaite X-Google-Original-From: Peter Crosthwaite To: qemu-devel@nongnu.org Date: Sun, 17 Jan 2016 23:12:38 -0800 Message-Id: <6e3fea4b53f28ef342d3de7a0668d8d65df9e6e8.1453100525.git.crosthwaite.peter@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::22c Cc: peter.maydell@linaro.org, Peter Crosthwaite , alistair.francis@xilinx.com, sridhar_kulk@yahoo.com, qemu-arm@nongnu.org, pbonzini@redhat.com, piotr.krol@3mdeb.com Subject: [Qemu-devel] [PATCH v1 11/17] linux-user: arm: pass env to get_user_code_* 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paolo Bonzini This matches the idiom used by get_user_data_* later in the series, and will help when bswap_code will be replaced by SCTLR.B. Reviewed-by: Peter Maydell Signed-off-by: Paolo Bonzini Signed-off-by: Peter Crosthwaite --- linux-user/main.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 8348ddc..2157774 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -439,17 +439,17 @@ void cpu_loop(CPUX86State *env) #ifdef TARGET_ARM -#define get_user_code_u32(x, gaddr, doswap) \ +#define get_user_code_u32(x, gaddr, env) \ ({ abi_long __r = get_user_u32((x), (gaddr)); \ - if (!__r && (doswap)) { \ + if (!__r && (env)->bswap_code) { \ (x) = bswap32(x); \ } \ __r; \ }) -#define get_user_code_u16(x, gaddr, doswap) \ +#define get_user_code_u16(x, gaddr, env) \ ({ abi_long __r = get_user_u16((x), (gaddr)); \ - if (!__r && (doswap)) { \ + if (!__r && (env)->bswap_code) { \ (x) = bswap16(x); \ } \ __r; \ @@ -732,7 +732,7 @@ void cpu_loop(CPUARMState *env) /* we handle the FPU emulation here, as Linux */ /* we get the opcode */ /* FIXME - what to do if get_user() fails? */ - get_user_code_u32(opcode, env->regs[15], env->bswap_code); + get_user_code_u32(opcode, env->regs[15], env); rc = EmulateAll(opcode, &ts->fpa, env); if (rc == 0) { /* illegal instruction */ @@ -802,25 +802,23 @@ void cpu_loop(CPUARMState *env) if (trapnr == EXCP_BKPT) { if (env->thumb) { /* FIXME - what to do if get_user() fails? */ - get_user_code_u16(insn, env->regs[15], env->bswap_code); + get_user_code_u16(insn, env->regs[15], env); n = insn & 0xff; env->regs[15] += 2; } else { /* FIXME - what to do if get_user() fails? */ - get_user_code_u32(insn, env->regs[15], env->bswap_code); + get_user_code_u32(insn, env->regs[15], env); n = (insn & 0xf) | ((insn >> 4) & 0xff0); env->regs[15] += 4; } } else { if (env->thumb) { /* FIXME - what to do if get_user() fails? */ - get_user_code_u16(insn, env->regs[15] - 2, - env->bswap_code); + get_user_code_u16(insn, env->regs[15] - 2, env); n = insn & 0xff; } else { /* FIXME - what to do if get_user() fails? */ - get_user_code_u32(insn, env->regs[15] - 4, - env->bswap_code); + get_user_code_u32(insn, env->regs[15] - 4, env); n = insn & 0xffffff; } }