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=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 24943 invoked from network); 12 Dec 2020 04:31:07 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 12 Dec 2020 04:31:07 -0000 Received: (qmail 1193 invoked by uid 550); 12 Dec 2020 04:31:05 -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 1159 invoked from network); 12 Dec 2020 04:31:04 -0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dereferenced.org; s=default; t=1607747453; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Eqe3M3fcgLhR201kqAg+MkreoBPoppeDbco/YwZmXbE=; b=L6yMNca+ujMTlr6u7/gxjuURqG9UaWP40crF6EpDCbEoeKP0GesDIE+0GFPVcPX4/PyuVD Fhv7FmYX9YQTKc2lH4EtCC4WTassvNeT6LOL7htS2NnCKz5uBEIBvdtQS0zjq6l9rWnOZ7 NNNS/6OwIcBLc/e4uA3/Yzr0eqCOm3s= From: Ariadne Conill To: musl@lists.openwall.com Cc: Ariadne Conill Message-Id: <20201212043042.32355-1-ariadne@dereferenced.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: ariadne@dereferenced.org Date: Sat, 12 Dec 2020 04:30:53 GMT Subject: [musl] [PATCH v2] sh: fix incorrect GNU mcontext_t member definitions When compiling as _GNU_SOURCE, mcontext_t structure mirrors names used in sigcontext structure, but without the sc_ prefix. Split out sigcontext structure and adjust the mcontext_t member names accordingly. This is necessary to compile libucontext on sh architecture. --- v2: fix mcontext_t.gregs member name typo, fix pthread mcontext member usage arch/sh/bits/signal.h | 13 +++++++++++-- arch/sh/pthread_arch.h | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/arch/sh/bits/signal.h b/arch/sh/bits/signal.h index 160311fa..d0b14828 100644 --- a/arch/sh/bits/signal.h +++ b/arch/sh/bits/signal.h @@ -9,7 +9,16 @@ #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) typedef int greg_t, gregset_t[16]; typedef int freg_t, fpregset_t[16]; -typedef struct sigcontext { +typedef struct { + unsigned long oldmask; + unsigned long gregs[16]; + unsigned long pc, pr, sr; + unsigned long gbr, mach, macl; + unsigned long fpregs[16]; + unsigned long xfpregs[16]; + unsigned int fpscr, fpul, ownedfp; +} mcontext_t; +struct sigcontext { unsigned long oldmask; unsigned long sc_regs[16]; unsigned long sc_pc, sc_pr, sc_sr; @@ -17,7 +26,7 @@ typedef struct sigcontext { unsigned long sc_fpregs[16]; unsigned long sc_xfpregs[16]; unsigned int sc_fpscr, sc_fpul, sc_ownedfp; -} mcontext_t; +}; #else typedef struct { unsigned long __regs[58]; diff --git a/arch/sh/pthread_arch.h b/arch/sh/pthread_arch.h index 0fcf70d2..199c2d55 100644 --- a/arch/sh/pthread_arch.h +++ b/arch/sh/pthread_arch.h @@ -8,9 +8,9 @@ static inline uintptr_t __get_tp() #define TLS_ABOVE_TP #define GAP_ABOVE_TP 8 -#define MC_PC sc_pc +#define MC_PC pc #ifdef __FDPIC__ -#define MC_GOT sc_regs[12] +#define MC_GOT gregs[12] #define CANCEL_GOT (*(uintptr_t *)((char *)__syscall_cp_asm+sizeof(uintptr_t))) #endif -- 2.29.2