From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24259 invoked from network); 18 Apr 2023 09:47:34 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 18 Apr 2023 09:47:34 -0000 Received: (qmail 8102 invoked by uid 550); 18 Apr 2023 09:47:29 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 8070 invoked from network); 18 Apr 2023 09:47:28 -0000 Date: Tue, 18 Apr 2023 11:38:44 +0200 From: Szabolcs Nagy To: =?utf-8?B?546L5rSq5Lqu?= Cc: musl@lists.openwall.com Message-ID: <20230418093844.GP3630668@port70.net> Mail-Followup-To: =?utf-8?B?546L5rSq5Lqu?= , musl@lists.openwall.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: Subject: Re: [musl] add loongarch64 port v7. * =E7=8E=8B=E6=B4=AA=E4=BA=AE [2023-04-18 09:28= :49 +0800]: > +++ b/arch/loongarch64/bits/signal.h > @@ -6,14 +6,27 @@ > =C2=A0#define SIGSTKSZ=C2=A0=C2=A0=C2=A0 16384 > =C2=A0#endif >=20 > +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) > =C2=A0typedef unsigned long greg_t, gregset_t[32]; >=20 > -typedef struct sigcontext { > +struct sigcontext { > =C2=A0=C2=A0=C2=A0=C2=A0 unsigned long sc_pc; > -=C2=A0=C2=A0=C2=A0 gregset_t=C2=A0=C2=A0=C2=A0=C2=A0 sc_regs; > -=C2=A0=C2=A0=C2=A0 unsigned int=C2=A0 sc_flags; > -=C2=A0=C2=A0=C2=A0 unsigned long sc_extcontext[]; > +=C2=A0=C2=A0=C2=A0 unsigned long sc_regs[32]; > +=C2=A0=C2=A0=C2=A0 unsigned int sc_flags; > +=C2=A0=C2=A0=C2=A0 unsigned long sc_extcontext[] __attribute__((__aligne= d__(16))); > +}; this looks good. (i don't know if this is really needed in signal.h, but other targets have it too) > + > +typedef struct { > +=C2=A0=C2=A0=C2=A0 unsigned long __pc; > +=C2=A0=C2=A0=C2=A0 unsigned long __gregs[32]; > +=C2=A0=C2=A0=C2=A0 unsigned int __flags; > +=C2=A0=C2=A0=C2=A0 unsigned long __extcontext[] __attribute__((__aligned= __(16))); > =C2=A0} mcontext_t; i would use the same struct tag as glibc so typedef struct mcontext_t { ... (we don't need c++ abi compat with glibc, but it's nicer to be consistent) > +#else > +typedef struct { > +=C2=A0=C2=A0=C2=A0 unsigned long __space[34]; > +} mcontext_t; i would add the aligned attribute here. (it's more important to match the kernel layout than to avoid c extensions in standard mode: loongarch c compilers will all support the aligned attribute in system headers) > +#endif >=20 > =C2=A0struct sigaltstack { > =C2=A0=C2=A0=C2=A0=C2=A0 void=C2=A0=C2=A0 *ss_sp; > @@ -23,11 +36,10 @@ struct sigaltstack { >=20 > =C2=A0typedef struct __ucontext > =C2=A0{ > -=C2=A0=C2=A0=C2=A0 unsigned long=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 uc_flags; > +=C2=A0=C2=A0=C2=A0 unsigned long=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 __uc_flag= s; > =C2=A0=C2=A0=C2=A0=C2=A0 struct __ucontext=C2=A0 *uc_link; > =C2=A0=C2=A0=C2=A0=C2=A0 stack_t=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 uc_stack; > =C2=A0=C2=A0=C2=A0=C2=A0 sigset_t=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 uc_sigmask; > -=C2=A0=C2=A0=C2=A0 long=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 __uc_pad; > =C2=A0=C2=A0=C2=A0=C2=A0 mcontext_t=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 uc_mcontext; > =C2=A0} ucontext_t; looks good. (the only issue is if some code uses uc_flags in an arch independent way. i don't know if there is any use for it on linux. but we can fix that later on both glibc and musl side if it comes up.)