From patchwork Wed Dec 19 04:21:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 154237 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4506209ljp; Tue, 18 Dec 2018 20:34:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/U4CLAROAqsJrfr+weol3KqILE4KJqn9veelsfRZ7fNAoX46P7h3huixMCnN3r2n2VmgYPk X-Received: by 2002:aed:2803:: with SMTP id r3mr19817347qtd.316.1545194085861; Tue, 18 Dec 2018 20:34:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545194085; cv=none; d=google.com; s=arc-20160816; b=OK5mJZhR49l4HBA8uEEI08bSuJCfq9PPx9ih5G4eNGQwZZcpFxNxY+ZhXWw8A7peZi 53J+ZXJ6zCbCA2PXBbL5H3hz65Xf2YwDHL3E0K0anpn2geUYxXnZomX6a0OTFEUx/slu dAKaV899U2oNA2e4GWdr8xWnMONYBU0jXEXeeImXlOcFLZ+KStcUMjey+kYTkoyqjszp /9yMZl53wKVK+ZKRUxga/eZcFRMUek8bRRUmaM9eCtZ1fQ+qbrC2wBnNbtH77INZnGwd R0QnBTiOHKxlZQzAyDTwr/G1NDbPz0uhhRpIcY92GncuKNJ4p+IbU1ESZtx3ZiOuPQ/u QSVw== 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:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=jzabKvrmTWISY3KB/ab08L0zuoOLLDdoLb1OMab5kDU=; b=gFp7wQXLe9At9WXIMsbi8uliV0VN4z1TeoXCETDgXXdY20UucEyVc5AKfhyAqC9xUz 0ZbYcG9/rlhyu6LCApApoa0mQ86nmlL9t505PYhukhxk3P7Ikei4Da93gwG3xMo4lysq TjQbCetf/BWFUaDPIhsSHEiPeOHyxfYNIjncVohtPX1t3zXRTp3eolRkG8Tp/0PmU5L5 hB2mrJlBa0tgKNj5RF02Tg+MNF80LHjeNlYpz991q2fSCLP43qt3jDYr4C0wJrH+axGp 170YXpm67qKLgwWYBJF9xYjKieU3QCUmv157gcxSlRkilHImRKqfO1PDhfU/t2FSd1Mk tEaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WeK7t7C3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c29si1252687qte.8.2018.12.18.20.34.45 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 18 Dec 2018 20:34:45 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=WeK7t7C3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZTZF-0005IJ-B0 for patch@linaro.org; Tue, 18 Dec 2018 23:34:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZTRd-0007wa-Lk for qemu-devel@nongnu.org; Tue, 18 Dec 2018 23:26:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZTML-0006Mz-3E for qemu-devel@nongnu.org; Tue, 18 Dec 2018 23:21:25 -0500 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:41468) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gZTMJ-0006Km-Iy for qemu-devel@nongnu.org; Tue, 18 Dec 2018 23:21:23 -0500 Received: by mail-pl1-x642.google.com with SMTP id u6so8851156plm.8 for ; Tue, 18 Dec 2018 20:21:21 -0800 (PST) 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; bh=jzabKvrmTWISY3KB/ab08L0zuoOLLDdoLb1OMab5kDU=; b=WeK7t7C30rVzlfptIN9x1dEOq1B1ZU1xEqIWpZl9glKj00kRa7bWTUKvFyJmtdzGDt pacZrMoAdQ6TgYw/2oQ1t4l4NzsjMVaFiavA1yQaX+W3LIpj0go0R5AAiElHs31eCTbm i83HfEjBozV13Aw4A1m8wsZj3QL3387XwG3g4= 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; bh=jzabKvrmTWISY3KB/ab08L0zuoOLLDdoLb1OMab5kDU=; b=H2hEI2sz255Wf26tBt36nM00a6DKEfdgYuiklxziHr5eqaaaHlniClXpOrBrI5BNXa QLhvbwXmAaZ8y7Oq+/wTIoX830KFUncLacihlUyqAEzkpzr0rYDykxXV3k5tRGoTVdOl x3aFSPZpHgVS2ZmV6ABGJnEXSUebVlZgnQvB3gGaBN6aBCjfGdL/3Lm6KC0dfOu6z3c/ yX74uNWqXnAlgtZBnbD0aGSphHdyfgHGoV2NNXEWoAWCkxJ41H4Dpy0IJtc/dDXQevcE cMSqCg0ncz88nPBoSgjjhnUgSURNmd4yrTWwfGWLkvSwbd52VLSW4oPon7wa0lXVT5bM U8aQ== X-Gm-Message-State: AA+aEWZpqjCp+1z37b+z/Jruw3cF2o5sunrsMlRJ8ccpobygLEJia9i1 mz1XxYDB3+KG8ya9Rai5Rnim2esZuUU= X-Received: by 2002:a17:902:66e6:: with SMTP id e93mr18437607plk.92.1545193279831; Tue, 18 Dec 2018 20:21:19 -0800 (PST) Received: from cloudburst.twiddle.net (97-126-115-157.tukw.qwest.net. [97.126.115.157]) by smtp.gmail.com with ESMTPSA id f64sm47287228pfh.0.2018.12.18.20.21.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Dec 2018 20:21:19 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 20:21:08 -0800 Message-Id: <20181219042113.7364-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20181219042113.7364-1-richard.henderson@linaro.org> References: <20181219042113.7364-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 Subject: [Qemu-devel] [PATCH v5 3/8] linux-user: Reduce regpairs_aligned & target_offset64 ifdefs 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: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson --- linux-user/syscall.c | 54 ++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 29 deletions(-) -- 2.17.2 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 7118f07441..d4c11c3e93 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -474,37 +474,38 @@ static inline int next_free_host_timer(void) } #endif -/* ARM EABI and MIPS expect 64bit types aligned even on pairs or registers */ +/* + * Returns true if syscall NUM expects 64bit types aligned even + * on pairs of registers. + */ +static inline bool regpairs_aligned(void *cpu_env, int num) +{ #ifdef TARGET_ARM -static inline int regpairs_aligned(void *cpu_env, int num) -{ - return ((((CPUARMState *)cpu_env)->eabi) == 1) ; -} -#elif defined(TARGET_MIPS) && (TARGET_ABI_BITS == 32) -static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } + return ((CPUARMState *)cpu_env)->eabi; +#elif defined(TARGET_MIPS) && TARGET_ABI_BITS == 32 + return true; #elif defined(TARGET_PPC) && !defined(TARGET_PPC64) -/* SysV AVI for PPC32 expects 64bit parameters to be passed on odd/even pairs - * of registers which translates to the same as ARM/MIPS, because we start with - * r3 as arg1 */ -static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } + /* + * SysV AVI for PPC32 expects 64bit parameters to be passed on + * odd/even pairs of registers which translates to the same as + * we start with r3 as arg1. + */ + return true; #elif defined(TARGET_SH4) -/* SH4 doesn't align register pairs, except for p{read,write}64 */ -static inline int regpairs_aligned(void *cpu_env, int num) -{ + /* SH4 doesn't align register pairs, except for p{read,write}64. */ switch (num) { case TARGET_NR_pread64: case TARGET_NR_pwrite64: - return 1; - + return true; default: - return 0; + return false; } -} #elif defined(TARGET_XTENSA) -static inline int regpairs_aligned(void *cpu_env, int num) { return 1; } + return true; #else -static inline int regpairs_aligned(void *cpu_env, int num) { return 0; } + return false; #endif +} #define ERRNO_TABLE_SIZE 1200 @@ -6066,21 +6067,16 @@ void syscall_init(void) } } -#if TARGET_ABI_BITS == 32 -static inline uint64_t target_offset64(uint32_t word0, uint32_t word1) +static inline uint64_t target_offset64(abi_ulong word0, abi_ulong word1) { -#ifdef TARGET_WORDS_BIGENDIAN +#if TARGET_ABI_BITS == 64 + return word0; +#elif defined(TARGET_WORDS_BIGENDIAN) return ((uint64_t)word0 << 32) | word1; #else return ((uint64_t)word1 << 32) | word0; #endif } -#else /* TARGET_ABI_BITS == 32 */ -static inline uint64_t target_offset64(uint64_t word0, uint64_t word1) -{ - return word0; -} -#endif /* TARGET_ABI_BITS != 32 */ #ifdef TARGET_NR_truncate64 static inline abi_long target_truncate64(void *cpu_env, const char *arg1,