Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion arch/x86_64/src/intel64/intel64_cpuidlestack.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ int up_cpu_idlestack(int cpu, struct tcb_s *tcb, size_t stack_size)

/* Get the top of the stack */

stack_alloc = (uintptr_t)g_idle_topstack[cpu];
stack_alloc = (uintptr_t)g_idle_topstack[cpu] -
CONFIG_IDLETHREAD_STACKSIZE;
tcb->adj_stack_size = stack_size - 8;
tcb->stack_alloc_ptr = (void *)stack_alloc;
tcb->stack_base_ptr = tcb->stack_alloc_ptr;
Expand Down
4 changes: 4 additions & 0 deletions arch/x86_64/src/intel64/intel64_head.S
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ ap_start:
add %rax, %rbx
mov (%rbx), %rsp

/* Move initial RSP below IDLE TCB regs */
sub $XCPTCONTEXT_SIZE, %rsp
and $(~XCPTCONTEXT_SIZE), %rsp

/* Jump to ap_start routine */
movabs $x86_64_ap_boot, %rbx
jmp *%rbx
Expand Down
9 changes: 8 additions & 1 deletion arch/x86_64/src/intel64/intel64_schedulesigaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
*/

up_current_regs()[REG_RIP] = (uint64_t)x86_64_sigdeliver;
up_current_regs()[REG_RSP] = up_current_regs()[REG_RSP] - 8;
up_current_regs()[REG_RFLAGS] = 0;

/* And make sure that the saved context in the TCB
Expand Down Expand Up @@ -162,6 +163,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
*/

tcb->xcp.regs[REG_RIP] = (uint64_t)x86_64_sigdeliver;
tcb->xcp.regs[REG_RSP] = tcb->xcp.regs[REG_RSP] - 8;
tcb->xcp.regs[REG_RFLAGS] = 0;
}
}
Expand Down Expand Up @@ -242,6 +244,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
*/

tcb->xcp.regs[REG_RIP] = (uint64_t)x86_64_sigdeliver;
tcb->xcp.regs[REG_RSP] = tcb->xcp.regs[REG_RSP] - 8;
tcb->xcp.regs[REG_RFLAGS] = 0;
}
else
Expand All @@ -261,7 +264,10 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
* disabled
*/

up_current_regs()[REG_RIP] = (uint64_t)x86_64_sigdeliver;
up_current_regs()[REG_RIP] =
(uint64_t)x86_64_sigdeliver;
up_current_regs()[REG_RSP] =
up_current_regs()[REG_RSP] - 8;
up_current_regs()[REG_RFLAGS] = 0;

/* And make sure that the saved context in the TCB
Expand Down Expand Up @@ -308,6 +314,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
*/

tcb->xcp.regs[REG_RIP] = (uint64_t)x86_64_sigdeliver;
tcb->xcp.regs[REG_RSP] = tcb->xcp.regs[REG_RSP] - 8;
tcb->xcp.regs[REG_RFLAGS] = 0;
}
}
Expand Down