From patchwork Sun Dec 9 19:37:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10720207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5FB3591E for ; Sun, 9 Dec 2018 19:49:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5427729FAE for ; Sun, 9 Dec 2018 19:49:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48CA629FCB; Sun, 9 Dec 2018 19:49:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id DE73129FAE for ; Sun, 9 Dec 2018 19:49:40 +0000 (UTC) Received: from localhost ([::1]:56447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gW55A-0005Rj-3u for patchwork-qemu-devel@patchwork.kernel.org; Sun, 09 Dec 2018 14:49:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33428) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gW4uF-0001Sy-MQ for qemu-devel@nongnu.org; Sun, 09 Dec 2018 14:38:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gW4uD-0005tT-IQ for qemu-devel@nongnu.org; Sun, 09 Dec 2018 14:38:23 -0500 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:40653) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gW4uD-00054C-5v for qemu-devel@nongnu.org; Sun, 09 Dec 2018 14:38:21 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 29ABDF5F; Sun, 9 Dec 2018 14:38:05 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sun, 09 Dec 2018 14:38:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=6qEwhA3u8u3hxlmvfff20rkcpX+J17DIxydRCi73n6U=; b=w2+H2 PnxuBMoCd+iotmzKjOpTxxXuLORKm/zbQwjDvm34IEkDvIwVfc4LMZohZSocK0sc DeUyp7it2KJk2tX95E0MxPEUHik7JJSk0FLPhH+kw+sfcQfM+D2N5YY4NCCWz7be 57EgfywTy2eVdvzK1l4AoaYfK/nXDPEFKe/NHs= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=6qEwhA3u8u3hxlmvfff20rkcpX+J1 7DIxydRCi73n6U=; b=BL7ubtNvwNf5aD0Y6YzZ47cxDZGPxWi4hnSfHV8LI4ie7 HdBEsDpo39XiJvbLW4y3qzp9SNehd/WLTxks7MqQQAd4S1vk+etbvciYo7X1K2SP 5CnWTrQ+yxpPSpvC3sxSyEp3jfRf9zKM/f0ACOlnaNDqJMG3diTJ6DH+Ax7OFC/E GzIiFpzCteOwl4JHN06ozLaU6YfBVvBn/nrUb57Mz1ZB3VtQezXJ50JZinh6/SO0 kmJdMYT+etQhvAP6wOmWXflWu2O0jAz0et7hC6R9CW9ys0StolZWIj9fPHR3U5Wm alSJWRk+gW5p9dP1oBERxCqQgwjI7CLD1U75+W8Yw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtkedrudegfedguddvkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecu fedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkf fojghfsedttdertdertddtnecuhfhrohhmpedfgfhmihhlihhoucfirdcuvehothgrfdcu oegtohhtrgessghrrggrphdrohhrgheqnecukfhppeduvdekrdehledrvddtrddvudeine curfgrrhgrmhepmhgrihhlfhhrohhmpegtohhtrgessghrrggrphdrohhrghenucevlhhu shhtvghrufhiiigvpeej X-ME-Proxy: Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 895EC102ED; Sun, 9 Dec 2018 14:38:04 -0500 (EST) From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Sun, 9 Dec 2018 14:37:32 -0500 Message-Id: <20181209193749.12277-22-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181209193749.12277-1-cota@braap.org> References: <20181209193749.12277-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.25 Subject: [Qemu-devel] [RFC v2 21/38] translator: add translator_ld{ub, sw, uw, l, q} X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , Pavel Dovgalyuk Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Suggested-by: Richard Henderson Signed-off-by: Emilio G. Cota --- include/exec/translator.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/exec/translator.h b/include/exec/translator.h index 71e7b2c347..39f6f514a7 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -19,7 +19,10 @@ */ +#include "qemu/bswap.h" #include "exec/exec-all.h" +#include "exec/cpu_ldst.h" +#include "exec/plugin-gen.h" #include "tcg/tcg.h" @@ -141,4 +144,29 @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, void translator_loop_temp_check(DisasContextBase *db); +#define GEN_TRANSLATOR_LD(fullname, name, type, swap_fn) \ + static inline type \ + fullname ## _swap(CPUArchState *env, abi_ptr pc, bool do_swap) \ + { \ + type ret = cpu_ ## name ## _code(env, pc); \ + \ + if (do_swap) { \ + ret = swap_fn(ret); \ + } \ + plugin_insn_append(&ret, sizeof(ret)); \ + return ret; \ + } \ + \ + static inline type fullname(CPUArchState *env, abi_ptr pc) \ + { \ + return fullname ## _swap(env, pc, false); \ + } + +GEN_TRANSLATOR_LD(translator_ldub, ldub, uint8_t, /* no swap needed */) +GEN_TRANSLATOR_LD(translator_ldsw, ldsw, int16_t, bswap16) +GEN_TRANSLATOR_LD(translator_lduw, lduw, uint16_t, bswap16) +GEN_TRANSLATOR_LD(translator_ldl, ldl, uint32_t, bswap32) +GEN_TRANSLATOR_LD(translator_ldq, ldq, uint64_t, bswap64) +#undef GEN_TRANSLATOR_LD + #endif /* EXEC__TRANSLATOR_H */