From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11801 invoked by alias); 12 Sep 2006 22:28:55 -0000 Received: (qmail 11785 invoked by uid 22791); 12 Sep 2006 22:28:55 -0000 X-Spam-Check-By: sourceware.org Received: from mo00.iij4u.or.jp (HELO mo00.iij4u.or.jp) (210.130.0.19) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 12 Sep 2006 22:28:52 +0000 Received: MO(mo00) for id k8CMSnJH004067; Wed, 13 Sep 2006 07:28:49 +0900 (JST) Received: from localhost (51.65.30.125.dy.iij4u.or.jp [125.30.65.51]) by r-rr.iij4u.or.jp (4U-MR/r-rr) id k8CMSmCo007220 for ; Wed, 13 Sep 2006 07:28:48 +0900 (JST) Date: Tue, 12 Sep 2006 22:28:00 -0000 Message-Id: <20060913.072847.38716404.kkojima@rr.iij4u.or.jp> To: libc-hacker@sources.redhat.com Subject: [PATCH] SH: nptl fixups From: Kaz Kojima X-Mailer: Mew version 3.3 on Emacs 21.4 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2006-09/txt/msg00020.txt.bz2 Hi, The attached patch updates SH port of nptl according to the recent updates for x86. Regards, kaz -- 2006-09-12 Kaz Kojima * sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S: For PI mutexes wake all mutexes. * sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Don't increment WAKEUP_SEQ if this would increase the value beyond TOTAL_SEQ. * sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S: Likewise. diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S 2004-06-18 08:55:20.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S 2006-09-09 09:58:52.000000000 +0900 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -20,6 +20,7 @@ #include #include #include +#include #include "lowlevel-atomic.h" #define SYS_futex 240 @@ -98,6 +99,11 @@ __pthread_cond_broadcast: bt/s 9f add #cond_futex, r4 + /* XXX: The kernel so far doesn't support requeue to PI futex. */ + mov.l @(MUTEX_KIND,r9), r0 + tst #PI_BIT, r0 + bf 9f + /* Wake up all threads. */ mov #FUTEX_CMP_REQUEUE, r5 mov #1, r6 diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S 2004-10-26 04:06:13.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S 2006-09-09 10:58:42.000000000 +0900 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -521,6 +521,21 @@ __condvar_tw_cleanup: mov #1, r2 mov #0, r3 + /* We increment the wakeup_seq counter only if it is lower than + total_seq. If this is not the case the thread was woken and + then canceled. In this case we ignore the signal. */ + mov.l @(total_seq+4,r8), r0 + mov.l @(wakeup_seq+4,r8), r1 + cmp/hi r1, r0 + bt/s 6f + cmp/hi r0, r1 + bt 7f + mov.l @(total_seq,r8), r0 + mov.l @(wakeup_seq,r8), r1 + cmp/hs r0, r1 + bt 7f + +6: clrt mov.l @(wakeup_seq,r8),r0 mov.l @(wakeup_seq+4,r8),r1 @@ -532,6 +547,7 @@ __condvar_tw_cleanup: add r2, r0 mov.l r0,@(cond_futex,r8) +7: clrt mov.l @(woken_seq,r8),r0 mov.l @(woken_seq+4,r8),r1 diff -uprN ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S --- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S 2004-09-11 06:18:06.000000000 +0900 +++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S 2006-09-09 10:58:12.000000000 +0900 @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -385,6 +385,21 @@ __condvar_w_cleanup: mov #1, r2 mov #0, r3 + /* We increment the wakeup_seq counter only if it is lower than + total_seq. If this is not the case the thread was woken and + then canceled. In this case we ignore the signal. */ + mov.l @(total_seq+4,r8), r0 + mov.l @(wakeup_seq+4,r8), r1 + cmp/hi r1, r0 + bt/s 6f + cmp/hi r0, r1 + bt 7f + mov.l @(total_seq,r8), r0 + mov.l @(wakeup_seq,r8), r1 + cmp/hs r0, r1 + bt 7f + +6: clrt mov.l @(wakeup_seq,r8),r0 mov.l @(wakeup_seq+4,r8),r1 @@ -396,6 +411,7 @@ __condvar_w_cleanup: add r2, r0 mov.l r0,@(cond_futex,r8) +7: clrt mov.l @(woken_seq,r8),r0 mov.l @(woken_seq+4,r8),r1