From patchwork Wed Sep 25 18:45:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 174404 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1017521ill; Wed, 25 Sep 2019 11:48:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqyZPalJ08fWfJm5kO+UXEutKrApVCQHsHKpBF7lS3qobTjluiHAyLBIv565owch7eFHDWZQ X-Received: by 2002:a17:906:7e56:: with SMTP id z22mr626493ejr.294.1569437296507; Wed, 25 Sep 2019 11:48:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569437296; cv=none; d=google.com; s=arc-20160816; b=moFRvPPRjakR4EIovyRyON9MvKvBGdSyaW7eYFy+fIiYcx1mXIlCCYn50HaiJA/FTg BtbelvQUgXOiwzRaDMIPTXDZyQWpayLdlPRMcAfBQro2CsgSADsLqGyKGJFAyBIfJmbF dz8z9qbBJX6QwqUUMyDIv4qhpGN1p8je2SHBE0w4nr2ubuxKjKjNqhsyzspQcx9v7W0/ FT+ceOGLH0uF8j0Cbr8+/zGHbY2c4lVSDd8ucTXVz6X7AycbZ9BRUhSawmohBwlRBryC TUIHGFJHTbFSDC0tXmDMmjE+nSG4j6x07CbQCSDz6ob/tKyhyW+6d6MoK4POfr6+ADej jzWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=dpjQdA7JkkGx46Rli+yrKoXDpXOevLhotnlmbVLP3mg=; b=MMs8TvQTTNDUVoWvi/UnCBX1bCLd3Q0V67RPzOWy+ybS1jZ7bN/yE1jHg8el8uSlj6 d9c1bm34zN69pKukZ1X5taqHvq8Oa+i5SYFbWjhHLayQTNNZDJNehLCg/jlVbo3N8Qml Ip7qY166lHDyTJTalVhPS6TCZ+6BlNS0RCz4UnP7xD3fL8/ppUzH3e7iXG7KBdwYiBi7 T5PBYBzWK0jiiWH/xQ++9byRJYc7EVik/PiklwEChpUXWBlX+JXUyN6CF/Zp4yLjBewx CS5ElVzRBucKTrDdV7NcKiaYTYqtXjSgoK1uoxnYMZ17d9XvGUUsUWB+TYpOWBPUOEM5 gbGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qjp0JUK4; 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 w54si4113479edd.427.2019.09.25.11.48.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Sep 2019 11:48:16 -0700 (PDT) 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=Qjp0JUK4; 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]:55996 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDCKk-0001nW-Ks for patch@linaro.org; Wed, 25 Sep 2019 14:48:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47001) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDCIa-0001j1-N9 for qemu-devel@nongnu.org; Wed, 25 Sep 2019 14:46:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDCIZ-0004Ef-Go for qemu-devel@nongnu.org; Wed, 25 Sep 2019 14:46:00 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:43869) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDCIZ-0004EV-BO for qemu-devel@nongnu.org; Wed, 25 Sep 2019 14:45:59 -0400 Received: by mail-pl1-x633.google.com with SMTP id f21so539425plj.10 for ; Wed, 25 Sep 2019 11:45:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dpjQdA7JkkGx46Rli+yrKoXDpXOevLhotnlmbVLP3mg=; b=Qjp0JUK4Dp2sjVrTeu15m/JGRzbnlZ6vOzaGsjOFpVbDafFjxvP/+VWwO4qCL6lMpN /f5LTA+VcRpqny0zfq4rV9x0+tOxnecAoVt3CtJjHnn5PAwCYHrn4jwLAmG3NRfgVXHY jr8ceFM59yM+QasTIOdgNkU2cquP2vwnnNIQSESr8l15nwn7T4xJ+IvxSMrnRJTUmYhE TQmr7aQXVHuKlYC2BWthrQkj1qgM2MFhxvMkxNsz5bNr8DWqmtQuGx3Xq4U+WPvPhHfy 1T/G1rDE15TR8RVnqRFc3Of4cEye/gVBUB7PHK0vz+IhMWk5IdKptEdlIQoq4WmxAMQZ 8HoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dpjQdA7JkkGx46Rli+yrKoXDpXOevLhotnlmbVLP3mg=; b=V7gkPVapJ/tft8/l0Za7tGo94bBmcrT4PWueDWmCnXkQkkZPux4hxQS5xBxIf0EAl9 jai16Iy8QwIwrSrrH9Qbs+f3AhLUDfLV3598jsdbLs6x1CZa/2Qr92TkOGtMQYR8bwNz t4MQsFUpp9YeZCOjqM8zphEF7NgkkQAoyaQfYI2RtRD2zrZM4qgb0kE5II1rJ54jHz1r qd1f8e00tClJ65jurES3i86LKLz83ByqXZ5hnbM7B2YaqK8k1pGvxmio1MBHK5LJqPNS zpbNoz+JiObC885eEneIKjX8eXn16XOUdM1FQ9MREWPzvsMIMzUoykQIn2S5heiDHAoc SpBw== X-Gm-Message-State: APjAAAWrrWfPFbyj38ZGIRf/YnrI+KcxWqmZOrjN/cKSqLJTltloHOGW YH/DXzvpDSldEjkTYYSXJHcISUhbzWY= X-Received: by 2002:a17:902:fe86:: with SMTP id x6mr10925297plm.28.1569437157768; Wed, 25 Sep 2019 11:45:57 -0700 (PDT) Received: from localhost.localdomain ([12.206.46.61]) by smtp.gmail.com with ESMTPSA id l24sm6133229pff.151.2019.09.25.11.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Sep 2019 11:45:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 05/16] cputlb: Split out load/store_memop Date: Wed, 25 Sep 2019 11:45:37 -0700 Message-Id: <20190925184548.30673-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190925184548.30673-1-richard.henderson@linaro.org> References: <20190925184548.30673-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::633 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: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We will shortly be using these more than once. Reviewed-by: Alex Bennée Reviewed-by: David Hildenbrand Signed-off-by: Richard Henderson --- accel/tcg/cputlb.c | 107 +++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 52 deletions(-) -- 2.17.1 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index e31378bce3..eeba8c9847 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1281,6 +1281,29 @@ static void *atomic_mmu_lookup(CPUArchState *env, target_ulong addr, typedef uint64_t FullLoadHelper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi, uintptr_t retaddr); +static inline uint64_t QEMU_ALWAYS_INLINE +load_memop(const void *haddr, MemOp op) +{ + switch (op) { + case MO_UB: + return ldub_p(haddr); + case MO_BEUW: + return lduw_be_p(haddr); + case MO_LEUW: + return lduw_le_p(haddr); + case MO_BEUL: + return (uint32_t)ldl_be_p(haddr); + case MO_LEUL: + return (uint32_t)ldl_le_p(haddr); + case MO_BEQ: + return ldq_be_p(haddr); + case MO_LEQ: + return ldq_le_p(haddr); + default: + qemu_build_not_reached(); + } +} + static inline uint64_t QEMU_ALWAYS_INLINE load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi, uintptr_t retaddr, MemOp op, bool code_read, @@ -1373,33 +1396,7 @@ load_helper(CPUArchState *env, target_ulong addr, TCGMemOpIdx oi, do_aligned_access: haddr = (void *)((uintptr_t)addr + entry->addend); - switch (op) { - case MO_UB: - res = ldub_p(haddr); - break; - case MO_BEUW: - res = lduw_be_p(haddr); - break; - case MO_LEUW: - res = lduw_le_p(haddr); - break; - case MO_BEUL: - res = (uint32_t)ldl_be_p(haddr); - break; - case MO_LEUL: - res = (uint32_t)ldl_le_p(haddr); - break; - case MO_BEQ: - res = ldq_be_p(haddr); - break; - case MO_LEQ: - res = ldq_le_p(haddr); - break; - default: - qemu_build_not_reached(); - } - - return res; + return load_memop(haddr, op); } /* @@ -1530,6 +1527,36 @@ tcg_target_ulong helper_be_ldsl_mmu(CPUArchState *env, target_ulong addr, * Store Helpers */ +static inline void QEMU_ALWAYS_INLINE +store_memop(void *haddr, uint64_t val, MemOp op) +{ + switch (op) { + case MO_UB: + stb_p(haddr, val); + break; + case MO_BEUW: + stw_be_p(haddr, val); + break; + case MO_LEUW: + stw_le_p(haddr, val); + break; + case MO_BEUL: + stl_be_p(haddr, val); + break; + case MO_LEUL: + stl_le_p(haddr, val); + break; + case MO_BEQ: + stq_be_p(haddr, val); + break; + case MO_LEQ: + stq_le_p(haddr, val); + break; + default: + qemu_build_not_reached(); + } +} + static inline void QEMU_ALWAYS_INLINE store_helper(CPUArchState *env, target_ulong addr, uint64_t val, TCGMemOpIdx oi, uintptr_t retaddr, MemOp op) @@ -1657,31 +1684,7 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val, do_aligned_access: haddr = (void *)((uintptr_t)addr + entry->addend); - switch (op) { - case MO_UB: - stb_p(haddr, val); - break; - case MO_BEUW: - stw_be_p(haddr, val); - break; - case MO_LEUW: - stw_le_p(haddr, val); - break; - case MO_BEUL: - stl_be_p(haddr, val); - break; - case MO_LEUL: - stl_le_p(haddr, val); - break; - case MO_BEQ: - stq_be_p(haddr, val); - break; - case MO_LEQ: - stq_le_p(haddr, val); - break; - default: - qemu_build_not_reached(); - } + store_memop(haddr, val, op); } void helper_ret_stb_mmu(CPUArchState *env, target_ulong addr, uint8_t val,