svn commit: r341177 - head/sys/powerpc/powerpc

Justin Hibbits jhibbits at FreeBSD.org
Mon Dec 3 16:14:28 UTC 2018


On Thu, 29 Nov 2018 12:56:22 +0200
Konstantin Belousov <kostikbel at 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


More information about the svn-src-all mailing list