github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/runtime/asm_amd64_windows.S (about)

     1  .section .text.tinygo_scanCurrentStack,"ax"
     2  .global tinygo_scanCurrentStack
     3  tinygo_scanCurrentStack:
     4      // Save callee-saved registers.
     5      pushq %rbx
     6      pushq %rbp
     7      pushq %rdi
     8      pushq %rsi
     9      pushq %r12
    10      pushq %r13
    11      pushq %r14
    12      pushq %r15
    13  
    14      // Scan the stack.
    15      subq $8, %rsp // adjust the stack before the call to maintain 16-byte alignment
    16      movq %rsp, %rdi
    17      callq tinygo_scanstack
    18  
    19      // Restore the stack pointer. Registers do not need to be restored as they
    20      // were only pushed to be discoverable by the GC.
    21      addq $72, %rsp
    22      retq
    23  
    24  .section .text.tinygo_longjmp,"ax"
    25  .global tinygo_longjmp
    26  tinygo_longjmp:
    27      // Note: the code we jump to assumes rax is set to a non-zero value if we
    28      // jump from here, so we use rax as the temporary value for jumpPC.
    29      movq 0(%rcx), %rsp // jumpSP
    30      movq 8(%rcx), %rax // jumpPC
    31      jmpq *%rax