Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Dec 2018 10:14:19 -0600
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
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:  <20181203101403.08017039@ralga.knownspace>
In-Reply-To: <20181129105622.GL2378@kib.kiev.ua>
References:  <201811290339.wAT3dBqf027972@repo.freebsd.org> <20181129105622.GL2378@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 29 Nov 2018 12:56:22 +0200
Konstantin Belousov <kostikbel@gmail.com> wrote:

> 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.

Hi Kib,

Thanks for the tip.  I'll look closer at how you do it over on the x86
side.  I'm not sure why the separate sysvec for ELFv2, so I'll need to
check.

- Justin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20181203101403.08017039>