Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Jan 2018 00:39:50 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328457 - head/lib/libc/mips/gen
Message-ID:  <201801270039.w0R0dodu007283@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Sat Jan 27 00:39:49 2018
New Revision: 328457
URL: https://svnweb.freebsd.org/changeset/base/328457

Log:
  Clarify some comments in the MIPS makecontext().
  
  - N32 and N64 do not have a $a0-3 gap.
  - Use 'sp += 4' to skip over the gap for O32 rather than '+= i'.  It
    doesn't make a functional change, but makes the code match the comment.
  
  Sponsored by:	DARPA / AFRL

Modified:
  head/lib/libc/mips/gen/makecontext.c

Modified: head/lib/libc/mips/gen/makecontext.c
==============================================================================
--- head/lib/libc/mips/gen/makecontext.c	Sat Jan 27 00:09:43 2018	(r328456)
+++ head/lib/libc/mips/gen/makecontext.c	Sat Jan 27 00:39:49 2018	(r328457)
@@ -95,19 +95,18 @@ __makecontext(ucontext_t *ucp, void (*func)(void), int
 	for (i = 0; i < argc && i < 4; i++)
 		/* LINTED register_t is safe */
 		mc->mc_regs[A0 + i] = va_arg(ap, register_t);
-	/* Pass remaining arguments on the stack above the $a0-3 gap. */
-	sp += i;
+	/* Skip over the $a0-3 gap. */
+	sp += 4;
 #endif
 #if defined(__mips_n32) || defined(__mips_n64)
 	/* Up to the first 8 arguments are passed in $a0-7. */
 	for (i = 0; i < argc && i < 8; i++)
 		/* LINTED register_t is safe */
 		mc->mc_regs[A0 + i] = va_arg(ap, register_t);
-	/* Pass remaining arguments on the stack above the $a0-3 gap. */
 #endif
-	/* Pass remaining arguments on the stack above the $a0-3 gap. */
+	/* Pass remaining arguments on the stack. */
 	for (; i < argc; i++)
-		/* LINTED uintptr_t is safe */
+		/* LINTED register_t is safe */
 		*sp++ = va_arg(ap, register_t);
 	va_end(ap);
 }



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