From 3f6ad1541f30e14fda5488e47e3774dd6fb10b9a Mon Sep 17 00:00:00 2001 From: Marco S Hyman Date: Tue, 18 Dec 2001 03:47:53 +0000 Subject: Allow the scheduler to return to the signal handler and the signal handler to return instead of calling sigreturn directly. This works around an apparent bug in sparc sigreturn handling. ok fgs@ and noone else has bitched --- lib/libpthread/uthread/uthread_kern.c | 9 +++++++-- lib/libpthread/uthread/uthread_sig.c | 18 ++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) (limited to 'lib/libpthread/uthread') diff --git a/lib/libpthread/uthread/uthread_kern.c b/lib/libpthread/uthread/uthread_kern.c index d9a6108397b..c055b61cb39 100644 --- a/lib/libpthread/uthread/uthread_kern.c +++ b/lib/libpthread/uthread/uthread_kern.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_kern.c,v 1.17 2001/12/08 14:51:36 fgsch Exp $ */ +/* $OpenBSD: uthread_kern.c,v 1.18 2001/12/18 03:47:52 marc Exp $ */ /* * Copyright (c) 1995-1998 John Birrell * All rights reserved. @@ -546,7 +546,12 @@ _thread_kern_sched(struct sigcontext * scp) PTHREAD_CANCEL_ASYNCHRONOUS) != 0)) pthread_testcancel(); - _thread_sys_sigreturn(&_thread_run->saved_sigcontext); + /* return to signal handler. This code + should be: + _thread_sys_sigreturn(&_thread_run->saved_sigcontext); + but that doesn't currently work on the + sparc */ + return; } else { /* * This is the normal way out of the scheduler. diff --git a/lib/libpthread/uthread/uthread_sig.c b/lib/libpthread/uthread/uthread_sig.c index c13d2050441..2755ba4747a 100644 --- a/lib/libpthread/uthread/uthread_sig.c +++ b/lib/libpthread/uthread/uthread_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_sig.c,v 1.10 2001/11/05 22:53:28 marc Exp $ */ +/* $OpenBSD: uthread_sig.c,v 1.11 2001/12/18 03:47:52 marc Exp $ */ /* * Copyright (c) 1995-1998 John Birrell * All rights reserved. @@ -93,11 +93,17 @@ _thread_sig_handler(int sig, int code, struct sigcontext * scp) */ _thread_kern_sched(scp); - /* - * This point should not be reached, so abort the - * process: - */ - PANIC("Returned to signal function from scheduler"); + /* The scheduler currently returns here instead + of calling sigreturn due to a sparc sigreturn + bug. We should also return. That brings + us back to the sigtramp code which will + sigreturn to the context stored on the current + stack (which is the same as scp, above). + The code originally did this: + + PANIC("Returned to signal function from scheduler"); + */ + return; } } /* -- cgit v1.2.3