mstorsjo added inline comments.

================
Comment at: src/UnwindRegistersRestore.S:72
+  movq  56(%rcx), %rax # rax holds new stack pointer
+  subq  $16, %rax
+  movq  %rax, 56(%rcx)
----------------
mstorsjo wrote:
> compnerd wrote:
> > Hmm, why is this `$16`?  The `$rsp` was adjusted by `$8` in the `setjmp`.
> This is the exact same thing as is done right now for x86_64 on unixy systems 
> already, just with different registers.
> 
> The adjustment by 16 bytes is because we store `rcx` and `rip` on the stack 
> here to restore them slightly differently than the others. See the `store new 
> rcx/rip on new stack`, `restore rcx later` and `rcx was saved here earlier` 
> and `rip was saved here` comments below.
Instead of duplicating the asm for the win64 and unix calling convention, I can 
also pretty easily template it using the cpp, using a define for whatever 
register holds the context pointer from the first function argument. Would that 
be better, or is it clearer just to have it typed out in both forms literally?


https://reviews.llvm.org/D38819



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to