Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update.
2003-12-18  Ulrich Drepper  <drepper@redhat.com>

	* tst-eintr1.c: Better error messages.

	* Makefile (tests): Add tst-eintr2.
	* tst-eintr2.c: New file.

2003-12-18  Jakub Jelinek  <jakub@redhat.com>

	* Makefile (tests): Add tst-cancel21 and tst-cancelx21.
	(CFLAGS-tst-cancelx21.c): Set.
	* tst-cancel21.c: New test.
	* tst-cancelx21.c: New test.

	* unwind.c (FRAME_LEFT): Add adj argument.  Subtract it from each
	comparison operand.
	(unwind_stop): Use _JMPBUF_CFA_UNWINDS_ADJ macro instead of
	_JMPBUF_CFA_UNWINDS.  Adjust FRAME_LEFT invocations.
	* pt-longjmp.c: Include jmpbuf-unwind.h.
	(__pthread_cleanup_upto): Use _JMPBUF_UNWINDS_ADJ macro instead of
	_JMPBUF_UNWINDS.  Adjust compared pointers.
	* init.c (__pthread_initialize_minimal_internal): Initialize
	pd->stackblock_size.
	* sysdeps/pthread/jmpbuf-unwind.h: Removed.
	* sysdeps/alpha/jmpbuf-unwind.h: New file.
	* sysdeps/i386/jmpbuf-unwind.h: New file.
	* sysdeps/powerpc/jmpbuf-unwind.h: New file.
	* sysdeps/s390/jmpbuf-unwind.h: New file.
	* sysdeps/sh/jmpbuf-unwind.h: New file.
	* sysdeps/sparc/sparc32/jmpbuf-unwind.h: New file.
	* sysdeps/x86_64/jmpbuf-unwind.h: New file.
	* sysdeps/ia64/jmpbuf-unwind.h: Include stdint.h.
	(_JMPBUF_CFA_UNWINDS): Remove.
	(_JMPBUF_CFA_UNWINDS_ADJ, _JMPBUF_UNWINDS_ADJ): Define.

2003-12-12  Jakub Jelinek  <jakub@redhat.com>

	* Makefile (tests): Add tst-cancel20 and tst-cancelx20.
	(CFLAGS-tst-cancelx20.c): Set.
	* tst-cancel20.c: New test.
	* tst-cancelx20.c: New test.
  • Loading branch information
Ulrich Drepper committed Dec 19, 2003
1 parent 3434f15 commit 675620f
Show file tree
Hide file tree
Showing 19 changed files with 953 additions and 25 deletions.
42 changes: 42 additions & 0 deletions nptl/ChangeLog
@@ -1,3 +1,45 @@
2003-12-18 Ulrich Drepper <drepper@redhat.com>

* tst-eintr1.c: Better error messages.

* Makefile (tests): Add tst-eintr2.
* tst-eintr2.c: New file.

2003-12-18 Jakub Jelinek <jakub@redhat.com>

* Makefile (tests): Add tst-cancel21 and tst-cancelx21.
(CFLAGS-tst-cancelx21.c): Set.
* tst-cancel21.c: New test.
* tst-cancelx21.c: New test.

* unwind.c (FRAME_LEFT): Add adj argument. Subtract it from each
comparison operand.
(unwind_stop): Use _JMPBUF_CFA_UNWINDS_ADJ macro instead of
_JMPBUF_CFA_UNWINDS. Adjust FRAME_LEFT invocations.
* pt-longjmp.c: Include jmpbuf-unwind.h.
(__pthread_cleanup_upto): Use _JMPBUF_UNWINDS_ADJ macro instead of
_JMPBUF_UNWINDS. Adjust compared pointers.
* init.c (__pthread_initialize_minimal_internal): Initialize
pd->stackblock_size.
* sysdeps/pthread/jmpbuf-unwind.h: Removed.
* sysdeps/alpha/jmpbuf-unwind.h: New file.
* sysdeps/i386/jmpbuf-unwind.h: New file.
* sysdeps/powerpc/jmpbuf-unwind.h: New file.
* sysdeps/s390/jmpbuf-unwind.h: New file.
* sysdeps/sh/jmpbuf-unwind.h: New file.
* sysdeps/sparc/sparc32/jmpbuf-unwind.h: New file.
* sysdeps/x86_64/jmpbuf-unwind.h: New file.
* sysdeps/ia64/jmpbuf-unwind.h: Include stdint.h.
(_JMPBUF_CFA_UNWINDS): Remove.
(_JMPBUF_CFA_UNWINDS_ADJ, _JMPBUF_UNWINDS_ADJ): Define.

