From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10896 invoked by alias); 6 Jul 2007 21:53:02 -0000 Received: (qmail 10880 invoked by uid 22791); 6 Jul 2007 21:53:02 -0000 X-Spam-Check-By: sourceware.org Received: from mo10.iij4u.or.jp (HELO mo10.iij4u.or.jp) (210.138.174.78) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 06 Jul 2007 21:52:53 +0000 Received: by mo.iij4u.or.jp (mo10) id l66LqnIX004029; Sat, 7 Jul 2007 06:52:49 +0900 Received: from localhost (238.152.138.210.bn.2iij.net [210.138.152.238]) by mbox.iij4u.or.jp (mbox11) id l66LqfJv020568; Sat, 7 Jul 2007 06:52:45 +0900 Date: Fri, 06 Jul 2007 21:53:00 -0000 Message-Id: <20070707.064950.23032416.kkojima@rr.iij4u.or.jp> To: libc-hacker@sources.redhat.com Subject: [PATCH] SH: Fix a few bugs 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-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00003.txt.bz2 Hi, The appended patch fixes a few embarrassing bug in SH port. sysdeps/sh/bsd-*setjmp.S uses wrong register for 2nd argument for __sigsetjmp call. sysdeps/unix/sysv/linux/sh/clone.S did a wrong sanity check when the first argument is zero. BTW, sysdeps/unix/sysv/linux/tst-clone.c tests only that clone fails with the null stack pointer argument. Should we add a check for the null child function pointer argument? Regards, kaz -- 2007-07-06 Kaz Kojima * sysdeps/sh/bsd-setjmp.S (setjmp): Use correct argument registers. * sysdeps/sh/bsd-_setjmp.S (_setjmp): Likewise. * sysdeps/unix/sysv/linux/sh/clone.S (__clone): Do correct sanity check for the first argument. diff -uprN ORIG/libc/sysdeps/sh/bsd-setjmp.S LOCAL/libc/sysdeps/sh/bsd-setjmp.S --- ORIG/libc/sysdeps/sh/bsd-setjmp.S 2001-07-06 13:56:03.000000000 +0900 +++ LOCAL/libc/sysdeps/sh/bsd-setjmp.S 2007-07-06 08:48:14.000000000 +0900 @@ -1,5 +1,5 @@ /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. SH version. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2007 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 @@ -36,14 +36,14 @@ ENTRY (setjmp) mov.l 3f, r1 mov.l @(r0,r1), r1 jmp @r1 - mov #1, r0 + mov #1, r5 .align 2 3: .long C_SYMBOL_NAME(__sigsetjmp@GOT) #else mov.l 1f, r1 jmp @r1 - mov #1, r0 + mov #1, r5 .align 2 1: .long C_SYMBOL_NAME(__sigsetjmp) diff -uprN ORIG/libc/sysdeps/sh/bsd-_setjmp.S LOCAL/libc/sysdeps/sh/bsd-_setjmp.S --- ORIG/libc/sysdeps/sh/bsd-_setjmp.S 2003-01-01 05:37:25.000000000 +0900 +++ LOCAL/libc/sysdeps/sh/bsd-_setjmp.S 2007-07-06 08:48:13.000000000 +0900 @@ -1,5 +1,5 @@ /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. SH version. - Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2002, 2007 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 @@ -36,14 +36,14 @@ ENTRY (_setjmp) mov.l 3f, r1 mov.l @(r0,r1), r1 jmp @r1 - mov #0, r0 + mov #0, r5 .align 2 3: .long C_SYMBOL_NAME(__sigsetjmp@GOT) #else mov.l 1f, r1 jmp @r1 - mov #0, r0 + mov #0, r5 .align 2 1: .long C_SYMBOL_NAME(__sigsetjmp) diff -uprN ORIG/libc/sysdeps/unix/sysv/linux/sh/clone.S LOCAL/libc/sysdeps/unix/sysv/linux/sh/clone.S --- ORIG/libc/sysdeps/unix/sysv/linux/sh/clone.S 2004-12-08 04:37:51.000000000 +0900 +++ LOCAL/libc/sysdeps/unix/sysv/linux/sh/clone.S 2007-07-06 08:59:15.000000000 +0900 @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2000, 2003, 2004, 2007 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 @@ -32,12 +32,12 @@ ENTRY(__clone) /* sanity check arguments. */ tst r4, r4 - bf/s 1f + bt/s 0f tst r5, r5 - bf/s 1f - mov #-EINVAL,r0 + bf 1f +0: bra .Lsyscall_error - nop + mov #-EINVAL,r0 1: /* insert the args onto the new stack */ mov.l r7, @-r5