Date: Sun, 9 Nov 2003 14:17:36 -0800 (PST) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/ia64/ia64 machdep.c syscall.S src/sys/ia64/include ucontext.h Message-ID: <200311092217.hA9MHaNp038909@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
marcel 2003/11/09 14:17:36 PST FreeBSD src repository Modified files: sys/ia64/ia64 machdep.c syscall.S sys/ia64/include ucontext.h Log: Use get_mcontext() to construct the signal context in sendsig() and use set_mcontext() to restore the context in sigreturn(). Since we put the syscall number and the syscall arguments in the trapframe (we don't save the scratch registers for syscalls, which allows us to reuse the space to our advantage), create a MD specific flag so that we save the scratch registers even for syscalls. We would not be able to restart a syscall otherwise. The signal trampoline does not need to flush the regiters anymore, because get_mcontext() already handles that. In fact, if we set up the context correctly, we do not need to have a trampoline at all. This change however only minimally changes the trampoline code. In follow-up commits this can be further optimized. Note that normally we preserve cfm and iip in the trapframe created by the EPC syscall path when we restore a context in set_mcontext() because those fields are not normally set for a synchronuous context. The kernel puts the return address and frame info of the syscall stub in there. By preserving these fields we hide this detail from userland which allows us to use setcontext(2) for user created contexts. However, sigreturn() is commonly called from the trampoline, which means that if we preserve cfm and iip in all cases, we would return to the trampoline after the sigreturn(), which means we hit the safety net: we call exit(2). So, we do not preserve cfm and iip when we have a synchronous context that also has scratch registers (the uncommon context created by sendsig() only), under the assumption that if such a context is created in userland, something special is going on and the use of cfm and iip is then just another quirk. All this is invisible in the common case. Revision Changes Path 1.165 +34 -72 src/sys/ia64/ia64/machdep.c 1.10 +10 -36 src/sys/ia64/ia64/syscall.S 1.6 +6 -1 src/sys/ia64/include/ucontext.h
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311092217.hA9MHaNp038909>