diff --git a/src/rt/arch/i386/morestack.S b/src/rt/arch/i386/morestack.S index 7a4c56aeb0b..6b2e55022c6 100644 --- a/src/rt/arch/i386/morestack.S +++ b/src/rt/arch/i386/morestack.S @@ -150,6 +150,9 @@ MORESTACK: movl %ecx, 16(%esp) movl %edx, 12(%esp) + // FIXME (1388): it's possible we also need to save/restore some + // SSE2 registers here, if floats-go-in-regs on x86+SSE2. Unclear. + // FIXME (1226): main is compiled with the split-stack prologue, // causing it to call __morestack, so we have to jump back out calll RUST_GET_TASK diff --git a/src/rt/arch/x86_64/morestack.S b/src/rt/arch/x86_64/morestack.S index 2b118e4a059..3f25f786b6c 100644 --- a/src/rt/arch/x86_64/morestack.S +++ b/src/rt/arch/x86_64/morestack.S @@ -61,6 +61,19 @@ MORESTACK: pushq %r8 pushq %r9 + pushq $0 // Alignment + pushq $0 // Alignment + + subq $128, %rsp + movdqa %xmm0, (%rsp) + movdqa %xmm1, 16(%rsp) + movdqa %xmm2, 32(%rsp) + movdqa %xmm3, 48(%rsp) + movdqa %xmm4, 64(%rsp) + movdqa %xmm5, 80(%rsp) + movdqa %xmm6, 96(%rsp) + movdqa %xmm7, 112(%rsp) + // Calculate the address of the stack arguments. // We have the base pointer, __morestack's return address, // and __morestack's caller's return address to skip @@ -72,7 +85,7 @@ MORESTACK: movq %r11, %rdx // Size of stack arguments movq %rax, %rsi // Address of stack arguments movq %r10, %rdi // The amount of stack needed - + #ifdef __APPLE__ call UPCALL_NEW_STACK #endif @@ -81,6 +94,19 @@ MORESTACK: #endif // Pop the saved arguments + movdqa (%rsp), %xmm0 + movdqa 16(%rsp), %xmm1 + movdqa 32(%rsp), %xmm2 + movdqa 48(%rsp), %xmm3 + movdqa 64(%rsp), %xmm4 + movdqa 80(%rsp), %xmm5 + movdqa 96(%rsp), %xmm6 + movdqa 112(%rsp), %xmm7 + addq $128, %rsp + + popq %r9 // Alignment + popq %r9 // Alignment + popq %r9 popq %r8 popq %rcx