diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2023-01-31 22:47:40 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2023-02-01 22:59:26 +0000 |
| commit | 2555f175b368569dd98e1bd2b6bd095c933faed7 (patch) | |
| tree | 3f76e0db85c9aef6e715153204b8f4ec6893373b /sys/arm64/include/stack.h | |
| parent | 6cc52efa13ed180c35232b833d38cf288679b2db (diff) | |
Diffstat (limited to 'sys/arm64/include/stack.h')
| -rw-r--r-- | sys/arm64/include/stack.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/arm64/include/stack.h b/sys/arm64/include/stack.h index 4b1d190df595..4c4c41bf9516 100644 --- a/sys/arm64/include/stack.h +++ b/sys/arm64/include/stack.h @@ -39,4 +39,22 @@ struct unwind_state { bool unwind_frame(struct thread *, struct unwind_state *); +#ifdef _SYS_PROC_H_ + +#include <machine/pcb.h> + +#define GET_STACK_USAGE(total, used) do { \ + struct thread *td = curthread; \ + (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ + (used) = td->td_kstack + (total) - (vm_offset_t)&td; \ +} while (0) + +static __inline bool +kstack_contains(struct thread *td, vm_offset_t va, size_t len) +{ + return (va >= td->td_kstack && va + len >= va && + va + len <= td->td_kstack + td->td_kstack_pages * PAGE_SIZE); +} +#endif /* _SYS_PROC_H_ */ + #endif /* !_MACHINE_STACK_H_ */ |
