mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
kernel: riscv: ensure stack is 16-byte aligned
Make sure processes are set up such that the stack is aligned to a 16-byte boundary. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
d96b6c15c8
commit
4e17946960
1 changed files with 5 additions and 1 deletions
|
|
@ -372,11 +372,15 @@ impl Process {
|
|||
let pid = self.pid.get();
|
||||
let thread = self.thread_mut(new_tid);
|
||||
// println!("Setting up thread {}, pid {}", new_tid, pid);
|
||||
let sp = setup.stack.as_ptr() as usize + setup.stack.len();
|
||||
if sp <= 16 {
|
||||
Err(xous_kernel::Error::BadAddress)?;
|
||||
}
|
||||
crate::arch::syscall::invoke(
|
||||
thread,
|
||||
pid == 1,
|
||||
entrypoint,
|
||||
setup.stack.as_ptr() as usize + setup.stack.len(),
|
||||
(sp - 16) & !0xf,
|
||||
EXIT_THREAD,
|
||||
&[setup.arg1, setup.arg2, setup.arg3, setup.arg4],
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue