public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Kaz Kojima <kkojima@rr.iij4u.or.jp>
To: libc-hacker@sources.redhat.com
Subject: [PATCH] SH nptl tidyup
Date: Mon, 21 Jan 2008 23:46:00 -0000	[thread overview]
Message-ID: <20080122.084546.104036843.kkojima@rr.iij4u.or.jp> (raw)

Hi,

Here is another nptl patch for SH to sync with the recent change
of sem_post.

Regards,
        kaz
-
2008-01-22  Kaz Kojima  <kkojima@rr.iij4u.or.jp>

	* sysdeps/unix/sysv/linux/sh/sem_post.S: Don't overflow value field.

--- ORIG/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S	2007-08-04 09:57:14.000000000 +0900
+++ LOCAL/libc/nptl/sysdeps/unix/sysv/linux/sh/sem_post.S	2008-01-22 08:27:18.000000000 +0900
@@ -30,8 +30,16 @@
 	.type	__new_sem_post,@function
 	.align	5
 __new_sem_post:
-	mov	#1, r3
-	XADD (r3, @(VALUE,r4), r2, r5)
+	mov.l	@(VALUE,r4), r2
+0:
+	mov.l	.Lmax, r1
+	cmp/eq	r1, r2
+	bt/s	3f
+	 mov	r2, r3
+	mov	r3, r5
+	add	#1, r5
+	CMPXCHG (r3, @(VALUE,r4), r5, r2)
+	bf	0b
 	mov.l	@(NWAITERS,r4), r2
 	tst	r2, r2
 	bt	2f
@@ -52,7 +60,15 @@ __new_sem_post:
 	 mov	#0, r0
 
 1:
-	mov	#EINVAL, r2
+	bra	4f
+	 mov	#EINVAL, r2
+
+3:
+	mov	#EOVERFLOW, r2
+4:	
+	mov.l	r12, @-r15
+	mov.l	r8, @-r15
+	sts.l	pr, @-r15
 	mova	.Lgot3, r0
 	mov.l	.Lgot3, r12
 	add	r0, r12
@@ -67,19 +83,24 @@ __new_sem_post:
 .Lerrno3:
 	.long	errno@GOTTPOFF
 .Lexit:
+	mov.l	r2, @r0
 #else
+	mov	r2, r8
 	mov.l	.Lerrloc3, r1
 	bsrf	r1
 	 nop
 .Lerrloc3b:
+	mov	r8, @r0
 #endif
-	mov.l	r2, @r0
 	lds.l	@r15+, pr
+	mov.l	@r15+, r8
 	mov.l	@r15+, r12
 	rts
 	 mov	#-1, r0
 
 	.align	2
+.Lmax:
+	.long	SEM_VALUE_MAX
 .Lgot3:
 	.long	_GLOBAL_OFFSET_TABLE_
 #if !USE___THREAD

             reply	other threads:[~2008-01-21 23:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-21 23:46 Kaz Kojima [this message]
2008-01-22 18:31 ` Ulrich Drepper
  -- strict thread matches above, loose matches on Subject: below --
2009-01-14  3:49 Kaz Kojima
2009-01-28 16:10 ` Ulrich Drepper
2008-12-04  4:01 Kaz Kojima
2008-12-05 22:06 ` Ulrich Drepper
2008-12-05 23:49   ` Kaz Kojima
2007-12-04  4:14 Kaz Kojima

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080122.084546.104036843.kkojima@rr.iij4u.or.jp \
    --to=kkojima@rr.iij4u.or.jp \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).