2003-12-12 Jakub Jelinek <jakub@redhat.com>

* Makefile (tests): Add tst-cancel20 and tst-cancelx20.
(CFLAGS-tst-cancelx20.c): Set.
* tst-cancel20.c: New test.
* tst-cancelx20.c: New test.

2003-12-17 Ulrich Drepper <drepper@redhat.com>

* init.c (__pthread_initialize_minimal_internal): Don't treat
Expand Down
11 changes: 7 additions & 4 deletions nptl/Makefile
Expand Up @@ -207,15 +207,16 @@ tests = tst-attr1 tst-attr2 tst-attr3 \
tst-kill1 tst-kill2 tst-kill3 tst-kill4 tst-kill5 tst-kill6 \
tst-join1 tst-join2 tst-join3 tst-join4 tst-join5 \
tst-detach1 \
tst-eintr1 \
tst-eintr1 tst-eintr2 \
tst-tsd1 tst-tsd2 tst-tsd3 tst-tsd4 \
tst-tls1 tst-tls2 \
tst-fork1 tst-fork2 tst-fork3 tst-fork4 \
tst-atfork1 \
tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel4 tst-cancel5 \
tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 \
tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
tst-cancel21 \
tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
tst-flock1 tst-flock2 \
tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
Expand Down Expand Up @@ -246,8 +247,8 @@ include ../Makeconfig
ifeq ($(have-forced-unwind),yes)
tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \
tst-cancelx6 tst-cancelx7 tst-cancelx8 tst-cancelx9 tst-cancelx10 \
tst-cancelx11 tst-cancelx12 tst-cancelx13 tst-cancelx14 tst-cancelx15\
tst-cancelx16 tst-cancelx17 tst-cancelx18 \
tst-cancelx11 tst-cancelx12 tst-cancelx13 tst-cancelx14 tst-cancelx15 \
tst-cancelx16 tst-cancelx17 tst-cancelx18 tst-cancelx20 tst-cancelx21 \
tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 \
tst-oncex3 tst-oncex4
endif
Expand Down Expand Up @@ -388,6 +389,8 @@ CFLAGS-tst-cancelx15.c += -fexceptions
CFLAGS-tst-cancelx16.c += -fexceptions
CFLAGS-tst-cancelx17.c += -fexceptions
CFLAGS-tst-cancelx18.c += -fexceptions
CFLAGS-tst-cancelx20.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-tst-cancelx21.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-tst-cleanupx0.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-tst-cleanupx1.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-tst-cleanupx2.c += -fexceptions
Expand Down
8 changes: 8 additions & 0 deletions nptl/init.c
Expand Up @@ -217,6 +217,14 @@ __pthread_initialize_minimal_internal (void)
THREAD_SETMEM (pd, cpuclock_offset, GL(dl_cpuclock_offset));
#endif

/* Defined in ld.so. */
extern void *__libc_stack_end;

/* Set initial thread's stack block from 0 up to __libc_stack_end.
It will be bigger than it actually is, but for unwind.c/pt-longjmp.c
purposes this is good enough. */
THREAD_SETMEM (pd, stackblock_size, (size_t) __libc_stack_end);

/* Initialize the list of all running threads with the main thread. */
INIT_LIST_HEAD (&__stack_user);
list_add (&pd->list, &__stack_user);
Expand Down
14 changes: 10 additions & 4 deletions nptl/pt-longjmp.c
Expand Up @@ -20,26 +20,32 @@
#include <setjmp.h>
#include <stdlib.h>
#include "pthreadP.h"

#include "jmpbuf-unwind.h"

