Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 07 Jan 2002 21:56:28 -0500
From:      Dan Eischen <eischen@vigrid.com>
To:        arch@freebsd.org
Subject:   Getcontext resolution?
Message-ID:  <3C3A5FDC.23866673@vigrid.com>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C3A5FDC.23866673>