2013-10-22 17:08:15 +02:00
|
|
|
#include "namespace.h"
|
|
|
|
|
2011-02-17 18:11:09 +01:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#include <lib.h>
|
|
|
|
|
2013-11-04 22:48:08 +01:00
|
|
|
#include <string.h>
|
2013-12-11 00:47:22 +01:00
|
|
|
#include <assert.h>
|
2011-02-17 18:11:09 +01:00
|
|
|
#include <signal.h>
|
2013-10-22 17:08:15 +02:00
|
|
|
#include <string.h>
|
2011-02-17 18:11:09 +01:00
|
|
|
#include <sys/signal.h>
|
2013-10-22 17:08:15 +02:00
|
|
|
#include <machine/signal.h>
|
2011-02-17 18:11:09 +01:00
|
|
|
|
2013-10-22 17:08:15 +02:00
|
|
|
int sigreturn(struct sigcontext *scp)
|
2011-02-17 18:11:09 +01:00
|
|
|
{
|
|
|
|
sigset_t set;
|
|
|
|
|
|
|
|
/* The message can't be on the stack, because the stack will vanish out
|
2013-11-01 13:34:14 +01:00
|
|
|
* from under us. The send part of ipc_sendrec will succeed, but when
|
2011-02-17 18:11:09 +01:00
|
|
|
* a message is sent to restart the current process, who knows what will
|
|
|
|
* be in the place formerly occupied by the message?
|
|
|
|
*/
|
|
|
|
static message m;
|
|
|
|
|
|
|
|
/* Protect against race conditions by blocking all interrupts. */
|
|
|
|
sigfillset(&set); /* splhi */
|
2014-05-13 18:29:11 +02:00
|
|
|
sigprocmask(SIG_SETMASK, &set, NULL);
|
2011-02-17 18:11:09 +01:00
|
|
|
|
2013-11-04 22:48:08 +01:00
|
|
|
memset(&m, 0, sizeof(m));
|
2014-05-13 18:29:11 +02:00
|
|
|
m.m_lc_pm_sigset.set = scp->sc_mask;
|
|
|
|
m.m_lc_pm_sigset.ctx = (vir_bytes)scp;
|
2013-11-04 22:48:08 +01:00
|
|
|
return(_syscall(PM_PROC_NR, PM_SIGRETURN, &m)); /* normally doesn't return */
|
2011-02-17 18:11:09 +01:00
|
|
|
}
|