mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix pthread stack alignment.
This commit is contained in:
parent
a80bc5d011
commit
d9bb6da811
1 changed files with 4 additions and 8 deletions
|
@ -81,15 +81,12 @@ static void setup_thread_state(struct pthread* thread, struct tfork* regs)
|
||||||
(unsigned long*) ((uint8_t*) thread->uthread.stack_mmap +
|
(unsigned long*) ((uint8_t*) thread->uthread.stack_mmap +
|
||||||
thread->uthread.stack_size);
|
thread->uthread.stack_size);
|
||||||
|
|
||||||
*--stack = 0; // rip=0
|
*--stack = 0; // Alignment.
|
||||||
*--stack = 0; // rbp=0
|
|
||||||
|
|
||||||
regs->ebp = (uintptr_t) stack;
|
|
||||||
|
|
||||||
*--stack = (unsigned long) thread;
|
*--stack = (unsigned long) thread;
|
||||||
*--stack = 0;
|
*--stack = 0; // rip=0
|
||||||
|
|
||||||
regs->esp = (uintptr_t) stack;
|
regs->esp = (uintptr_t) stack;
|
||||||
|
regs->ebp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -111,10 +108,9 @@ static void setup_thread_state(struct pthread* thread, struct tfork* regs)
|
||||||
thread->uthread.stack_size);
|
thread->uthread.stack_size);
|
||||||
|
|
||||||
*--stack = 0; // rip=0
|
*--stack = 0; // rip=0
|
||||||
*--stack = 0; // rbp=0
|
|
||||||
|
|
||||||
regs->rsp = (uintptr_t) stack;
|
regs->rsp = (uintptr_t) stack;
|
||||||
regs->rbp = regs->rsp;
|
regs->rbp = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue