diff options
Diffstat (limited to 'linuxthreads')
-rw-r--r-- | linuxthreads/ChangeLog | 4 | ||||
-rw-r--r-- | linuxthreads/sysdeps/s390/pt-machine.h | 29 |
2 files changed, 29 insertions, 4 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 4c281da..4dce416 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,7 @@ +2000-09-28 Martin Schwidefsksy <schwidefsky@de.ibm.com> + + * sysdeps/s390/pt-machine.h: Make %a0 the thread register. + 2000-09-28 Ulrich Drepper <drepper@redhat.com> * mutex.c (__pthread_mutex_unlock): For PTHREAD_MUTEX_RECURSIVE_NP diff --git a/linuxthreads/sysdeps/s390/pt-machine.h b/linuxthreads/sysdeps/s390/pt-machine.h index 8de4a1a..a006efc 100644 --- a/linuxthreads/sysdeps/s390/pt-machine.h +++ b/linuxthreads/sysdeps/s390/pt-machine.h @@ -30,12 +30,13 @@ testandset (int *spinlock) int ret; __asm__ __volatile__( + " la 1,%1\n" " lhi 0,1\n" " l %0,%1\n" - "0: cs %0,0,%1\n" + "0: cs %0,0,0(1)\n" " jl 0b" : "=&d" (ret), "+m" (*spinlock) - : : "0", "cc"); + : : "0", "1", "cc"); return ret; } @@ -46,6 +47,25 @@ testandset (int *spinlock) #define CURRENT_STACK_FRAME stack_pointer register char * stack_pointer __asm__ ("15"); +/* Return the thread descriptor for the current thread. + S/390 registers uses access register 0 as "thread register". */ +#define THREAD_SELF ({ \ + register pthread_descr __self; \ + __asm__ ("ear %0,%%a0" : "=d" (__self) ); \ + __self; \ +}) + +/* Initialize the thread-unique value. */ +#define INIT_THREAD_SELF(descr, nr) ({ \ + __asm__ ("sar %%a0,%0" : : "d" (descr) ); \ +}) + +/* Access to data in the thread descriptor is easy. */ +#define THREAD_GETMEM(descr, member) THREAD_SELF->member +#define THREAD_GETMEM_NC(descr, member) THREAD_SELF->member +#define THREAD_SETMEM(descr, member, value) THREAD_SELF->member = (value) +#define THREAD_SETMEM_NC(descr, member, value) THREAD_SELF->member = (value) + /* Compare-and-swap for semaphores. */ @@ -57,14 +77,15 @@ __compare_and_swap(long int *p, long int oldval, long int newval) int retval; __asm__ __volatile__( + " la 1,%1\n" " lr 0,%2\n" - " cs 0,%3,%1\n" + " cs 0,%3,0(1)\n" " ipm %0\n" " srl %0,28\n" "0:" : "=&d" (retval), "+m" (*p) : "d" (oldval) , "d" (newval) - : "cc", "0"); + : "cc", "0", "1" ); return retval == 0; } |