From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5515EC07E96 for ; Thu, 8 Jul 2021 16:15:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1302961874 for ; Thu, 8 Jul 2021 16:15:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1302961874 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:57934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1WgL-0002Cy-8R for qemu-devel@archiver.kernel.org; Thu, 08 Jul 2021 12:15:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1WCk-0006cK-Qx for qemu-devel@nongnu.org; Thu, 08 Jul 2021 11:44:47 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:38650) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m1WCj-0007nc-4z for qemu-devel@nongnu.org; Thu, 08 Jul 2021 11:44:46 -0400 Received: by mail-pl1-x629.google.com with SMTP id x3so3196645pll.5 for ; Thu, 08 Jul 2021 08:44:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=mWpSxWqXaU4VzD6THZWfXECcJOkMolUqhk6+bdyiMac=; b=ybdlcXSVxENV3VTvDzgzYAROTi/aATOM63URgetAuSXZ508hLaK+8K/aCUclv7WS8K +NvdxI3FABXliMgi0TSPeHSVNBSnRmYxB8ZA6wsIg3lqvQ5GKiB5GTm0OvzMKSeWZVYQ 9mfKhlFKyZ0/514nfj9Z961jDCPcN22EtXhFL63B0pPAXZJf5rMA8WElo2+ZEtUv5Qp+ QgN4P0mn/CjQm8LdeDjpIIYMvr4JX8j4482Y0u0O5H6CJTiEav1KiFmv/M2AAiHFA4xv KETaL5MzwwSFXEe0SemQMzGcRa1sz2An14rvqo0zSqjZStPBSTp1/6uM5AX4GqUWpsq1 GMOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mWpSxWqXaU4VzD6THZWfXECcJOkMolUqhk6+bdyiMac=; b=jaI9qo1hULfSqmcSVl7ZZjd0el19QVohpHUU0E2ODSS0HowZp3VSuqu9xGtvZ5Yozj JiTk9+uNC0OPQ9ipyVUqhQtJmQuNgDFIKiCx0iGEvizRZJl6b8EV2Bi7+8NZZVbgjVh+ Qt8hNupkSrDwN0EfoPKgN8HgamPJXUD4lcK/HviblwcxTpH1mIgO3wZSwN14UaKhrm0Y RorZ07ozk+CmdUEojJj8kq48sYKKhe1beVux7ZRzC3fqXPU2IFSL+yzPRp2z+DMjVJNL 9w75OxZbBjH/SBkSIimOug1XlziJfWF+RYlQxfBVflQsWRGdPKII0EhvAe5iL3jUqLrD Sgaw== X-Gm-Message-State: AOAM532veJOhcHLOd5hUV5QENae3FvKL3HjVrxdoMMKmxR9Ye4pZuDPg DTTj20WDrI2sEr032SVyTc1CFg== X-Google-Smtp-Source: ABdhPJzr4RM/JLybtcH21wAhq25waUqBgZKdaBsW3ySaxAeV3lg1MWdJo6Y+crlm0/EqWpvbg/9F7g== X-Received: by 2002:a17:90b:3b88:: with SMTP id pc8mr5732999pjb.124.1625759083799; Thu, 08 Jul 2021 08:44:43 -0700 (PDT) Received: from [192.168.1.11] ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id z20sm3913358pgk.36.2021.07.08.08.44.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Jul 2021 08:44:43 -0700 (PDT) Subject: Re: [PATCH v2 8/8] linux-user: Simplify host <-> target errno conversion using macros To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , qemu-devel@nongnu.org References: <20210708141121.1731691-1-f4bug@amsat.org> <20210708141121.1731691-9-f4bug@amsat.org> From: Richard Henderson Message-ID: Date: Thu, 8 Jul 2021 08:44:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210708141121.1731691-9-f4bug@amsat.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: Taylor Simpson , Laurent Vivier Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 7/8/21 7:11 AM, Philippe Mathieu-Daudé wrote: > Convert the host_to_target_errno_table[] array to a switch case > to allow compiler optimizations. Extract the errnos list as to > a new includible unit, using a generic macro. Remove the code > related to target_to_host_errno_table[] initialization. > > Suggested-by: Richard Henderson > Signed-off-by: Philippe Mathieu-Daudé > --- > linux-user/syscall.c | 169 +++++----------------------------------- > linux-user/errnos.c.inc | 140 +++++++++++++++++++++++++++++++++ > 2 files changed, 161 insertions(+), 148 deletions(-) > create mode 100644 linux-user/errnos.c.inc > > diff --git a/linux-user/syscall.c b/linux-user/syscall.c > index 56682b06cbd..8bb528d2cf7 100644 > --- a/linux-user/syscall.c > +++ b/linux-user/syscall.c > @@ -507,157 +507,37 @@ static inline int next_free_host_timer(void) > } > #endif > > -#define ERRNO_TABLE_SIZE 1200 > - > static inline bool errno_exists(int err) > { > - return err >= 0 && err < ERRNO_TABLE_SIZE; > + switch (err) { > +#define E(X) case X: return true; > +#include "errnos.c.inc" > +#undef E > + default: > + return false; > + } > } Not true. As documented, errnos.c.inc only contains those errno values which are overridden, not all errno values which are valid. r~