Skip to content

Commit 23df4de

Browse files
committed
rt: Fix alignment of new stack segments
1 parent ab4f35c commit 23df4de

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/rt/rust_task.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -596,10 +596,8 @@ rust_task::new_stack(size_t stk_sz, void *args_addr, size_t args_sz) {
596596
stk_seg *stk_seg = new_stk(sched, this, stk_sz + args_sz);
597597

598598
uint8_t *new_sp = (uint8_t*)stk_seg->end;
599-
size_t sizeof_retaddr = sizeof(void*);
600-
// Make enough room on the new stack to hold the old stack pointer
601-
// in addition to the function arguments
602-
new_sp = align_down(new_sp - (args_sz + sizeof_retaddr));
599+
// Push the function arguments to the new stack
600+
new_sp = align_down(new_sp - args_sz);
603601
memcpy(new_sp, args_addr, args_sz);
604602
record_stack_limit();
605603
return new_sp;

0 commit comments

Comments
 (0)