This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] Comment fixup


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=16d2d9f1312653daa9cb8d4cdb3a113e53f432ca

commit 16d2d9f1312653daa9cb8d4cdb3a113e53f432ca
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri Jul 17 16:47:14 2015 +0200

    Comment fixup
    
            * exceptions.cc (getcontext/x86_64): Drop comment on RtlCaptureContext.
            (swapcontext/x86_64): Fix comment yet again.
            (getcontext/i686): Move comment from x86_64 getcontext, slightly
            rearranged, to preceeding comment.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/ChangeLog     |  7 +++++++
 winsup/cygwin/exceptions.cc | 12 ++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 0537eea..65adef5 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,12 @@
 2015-07-17  Corinna Vinschen  <corinna@vinschen.de>
 
+	* exceptions.cc (getcontext/x86_64): Drop comment on RtlCaptureContext.
+	(swapcontext/x86_64): Fix comment yet again.
+	(getcontext/i686): Move comment from x86_64 getcontext, slightly
+	rearranged, to preceeding comment.
+
+2015-07-17  Corinna Vinschen  <corinna@vinschen.de>
+
 	* exceptions.cc (__unwind_single_frame): Move up in file to be
 	accessible from other places.  Move comment to getcontext.
 	(stack_info::walk): Call __unwind_single_frame in 64 bit case.  Fix
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 7e10ba9..6e9890e 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1886,11 +1886,6 @@ getcontext (ucontext_t *ucp)
   PCONTEXT ctx = (PCONTEXT) &ucp->uc_mcontext;
   ctx->ContextFlags = CONTEXT_FULL;
   RtlCaptureContext (ctx);
-  /* Amazing, but true:  On 32 bit, RtlCaptureContext returns the context
-     matching the caller of getcontext, so all we have to do is call it.
-     On 64 bit, RtlCaptureContext returns the exact context of its own
-     caller, so we have to unwind virtually by a single frame to get the
-     context of the caller of getcontext. */
   __unwind_single_frame (ctx);
   /* Successful getcontext is supposed to return 0.  If we don't set rax to 0
      here, there's a chance that code like this:
@@ -1911,8 +1906,8 @@ swapcontext (ucontext_t *oucp, const ucontext_t *ucp)
   PCONTEXT ctx = (PCONTEXT) &oucp->uc_mcontext;
   ctx->ContextFlags = CONTEXT_FULL;
   RtlCaptureContext (ctx);
-  /* See comments in getcontext. */
   __unwind_single_frame (ctx);
+  /* See comment in getcontext. */
   oucp->uc_mcontext.rax = 0;
   oucp->uc_sigmask = oucp->uc_mcontext.oldmask = _my_tls.sigmask;
   return setcontext (ucp);
@@ -1941,6 +1936,11 @@ __cont_link_context:			\n\
    the callee-saved registers, especially $ebx, are not changed by the calling
    function.  If so, makecontext/__cont_link_context would be broken.
 
+   Amazing, but true:  While on 64 bit RtlCaptureContext returns the exact
+   context of its own caller, as expected, on 32 bit RtlCaptureContext returns
+   the context of the callers caller.  So while we have to unwind another frame
+   on 64 bit, we can skip this step on 32 bit.
+
    Both functions are split into the first half in assembler, and the second
    half in C to allow easy access to _my_tls. */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]