From owner-freebsd-arch Mon Jan 7 18:48: 9 2002 Delivered-To: freebsd-arch@freebsd.org Received: from pcnet1.pcnet.com (pcnet1.pcnet.com [204.213.232.3]) by hub.freebsd.org (Postfix) with ESMTP id 9C71137B404 for ; Mon, 7 Jan 2002 18:48:06 -0800 (PST) Received: from vigrid.com (pm3-pt8.pcnet.net [206.105.29.82]) by pcnet1.pcnet.com (8.12.1/8.12.1) with ESMTP id g082kxrU014250; Mon, 7 Jan 2002 21:47:00 -0500 (EST) Message-ID: <3C3A5FDC.23866673@vigrid.com> Date: Mon, 07 Jan 2002 21:56:28 -0500 From: Dan Eischen X-Mailer: Mozilla 4.74 [en] (X11; U; FreeBSD 5.0-CURRENT i386) X-Accept-Language: en MIME-Version: 1.0 To: arch@freebsd.org Subject: Getcontext resolution? Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I'm incorporating Doug Rabson's comments. makecontext will allow passing pointers as arguments to the start function, and the argument count will not be passed as a parameter: void func_1(int a, ucontext_t *ucp, b) { /* a = 10, b = 20 */ } ... makecontext(ucp, func_1, 4, 10, ucp, 20); I'll also enable full save of the FP state in getcontext(). The optimized code will be commented out (i386 version): /* * XXX - Do we really need to save floating point registers? * * This is an explicit call to get the current context, so * shouldn't the caller be done with the floating point registers? * Contexts formed by involuntary switches, such as signal delivery, * should have floating point registers saved by the kernel. * * As of this writing, the kernel doesn't yet save the FPU state * on signal delivery, so a setcontext on the interrupted context * may yield incorrect results regardless. */ #if 0 fnstcw MC_FP_CW_OFFSET(%edx) /* save control word */ movl $UC_MC_VALID, MC_FLAGS_OFFSET(%edx) /* mcontext valid, no FP */ #else fnsave MC_FP_REGS_OFFSET(%edx) /* save FP regs */ movl $MC_FP_VALID, MC_FLAGS_OFFSET(%edx) /* mcontext and FP valid */ #endif We can enable the optimized code some time later. Is that OK with everyone? -- Dan Eischen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message