perlasm/x86_64-xlate.pl: clarify SEH coding guidelines.

(Imported from upstream's e1dbf7f431b996010844e220d3200cbf2122dbb3)

Change-Id: I71933922f597358790e8a4222e9d69c4b121bc19
Reviewed-on: https://boringssl-review.googlesource.com/13762
Commit-Queue: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
Adam Langley 2017-02-09 11:20:50 -08:00 committed by CQ bot account: commit-bot@chromium.org
parent 4229d26b7e
commit 314997902e

View File

@ -1087,6 +1087,7 @@ close STDOUT;
# movq -16(%rcx),%rbx # movq -16(%rcx),%rbx
# movq -8(%rcx),%r15 # movq -8(%rcx),%r15
# movq %rcx,%rsp # restore original rsp # movq %rcx,%rsp # restore original rsp
# magic_epilogue:
# ret # ret
# .size function,.-function # .size function,.-function
# #
@ -1099,11 +1100,16 @@ close STDOUT;
# EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
# CONTEXT *context,DISPATCHER_CONTEXT *disp) # CONTEXT *context,DISPATCHER_CONTEXT *disp)
# { ULONG64 *rsp = (ULONG64 *)context->Rax; # { ULONG64 *rsp = (ULONG64 *)context->Rax;
# if (context->Rip >= magic_point) # ULONG64 rip = context->Rip;
# { rsp = ((ULONG64 **)context->Rsp)[0]; #
# context->Rbp = rsp[-3]; # if (rip >= magic_point)
# context->Rbx = rsp[-2]; # { rsp = (ULONG64 *)context->Rsp;
# context->R15 = rsp[-1]; # if (rip < magic_epilogue)
# { rsp = (ULONG64 *)rsp[0];
# context->Rbp = rsp[-3];
# context->Rbx = rsp[-2];
# context->R15 = rsp[-1];
# }
# } # }
# context->Rsp = (ULONG64)rsp; # context->Rsp = (ULONG64)rsp;
# context->Rdi = rsp[1]; # context->Rdi = rsp[1];
@ -1195,13 +1201,12 @@ close STDOUT;
# instruction and reflecting it in finer grade unwind logic in handler. # instruction and reflecting it in finer grade unwind logic in handler.
# After all, isn't it why it's called *language-specific* handler... # After all, isn't it why it's called *language-specific* handler...
# #
# Attentive reader can notice that exceptions would be mishandled in # SE handlers are also involved in unwinding stack when executable is
# auto-generated "gear" epilogue. Well, exception effectively can't # profiled or debugged. Profiling implies additional limitations that
# occur there, because if memory area used by it was subject to # are too subtle to discuss here. For now it's sufficient to say that
# segmentation violation, then it would be raised upon call to the # in order to simplify handlers one should either a) offload original
# function (and as already mentioned be accounted to caller, which is # %rsp to stack (like discussed above); or b) if you have a register to
# not a problem). If you're still not comfortable, then define tail # spare for frame pointer, choose volatile one.
# "magic point" just prior ret instruction and have handler treat it...
# #
# (*) Note that we're talking about run-time, not debug-time. Lack of # (*) Note that we're talking about run-time, not debug-time. Lack of
# unwind information makes debugging hard on both Windows and # unwind information makes debugging hard on both Windows and