[parisc-linux] Re: [PATCH] HPPA Linuxthreads.
Carlos O'Donell
carlos@baldric.uwo.ca
Thu, 22 May 2003 11:09:02 -0400
Ulrich,
> The indentation and general style is wrong in many places.
I'll clean this up today and break it into three chunks for even easier
digestion.
> > __pthread_spin_lock (pthread_spinlock_t *lock)
> > {
> > - unsigned int val;
> > + unsigned int *addr = __ldcw_align (lock);
> > +
> > + while (__ldcw (addr) == 0)
> > + while (*addr == 0) ;
>
> This is plain wrong. addr at least must be volatile.
__ldcw is volatile.
Are you suggesting that it is prehaps fragile based on gcc's
choice of optimization?
> And I don't understand why you removed the asm code. These pieces of
> code are prime candidates for hand-coding.
__ldcw is still assembly only. __ldcw_align is a macro. In truth I
wanted a functioning implementation first, optimization is a close
second. Though a full assembly version would fix gcc from reordering
anything.
> > +static inline struct _pthread_descr_struct * __get_cr27(void)
> > +{
> > + long cr27;
> > + asm("mfctl %%cr27, %0" : "=r" (cr27) : );
> > + return (struct _pthread_descr_struct *) cr27;
> > +}
>
> Not a real problem, but you should get gcc to recognize this reqister
> and perform the loading.
This should get addressed as TLS is implemented for HPPA. I will be
attending gcc-summit in hopes to discuss this with my colleagues.
c.