Skip to content
Closed
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
12 changes: 11 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,17 @@ pub fn grow<R, F: FnOnce() -> R>(stack_size: usize, callback: F) -> R {
/// to determine whether a stack switch should be made or not.
pub fn remaining_stack() -> Option<usize> {
let current_ptr = current_stack_ptr();
get_stack_limit().map(|limit| current_ptr - limit)
match get_stack_limit() {
Some(limit) => {
if current_ptr < limit {
None
}
else {
Some(current_ptr - limit)
}
},
None => None
}
}

psm_stack_information!(
Expand Down