From owner-svn-src-head@freebsd.org Thu Nov 29 10:56:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA584115BF11; Thu, 29 Nov 2018 10:56:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D54A9832FE; Thu, 29 Nov 2018 10:56:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id wATAuMA9001115 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 29 Nov 2018 12:56:25 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua wATAuMA9001115 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id wATAuMgS001114; Thu, 29 Nov 2018 12:56:22 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 29 Nov 2018 12:56:22 +0200 From: Konstantin Belousov To: Justin Hibbits Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r341177 - head/sys/powerpc/powerpc Message-ID: <20181129105622.GL2378@kib.kiev.ua> References: <201811290339.wAT3dBqf027972@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201811290339.wAT3dBqf027972@repo.freebsd.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: D54A9832FE X-Spamd-Result: default: False [-5.12 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; R_SPF_SOFTFAIL(0.00)[~all]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_SOME(0.00)[]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.99)[-0.989,0]; IP_SCORE(-2.12)[ip: (-2.51), ipnet: 2001:470::/32(-4.50), asn: 6939(-3.49), country: US(-0.09)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_TLS_LAST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Nov 2018 10:56:38 -0000 On Thu, Nov 29, 2018 at 03:39:11AM +0000, Justin Hibbits wrote: > Author: jhibbits > Date: Thu Nov 29 03:39:11 2018 > New Revision: 341177 > URL: https://svnweb.freebsd.org/changeset/base/341177 > > Log: > Fix thread creation in PowerPC64 ELFv2 processes. > > Summary: > Currently, the upcall used to create threads assumes ELFv1. > > Instead, we should check which sysentvec is in use on the process and act > accordingly. > > This makes ELFv2 threaded processes work. > > Submitted by: git_bdragon.rtk0.net > Differential Revision: https://reviews.freebsd.org/D18330 > > Modified: > head/sys/powerpc/powerpc/exec_machdep.c > > Modified: head/sys/powerpc/powerpc/exec_machdep.c > ============================================================================== > --- head/sys/powerpc/powerpc/exec_machdep.c Thu Nov 29 02:52:08 2018 (r341176) > +++ head/sys/powerpc/powerpc/exec_machdep.c Thu Nov 29 03:39:11 2018 (r341177) > @@ -124,6 +124,10 @@ static int grab_mcontext32(struct thread *td, mcontext > > static int grab_mcontext(struct thread *, mcontext_t *, int); > > +#ifdef __powerpc64__ > +extern struct sysentvec elf64_freebsd_sysvec_v2; > +#endif > + > void > sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) > { > @@ -1014,11 +1018,18 @@ cpu_set_upcall(struct thread *td, void (*entry)(void * > #endif > } else { > #ifdef __powerpc64__ > - register_t entry_desc[3]; > - (void)copyin((void *)entry, entry_desc, sizeof(entry_desc)); > - tf->srr0 = entry_desc[0]; > - tf->fixreg[2] = entry_desc[1]; > - tf->fixreg[11] = entry_desc[2]; > + if (td->td_proc->p_sysent == &elf64_freebsd_sysvec_v2) { I recommend you to not do this, instead add a new sv_flag to indicate ELFv2 for PPC. We already have almost machine-specific flags like ia32. > + tf->srr0 = (register_t)entry; > + /* ELFv2 ABI requires that the global entry point be in r12. */ > + tf->fixreg[12] = (register_t)entry; > + } > + else { > + register_t entry_desc[3]; > + (void)copyin((void *)entry, entry_desc, sizeof(entry_desc)); > + tf->srr0 = entry_desc[0]; > + tf->fixreg[2] = entry_desc[1]; > + tf->fixreg[11] = entry_desc[2]; > + } > tf->srr1 = psl_userset | PSL_FE_DFLT; > #endif > }