sim: Fix stack alignment
The recent x86-64 convention requires 16-byte alignment before (not after) calling a function. This fixes snprintf crash I observed on macOS while saving XMM registers.
This commit is contained in:
parent
39bd9ff670
commit
298c2e5e4f
|
@ -67,6 +67,6 @@
|
|||
void up_initial_state(struct tcb_s *tcb)
|
||||
{
|
||||
memset(&tcb->xcp, 0, sizeof(struct xcptcontext));
|
||||
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->adj_stack_ptr;
|
||||
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->adj_stack_ptr - sizeof(xcpt_reg_t);
|
||||
tcb->xcp.regs[JB_PC] = (xcpt_reg_t)tcb->start;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
|
|||
|
||||
/* Reset the initial state */
|
||||
|
||||
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->adj_stack_ptr;
|
||||
tcb->xcp.regs[JB_SP] = (xcpt_reg_t)tcb->adj_stack_ptr - sizeof(xcpt_reg_t);
|
||||
|
||||
/* And return a pointer to the allocated memory */
|
||||
|
||||
|
|
Loading…
Reference in New Issue