[PATCH] D38819: [libunwind] Add support for dwarf unwinding on windows on x86_64

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 25 14:13:21 PDT 2017

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?


More information about the cfe-commits mailing list