* the old ESP value and other register state when activated. The
* first part of this is the recovery trampoline, which loads ESP from
* EBP, pops EBP, and returns. */
* the old ESP value and other register state when activated. The
* first part of this is the recovery trampoline, which loads ESP from
* EBP, pops EBP, and returns. */
-asm(".globl _stack_allocation_recover; .align 4; _stack_allocation_recover: mov %rbp, %rsp; pop %rsi; pop %rdi; pop \
-%rdx; pop %rcx; pop %r8; pop %r9; pop %rbp; ret;");
+asm(".globl _stack_allocation_recover; \
+ .align 4; \
+ _stack_allocation_recover: \
+ lea -48(%rbp), %rsp; \
+ pop %rsi; \
+ pop %rdi; \
+ pop %rdx; \
+ pop %rcx; \
+ pop %r8; \
+ pop %r9; \
+ pop %rbp; \
+ ret;");
push_context(context->rip, context);
push_context(context->rbp, context);
push_context(context->rip, context);
push_context(context->rbp, context);
push_context(context->r9, context);
push_context(context->r8, context);
push_context(context->r9, context);
push_context(context->r8, context);
push_context(context->rsi, context);
push_context(context->rdi, context);
push_context(context->rsi, context);
push_context(context->rdi, context);
* protection so the error handler has some headroom, protect the
* previous page so that we can catch returns from the guard page
* and restore it. */
* protection so the error handler has some headroom, protect the
* previous page so that we can catch returns from the guard page
* and restore it. */
* unprotect this one. This works even if we somehow missed
* the return-guard-page, and hit it on our way to new
* exhaustion instead. */
* unprotect this one. This works even if we somehow missed
* the return-guard-page, and hit it on our way to new
* exhaustion instead. */