From owner-cvs-src@FreeBSD.ORG Wed Sep 3 17:20:41 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C122516A4BF; Wed, 3 Sep 2003 17:20:41 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5EB8543FEA; Wed, 3 Sep 2003 17:20:41 -0700 (PDT) (envelope-from peter@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h840Ke0U039973; Wed, 3 Sep 2003 17:20:40 -0700 (PDT) (envelope-from peter@repoman.freebsd.org) Received: (from peter@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h840KemE039969; Wed, 3 Sep 2003 17:20:40 -0700 (PDT) Message-Id: <200309040020.h840KemE039969@repoman.freebsd.org> From: Peter Wemm Date: Wed, 3 Sep 2003 17:20:40 -0700 (PDT) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/lib/libc/i386/sys Makefile.inc getcontext.S X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Sep 2003 00:20:42 -0000 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)