[parisc-linux] Re: [PATCH] HPPA Linuxthreads.

Ulrich Drepper drepper@redhat.com
Wed, 21 May 2003 10:57:57 -0700


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Carlos O'Donell wrote:

> This is a cleaner HPPA linuxthreads implementation that stems from the
> work that John David Anglin <dave.anglin@nrc-cnrc.gc.ca> and myself did 
> to devise a self-aligning lock system that doesn't impose the 16-byte 
> lock alignment restriction.

The indentation and general style is wrong in many places.


> diff -urN glibc-2.3.1.orig/linuxthreads/sysdeps/hppa/pspinlock.c glibc-2.3.1/linuxthreads/sysdeps/hppa/pspinlock.c
> --- glibc-2.3.1.orig/linuxthreads/sysdeps/hppa/pspinlock.c	2002-08-26 18:39:51.000000000 -0400
> +++ glibc-2.3.1/linuxthreads/sysdeps/hppa/pspinlock.c	2003-01-15 18:26:51.000000000 -0500
> @@ -24,15 +24,12 @@
>  int
>  __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.

And I don't understand why you removed the asm code.  These pieces of
code are prime candidates for hand-coding.


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

- -- 
- --------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+y74l2ijCOnn/RHQRAvZ1AKCkAhua5qA19EDylfBz2Zhp8dROIACfTrwO
9Slpj32aUy92PiggDNexZBE=
=6Ilf
-----END PGP SIGNATURE-----