aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/include/stack.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/amd64/include/stack.h')
-rw-r--r--sys/amd64/include/stack.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/amd64/include/stack.h b/sys/amd64/include/stack.h
index 3c27266b775b..7d821348be0e 100644
--- a/sys/amd64/include/stack.h
+++ b/sys/amd64/include/stack.h
@@ -12,17 +12,15 @@
/* Get the current kernel thread stack usage. */
#define GET_STACK_USAGE(total, used) do { \
struct thread *td = curthread; \
- (total) = td->td_kstack_pages * PAGE_SIZE; \
- (used) = td->td_kstack + td->td_kstack_pages * PAGE_SIZE - \
- (char *)&td; \
+ (total) = ptoa(td->td_kstack_pages); \
+ (used) = td_kstack_top(td) - (char *)&td; \
} while (0)
static __inline bool
kstack_contains(struct thread *td, vm_offset_t va, size_t len)
{
return (va >= (vm_offset_t)td->td_kstack && va + len >= va &&
- va + len <= (vm_offset_t)td->td_kstack + td->td_kstack_pages *
- PAGE_SIZE);
+ va + len <= (vm_offset_t)td_kstack_top(td));
}
#endif /* _SYS_PROC_H_ */