From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id D4CC53858D20 for ; Wed, 5 Apr 2023 14:04:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D4CC53858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ot1-x32c.google.com with SMTP id a30-20020a9d3e1e000000b006a13f728172so15892307otd.3 for ; Wed, 05 Apr 2023 07:04:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680703459; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=BZ3tkOIae3NdLeffzVuSjNvpuG66zBWyHFCV21j4p8M=; b=MDwU5b7/zchWWq435MZL038IuweTlPdPEtZGvJqVPSd0z/JR3x6kAmLnoQR0zNaTbN wI+xRF/JNmUBk5Dx2QvTNQnkhYSaVQPRnnVPZhqzSOQTCZxlTiYhIHcV4Fu9o8OL3r4X dq28oD/443Laoa3ngg5pol8a61+qjZA38NVH4lRa76OYwOUbxdXIl6fRkQszg5aabMuL yRidkA2qFOxqwdoi3gCMh3uNdR8Gk/CQH1OEfxHPhAIpchvftpro8pDQiQ4uUYcyg7pH a/NA0wIHdW/ceqGnwaIemQxKdH5lhLt9xoc0EW85zRm27A/uYTaHDbU5gDvVSapSsXwq ATGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680703459; h=content-transfer-encoding:in-reply-to:organization:from:references :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BZ3tkOIae3NdLeffzVuSjNvpuG66zBWyHFCV21j4p8M=; b=Tu88llfAqlhOIkV9RjEzI6wlguUmmVeqeDvasEI3oUhuyLTHOX1IqnAbUaB3hGsH2d 3kRwLJm8paidis8Vn5rcpci+yiNL8J4htv8Hz5ZULQ8kaNZwc3lazL9DVp6zQjWuhreC CM8VsLql/vY9EPyzaAA/K0h//baUCZprxATDPhPhiuEfSiTAi3EDPKktIwf3IgHFe+BR iwcQMruxVaDnGp/dyRy7Jp/TjjlX129pYxika7e/dGlEmD3RPiUa3L5qu7Hbs/6qp0kV Pw6nQYJAI2ot0DN7nBXbB3kK/kH/UbWWWTq3AXIhit3MV85NC/oJZJ40JeGNtgYlUbKX VMPg== X-Gm-Message-State: AAQBX9cukKudBxvoeFcKhwV65CHf385HZNjpCvY7+7QwHlFtAmH4N5JR nfVTCnakjIRgdZYo8jTa2W5NSZbTUkhe8G6pz+DkdA== X-Google-Smtp-Source: AKy350a/cmNhmxsxGoC9HF8jWqifzcG4bWohGxh4PfCiAtAn7uh2y79EqgWJN9JdhhAHA4Ek3Fp2Cg== X-Received: by 2002:a05:6830:1296:b0:6a3:3641:8d77 with SMTP id z22-20020a056830129600b006a336418d77mr3087314otp.15.1680703459453; Wed, 05 Apr 2023 07:04:19 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c1:e5a5:58b1:d0fe:f5:339e? ([2804:1b3:a7c1:e5a5:58b1:d0fe:f5:339e]) by smtp.gmail.com with ESMTPSA id k1-20020a9d7601000000b006a1793e3571sm6793852otl.61.2023.04.05.07.04.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Apr 2023 07:04:18 -0700 (PDT) Message-ID: <45d5946a-1269-3d7f-08ca-6fe7c0fdfa68@linaro.org> Date: Wed, 5 Apr 2023 11:04:16 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v2 0/5] linux: Avoid va_list for generic syscall wrappers if possible Content-Language: en-US To: libc-alpha@sourceware.org References: From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 05/04/23 10:19, Wilco Dijkstra via Libc-alpha wrote: > Hi, > >> Maybe we can use a custom C implementation (like RISC-V) as well.  But >> strictly speaking the RISC-V syscall.c is invoking undefined behavior >> (like my proposal) so I agree with assembly here. > > How does assembly code not invoke the exact same undefined behaviour? > In both cases you rely on variable arguments being passed in the same > way as integer args - this is true in many ABIs. The goal is to avoid introducing > unnecessary assembly and use generic implementations where possible. > > So if that C version works as well as assembler on LoongArch and assuming > that bare syscall() performance is essential, then why not use it? After this discussion, it seems that RISCV implementation is essentially broken and it would be better to either provide a arch-specific assembly implementation and/or use the generic C one and fix the code generation issue.