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);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to