Date: Tue, 1 Apr 2003 18:42:30 -0500 (EST) From: Daniel Eischen <eischen@pcnet1.pcnet.com> To: Jake Burkholder <jake@FreeBSD.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/kern kern_context.c Message-ID: <Pine.GSO.4.10.10304011827200.9020-100000@pcnet1.pcnet.com> In-Reply-To: <200304012325.h31NPI3p086961@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 1 Apr 2003, Jake Burkholder wrote: > jake 2003/04/01 15:25:18 PST > > FreeBSD src repository > > Modified files: > sys/kern kern_context.c > Log: > - Fix UC_COPY_SIZE. Adding up the size of structure fields doesn't take > alignment into account. > - Return EJUSTRETURN from set_context on success to avoid clobbering the > first 2 out registers with td_retval on sparc64. Oh shit. I forgot I have some local changes lying around to fix being able to set/swapcontext on an interrupted context (not formed by getcontext). When getcontext() is called, the return value registers need to be cleared so that 0 is returned after a subsequent setcontext(): ret = getcontext(&uc); ... setcontext(&uc); The above should work as well as: void sighandler(int sig, siginfo_t *info, ucontext_t *ucp) { ... setcontext(ucp); } The latter case doesn't want to return 0 in the syscall; it wants to return EJUSTRETURN. In the former case, you need to be able to return 0. I think you need to fix get_mcontext() so that it clears the return values or it breaks the first case. My changes add a third parameter to get_mcontext(struct thread *td, mcontext_t *mcp, int clear_retval) so that you can tell it to clear the return values. When getcontext() calls get_mcontext() you want to clear the return values in the context, but when get_mcontext() is called by sendsig() or by the KSE system, you don't want to clear the return values. Is this making any sense? -- Dan Eischen
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10304011827200.9020-100000>