From patchwork Thu Dec 12 04:00:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 181414 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp388436ile; Wed, 11 Dec 2019 20:04:12 -0800 (PST) X-Google-Smtp-Source: APXvYqyi/sxa374ybIwKz1ljcQG3syEw1O8G37TDOt/q16ccfDrotnwhCPBjFHoHG5u1XgIYR1JE X-Received: by 2002:a05:620a:139b:: with SMTP id k27mr6267224qki.112.1576123452073; Wed, 11 Dec 2019 20:04:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576123452; cv=none; d=google.com; s=arc-20160816; b=qT6eLucvHl5pTRQnTQtdvQLM/Z6+tm50aYqrwqN/w9jyQKY93pBFyiMtbXIhs9ofHJ svvkx++blpDqivWX92BYASG2aXnCelCFvGMsg4mCYIjMEa4yuTbom0vogFx3EOCTaQtf gBEOVXLe6Q+PqzcMzjKhhtwiK24UP0e5znKYfbLha8AC6qmj9Mg1Jz/TeqHumbBMKTX8 mmrWd/9ZXk6FAasKGKbwvtjktIHq9Jaq4X4w3sxe6RnaQdwm+j+5LzpfJe/7bE5Sh3a1 jCV1dsPy5jBBSY9SlKpH482OXj7N8IXso4racpY2kPzRwME8PcNwtxJowgdBn9v/PPzF 3qtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=LZjfj7f7LiMXr9N5B8njH/lhRDK1JnIrdikl5tdqwbU=; b=OX7dHFuG/VRse2FjK9SavoFUAJ57/4ZygwNtQDtS2CO3QtbDo9+IRZfIJZx+ej3n9D maDrM9JBTix9aGMVmIn83QTODbaYWmuRZhN2QupnsjhlDQ0pIP7Byy6CEnSLaXUcEMJF zN8rawwBFwNslBHOgfm6aaLw+kq9FHSvi7v1z05+CF08k9QGjRAKw9eo42ZHQNNmLCpO QSbvn8kP2UoSJYeGSOUBmip2Y5SidPj94eF9lb4cNiEwSUKgwxxOkBOwCXpJNwhRDt0+ VPXwWoyERMjaM4a3KI1V6qcYXPgb1O1U9hPO/WQ1yOi4l8NqJ6TweGN7kqickYJDmAl1 VSQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VX6mewHW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 51si2280358qvx.178.2019.12.11.20.04.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Dec 2019 20:04:12 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VX6mewHW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifFhz-0004HZ-27 for patch@linaro.org; Wed, 11 Dec 2019 23:04:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48334) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifFes-0000rA-46 for qemu-devel@nongnu.org; Wed, 11 Dec 2019 23:01:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifFen-00040r-4h for qemu-devel@nongnu.org; Wed, 11 Dec 2019 23:00:57 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:38060) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifFem-0003xX-PP for qemu-devel@nongnu.org; Wed, 11 Dec 2019 23:00:52 -0500 Received: by mail-pl1-x643.google.com with SMTP id a17so4323pls.5 for ; Wed, 11 Dec 2019 20:00:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=LZjfj7f7LiMXr9N5B8njH/lhRDK1JnIrdikl5tdqwbU=; b=VX6mewHWiQ+T5WY3kNKKgSDBBd5rV7W9C+ZillY6GIArd8uCuYL7ELeu5O5n+gs8TS hrk6g4Ilb3VuT2mTBuuviIGJ0gImpz0qSg/8bdjrwaC7j/cWBqnrOwS60iQ0ddO5eKS5 zFfHNsHn2Zpw5KGCZZgaV9cVHzVSXdqEXzRIN55q1JB2JaY1wz9ZdZ2gm0TklZbciFoC 7kxKpB4YlWpCJJZW9OznNMwB4hK4S1uk64yyuQKUrT63ditxyuwjc6Si1b+VTwI88pjx jqRMzlxfke/hlbGv3xKSn7QGNKZipRvwuYsNANkFGwo+ghpa0uxOvt1mQu3rS5eRR3Hd e+Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LZjfj7f7LiMXr9N5B8njH/lhRDK1JnIrdikl5tdqwbU=; b=Cz/oRXmYqoLRDOy5pFpTmhJyvFER9oghv75PtqA45iU52/yQzyhpg+wkOv29e7C3rQ eojIkb3qLSSNMrO2WJ8IJNyRBsmjPnPz7Rea9Wo/QZfYsf5iyIZ+y7v8dShXET5oS/90 OfOLHmQkDikksFQ1jtG4LJLB179j+y1SDhEix3XOZAwgtVh50JyXQrQHrGWAibk0YOe0 woZP2nlZ2+hu7582/GIm7FgP6afjBB4CBNa6mXSmN0ez4r7gqsQQifXN7F7F8GjWFZgv mxoZqj6yNQgDzql2kNGdeipo1OuNH9pXKp5k3dDsvU2uMP372VCEARf0uoPnNWq+OF5l OWMg== X-Gm-Message-State: APjAAAWiXh3iTQDOOw6MKT2mlDpuHzwa5Bd8oBZ34l5D7wcaqcO+uN2H bpT4tbUR5/WKPsMkE4dqvFoQP2LiCUA= X-Received: by 2002:a17:902:9308:: with SMTP id bc8mr7441005plb.18.1576123247466; Wed, 11 Dec 2019 20:00:47 -0800 (PST) Received: from localhost.localdomain (97-113-7-119.tukw.qwest.net. [97.113.7.119]) by smtp.gmail.com with ESMTPSA id z130sm4666391pgz.6.2019.12.11.20.00.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2019 20:00:46 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 05/28] translator: Use cpu_ld*_code instead of open-coding Date: Wed, 11 Dec 2019 20:00:16 -0800 Message-Id: <20191212040039.26546-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191212040039.26546-1-richard.henderson@linaro.org> References: <20191212040039.26546-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" The DO_LOAD macros replicate the distinction already performed by the cpu_ldst.h functions. Use them. Signed-off-by: Richard Henderson --- include/exec/cpu_ldst.h | 11 --------- include/exec/translator.h | 48 +++++++++++---------------------------- 2 files changed, 13 insertions(+), 46 deletions(-) -- 2.20.1 diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h index cf8af36dbc..399ff6c3da 100644 --- a/include/exec/cpu_ldst.h +++ b/include/exec/cpu_ldst.h @@ -129,11 +129,6 @@ static inline void clear_helper_retaddr(void) #include "exec/cpu_ldst_useronly_template.h" #undef MEMSUFFIX -/* - * Code access is deprecated in favour of translator_ld* functions - * (see translator.h). However there are still users that need to - * converted so for now these stay. - */ #define MEMSUFFIX _code #define CODE_ACCESS #define DATA_SIZE 1 @@ -455,12 +450,6 @@ void cpu_stq_mmuidx_ra(CPUArchState *env, abi_ptr addr, uint64_t val, #undef CPU_MMU_INDEX #undef MEMSUFFIX -/* - * Code access is deprecated in favour of translator_ld* functions - * (see translator.h). However there are still users that need to - * converted so for now these stay. - */ - #define CPU_MMU_INDEX (cpu_mmu_index(env, true)) #define MEMSUFFIX _code #define SOFTMMU_CODE_ACCESS diff --git a/include/exec/translator.h b/include/exec/translator.h index 459dd72aab..638e1529c5 100644 --- a/include/exec/translator.h +++ b/include/exec/translator.h @@ -148,41 +148,19 @@ void translator_loop_temp_check(DisasContextBase *db); /* * Translator Load Functions * - * These are intended to replace the old cpu_ld*_code functions and - * are mandatory for front-ends that have been migrated to the common - * translator_loop. These functions are only intended to be called - * from the translation stage and should not be called from helper - * functions. Those functions should be converted to encode the - * relevant information at translation time. + * These are intended to replace the direct usage of the cpu_ld*_code + * functions and are mandatory for front-ends that have been migrated + * to the common translator_loop. These functions are only intended + * to be called from the translation stage and should not be called + * from helper functions. Those functions should be converted to encode + * the relevant information at translation time. */ -#ifdef CONFIG_USER_ONLY - -#define DO_LOAD(type, name, shift) \ - do { \ - set_helper_retaddr(1); \ - ret = name ## _p(g2h(pc)); \ - clear_helper_retaddr(); \ - } while (0) - -#else - -#define DO_LOAD(type, name, shift) \ - do { \ - int mmu_idx = cpu_mmu_index(env, true); \ - TCGMemOpIdx oi = make_memop_idx(shift, mmu_idx); \ - ret = helper_ret_ ## name ## _cmmu(env, pc, oi, 0); \ - } while (0) - -#endif - -#define GEN_TRANSLATOR_LD(fullname, name, type, shift, swap_fn) \ +#define GEN_TRANSLATOR_LD(fullname, type, load_fn, swap_fn) \ static inline type \ fullname ## _swap(CPUArchState *env, abi_ptr pc, bool do_swap) \ { \ - type ret; \ - DO_LOAD(type, name, shift); \ - \ + type ret = load_fn(env, pc); \ if (do_swap) { \ ret = swap_fn(ret); \ } \ @@ -195,11 +173,11 @@ void translator_loop_temp_check(DisasContextBase *db); return fullname ## _swap(env, pc, false); \ } -GEN_TRANSLATOR_LD(translator_ldub, ldub, uint8_t, 0, /* no swap */ ) -GEN_TRANSLATOR_LD(translator_ldsw, ldsw, int16_t, 1, bswap16) -GEN_TRANSLATOR_LD(translator_lduw, lduw, uint16_t, 1, bswap16) -GEN_TRANSLATOR_LD(translator_ldl, ldl, uint32_t, 2, bswap32) -GEN_TRANSLATOR_LD(translator_ldq, ldq, uint64_t, 3, bswap64) +GEN_TRANSLATOR_LD(translator_ldub, uint8_t, cpu_ldub_code, /* no swap */) +GEN_TRANSLATOR_LD(translator_ldsw, int16_t, cpu_ldsw_code, bswap16) +GEN_TRANSLATOR_LD(translator_lduw, uint16_t, cpu_lduw_code, bswap16) +GEN_TRANSLATOR_LD(translator_ldl, uint32_t, cpu_ldl_code, bswap32) +GEN_TRANSLATOR_LD(translator_ldq, uint64_t, cpu_ldq_code, bswap64) #undef GEN_TRANSLATOR_LD #endif /* EXEC__TRANSLATOR_H */