1 /* 2 * This file is in the public domain. 3 */ 4 5 #ifndef _MACHINE_STACK_H_ 6 #define _MACHINE_STACK_H_ 7 8 #include <x86/stack.h> 9 10 #ifdef _SYS_PROC_H_ 11 12 /* Get the current kernel thread stack usage. */ 13 #define GET_STACK_USAGE(total, used) do { \ 14 struct thread *td = curthread; \ 15 (total) = ptoa(td->td_kstack_pages); \ 16 (used) = td_kstack_top(td) - (char *)&td; \ 17 } while (0) 18 19 static __inline bool 20 kstack_contains(struct thread *td, vm_offset_t va, size_t len) 21 { 22 return (va >= (vm_offset_t)td->td_kstack && va + len >= va && 23 va + len <= (vm_offset_t)td_kstack_top(td)); 24 } 25 #endif /* _SYS_PROC_H_ */ 26 27 #endif 28