From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by sourceware.org (Postfix) with ESMTPS id 74A603858434 for ; Tue, 4 Jan 2022 14:24:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 74A603858434 Received: by mail-qt1-x830.google.com with SMTP id m25so34152709qtq.13 for ; Tue, 04 Jan 2022 06:24:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=+Aq3vuFdkKfxGu/WZBcrrjAgqRBZDcGmh5xnOcR06PE=; b=QahWTw0z82HHelbK/LySamIhAYDx0CsAWKkGSPAbOUiUl4xKtvxHPInjNyw0da2zUn 4zY/tlOAp9aav2TFil6ZUQFeKzJKOtJZGMkpnFp13ZGkS9ltW9lJwSsMODZA/Pkf6ZsP qI9b943aleZzHXomeXfbASPOM6yHZ8gZn25PlkDePzV9KglbxuX1skCio7JNvJJGKg4Z bRvEPskQmjrkrYD260Kv9C/1OYWWjwRD8Uvn/BEdyUBQmwB6yZBMElVw+8hGpxeilLy2 nTg/B0Yu62xCo95aY/raOY41wqW6aFUtv3bxlzWDPNil8XMI3LfBh2S4sL/Us81yWBRp qKzA== X-Gm-Message-State: AOAM530SMMCOQXK29x6tXW9bIO/J/GTrygxjJDlM23sWaAQQ+ziou49w ir0bOK88sgg6ahvEd/P07u2jpQ== X-Google-Smtp-Source: ABdhPJwzC9ZUPFroYKJKQsNZcz7VbYwh8it0QxzlFLw6E58cOFnS/xDcijSHEBJeQMMX14+9X+LjPQ== X-Received: by 2002:ac8:5e4d:: with SMTP id i13mr44641170qtx.452.1641306266008; Tue, 04 Jan 2022 06:24:26 -0800 (PST) Received: from ?IPV6:2804:431:c7ca:a350:1960:9a87:fba4:a664? ([2804:431:c7ca:a350:1960:9a87:fba4:a664]) by smtp.gmail.com with ESMTPSA id q30sm29159165qkj.3.2022.01.04.06.24.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Jan 2022 06:24:25 -0800 (PST) Message-ID: <0446048b-ba32-f750-6e00-1fde5bb435f1@linaro.org> Date: Tue, 4 Jan 2022 11:24:23 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v2 09/14] LoongArch: Linux ABI Content-Language: en-US To: caiyinyu , libc-alpha@sourceware.org Cc: xuchenghua@loongson.cn, joseph_myers@mentor.com References: <20211231064455.1030051-1-caiyinyu@loongson.cn> <20211231064455.1030051-10-caiyinyu@loongson.cn> From: Adhemerval Zanella In-Reply-To: <20211231064455.1030051-10-caiyinyu@loongson.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jan 2022 14:24:27 -0000 On 31/12/2021 03:44, caiyinyu wrote: > diff --git a/sysdeps/loongarch/nptl/bits/struct_rwlock.h b/sysdeps/loongarch/nptl/bits/struct_rwlock.h > new file mode 100644 > index 0000000000..12b6a469bd > --- /dev/null > +++ b/sysdeps/loongarch/nptl/bits/struct_rwlock.h > @@ -0,0 +1,44 @@ > +/* LoongArch internal rwlock struct definitions. > + Copyright (C) 2021 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#ifndef _RWLOCK_INTERNAL_H > +#define _RWLOCK_INTERNAL_H > + > +/* There is a lot of padding in this structure. While it's not strictly > + necessary on LoongArch, we're going to leave it in to be on the safe side in > + case it's needed in the future. Most other architectures have the padding, > + so this gives us the same extensibility as everyone else has. */ > +struct __pthread_rwlock_arch_t > +{ > + unsigned int __readers; > + unsigned int __writers; > + unsigned int __wrphase_futex; > + unsigned int __writers_futex; > + unsigned int __pad3; > + unsigned int __pad4; > + int __cur_writer; > + int __shared; > + unsigned long int __pad1; > + unsigned long int __pad2; > + unsigned int __flags; > +}; > + > +#define __PTHREAD_RWLOCK_INITIALIZER(__flags) \ > + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags > + > +#endif Why can't you use the generic Linux sysdeps/nptl/bits/struct_rwlock.h ? > diff --git a/sysdeps/loongarch/nptl/pthread-offsets.h b/sysdeps/loongarch/nptl/pthread-offsets.h > new file mode 100644 > index 0000000000..415c3c113f > --- /dev/null > +++ b/sysdeps/loongarch/nptl/pthread-offsets.h > @@ -0,0 +1,15 @@ > +#if __WORDSIZE == 64 > +#define __PTHREAD_MUTEX_KIND_OFFSET 16 > +#else > +#define __PTHREAD_MUTEX_KIND_OFFSET 12 > +#endif > + > +#if __WORDSIZE == 64 > +#define __PTHREAD_RWLOCK_FLAGS_OFFSET 48 > +#else > +#if __BYTE_ORDER == __BIG_ENDIAN > +#define __PTHREAD_RWLOCK_FLAGS_OFFSET 27 > +#else > +#define __PTHREAD_RWLOCK_FLAGS_OFFSET 24 > +#endif > +#endif Ditto.