Date: Wed, 3 Sep 2003 17:20:40 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/lib/libc/i386/sys Makefile.inc getcontext.S Message-ID: <200309040020.h840KemE039969@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
peter 2003/09/03 17:20:40 PDT FreeBSD src repository Modified files: lib/libc/i386/sys Makefile.inc Added files: lib/libc/i386/sys getcontext.S Log: Make getcontext(2) work on i386. It needs a small wrapper in libc otherwise the return from the syscall stub for getcontext will pop off the return value for the caller to the getcontext stub and it will appear as though the setcontext() syscall returned instead of the getcontext(). The same bug exists on amd64, a fix is coming there too. The bug can be demonstrated with this test code fragment: main() { ucontext_t top; if (getcontext(&top) == 0) { write(2, "PING!\n", 6); /* Cause a return value of 1 from getcontext this time */ top.uc_mcontext.mc_eax = 1; setcontext(&top); err(1, "setcontext() returned"); } write(2, "PONG!\n", 6); _exit(0); } Revision Changes Path 1.27 +2 -2 src/lib/libc/i386/sys/Makefile.inc 1.1 +50 -0 src/lib/libc/i386/sys/getcontext.S (new)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309040020.h840KemE039969>