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>
This commit is contained in:
Corinna Vinschen 2015-07-17 16:47:14 +02:00
parent b3ccf998cc
commit 16d2d9f131
2 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,10 @@
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

View File

@ -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. */