Exemplo n.º 1
0
int
setucontext32(struct lwp *l, const ucontext32_t *ucp)
{
	struct proc *p = l->l_proc;
	int error;

	KASSERT(mutex_owned(p->p_lock));

	if ((ucp->uc_flags & _UC_SIGMASK) != 0) {
		error = sigprocmask1(l, SIG_SETMASK, &ucp->uc_sigmask, NULL);
		if (error != 0)
			return error;
	}

	mutex_exit(p->p_lock);
	error = cpu_setmcontext32(l, &ucp->uc_mcontext, ucp->uc_flags);
	mutex_enter(p->p_lock);
	if (error != 0)
		return (error);

	l->l_ctxlink = (void *)(intptr_t)ucp->uc_link;

	/*
	 * If there was stack information, update whether or not we are
	 * still running on an alternate signal stack.
	 */
	if ((ucp->uc_flags & _UC_STACK) != 0) {
		if (ucp->uc_stack.ss_flags & SS_ONSTACK)
			l->l_sigstk.ss_flags |= SS_ONSTACK;
		else
			l->l_sigstk.ss_flags &= ~SS_ONSTACK;
	}

	return 0;
}
Exemplo n.º 2
0
void
startlwp32(void *arg)
{
    ucontext32_t *uc = arg;
    lwp_t *l = curlwp;
    int error __diagused;

    error = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags);
    KASSERT(error == 0);

    kmem_free(uc, sizeof(ucontext32_t));
    userret(l, 0, 0);
}
Exemplo n.º 3
0
void
startlwp32(void *arg)
{
	ucontext32_t *uc = arg;
	lwp_t *l = curlwp;
	int error __diagused;

	error = cpu_setmcontext32(l, &uc->uc_mcontext, uc->uc_flags);
	KASSERT(error == 0);

	/* Note: we are freeing ucontext_t, not ucontext32_t. */
	kmem_free(arg, sizeof(ucontext_t));
	userret(l, 0, 0);
}
Exemplo n.º 4
0
/* 
 * Start a new LWP
 */
void
startlwp32(void *arg)
{
	ucontext32_t * const uc = arg;
	int error __diagused;

	error = cpu_setmcontext32(curlwp, &uc->uc_mcontext, uc->uc_flags);
	KASSERT(error == 0);

	// Even though this is a ucontext32_t, the space allocated was for a
	// full ucontext_t
	kmem_free(uc, sizeof(ucontext_t));
	userret(curlwp);
}