void
__pthread_cleanup_upto (__jmp_buf target, char *targetframe)
{
struct pthread *self = THREAD_SELF;
struct _pthread_cleanup_buffer *cbuf;

/* Adjust all pointers used in comparisons, so that top of thread's
stack is at the top of address space. Without that, things break
if stack is allocated above the main stack. */
uintptr_t adj = (uintptr_t) self->stackblock + self->stackblock_size;
uintptr_t targetframe_adj = (uintptr_t) targetframe - adj;

for (cbuf = THREAD_GETMEM (self, cleanup);
cbuf != NULL && _JMPBUF_UNWINDS (target, cbuf);
cbuf != NULL && _JMPBUF_UNWINDS_ADJ (target, cbuf, adj);
cbuf = cbuf->__prev)
{
#if _STACK_GROWS_DOWN
if ((char *) cbuf <= targetframe)
if ((uintptr_t) cbuf - adj <= targetframe_adj)
{
cbuf = NULL;
break;
}
#elif _STACK_GROWS_UP
if ((char *) cbuf >= targetframe)
if ((uintptr_t) cbuf - adj >= targetframe_adj)
{
cbuf = NULL;
break;
Expand Down
Expand Up @@ -18,7 +18,11 @@
02111-1307 USA. */

#include <setjmp.h>
#include <stdint.h>
#include <unwind.h>

#define _JMPBUF_CFA_UNWINDS(_jmpbuf, _context) \
_JMPBUF_UNWINDS (_jmpbuf, (void *) _Unwind_GetCFA (_context))
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)

#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj))
28 changes: 28 additions & 0 deletions nptl/sysdeps/i386/jmpbuf-unwind.h
@@ -0,0 +1,28 @@
/* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <setjmp.h>
#include <stdint.h>
#include <unwind.h>

#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)

#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj))
28 changes: 28 additions & 0 deletions nptl/sysdeps/powerpc/jmpbuf-unwind.h
@@ -0,0 +1,28 @@
/* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <setjmp.h>
#include <stdint.h>
#include <unwind.h>

#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)

#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_GPR1] - (_adj))
29 changes: 29 additions & 0 deletions nptl/sysdeps/s390/jmpbuf-unwind.h
@@ -0,0 +1,29 @@
/* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <setjmp.h>
#include <stdint.h>
#include <unwind.h>

#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)

#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) \
< (uintptr_t) (_jmpbuf)->__gregs[__JB_GPR15] - (_adj))
28 changes: 28 additions & 0 deletions nptl/sysdeps/sh/jmpbuf-unwind.h
@@ -0,0 +1,28 @@
/* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <setjmp.h>
#include <stdint.h>
#include <unwind.h>

#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)

#define _JMPBUF_UNWINDS_ADJ(jmpbuf, address, adj) \
((uintptr_t) (address) - (adj) < (uintptr_t) (_jmpbuf)[0].__regs[7] - (adj))
28 changes: 28 additions & 0 deletions nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h
@@ -0,0 +1,28 @@
/* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <setjmp.h>
#include <stdint.h>
#include <unwind.h>

#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)

#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj))
16 changes: 10 additions & 6 deletions nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h
Expand Up @@ -18,12 +18,16 @@
02111-1307 USA. */

#include <setjmp.h>
#include <stdint.h>
#include <unwind.h>

#define _JMPBUF_CFA_UNWINDS(_jmpbuf, _context) \
({ void *_cfa = (void *) _Unwind_GetCFA (_context); \
(_cfa < (void *)(((long *)(_jmpbuf))[0]) \
|| (_cfa == (void *)(((long *)(_jmpbuf))[0]) \
&& (void *) _Unwind_GetBSP (_context) \
>= (void *)(((long *)(_jmpbuf))[17]))); \
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
({ uintptr_t _cfa = (uintptr_t) _Unwind_GetCFA (_context) - (_adj); \
(_cfa < (uintptr_t)(((long *)(_jmpbuf))[0]) - (_adj) \
|| (_cfa == (uintptr_t)(((long *)(_jmpbuf))[0]) - (_adj) \
&& (uintptr_t) _Unwind_GetBSP (_context) - (_adj) \
>= (uintptr_t)(((long *)(_jmpbuf))[17]) - (_adj))); \
})

#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t)(_address) - (_adj) < (uintptr_t)(((long *)_jmpbuf)[0]) - (_adj))
28 changes: 28 additions & 0 deletions nptl/sysdeps/x86_64/jmpbuf-unwind.h
@@ -0,0 +1,28 @@
/* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <setjmp.h>
#include <stdint.h>
#include <unwind.h>

#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)

#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_RSP] - (_adj))

0 comments on commit 675620f

Please sign in to comment.