aboutsummaryrefslogtreecommitdiff
path: root/sys/riscv/include/stack.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/riscv/include/stack.h')
-rw-r--r--sys/riscv/include/stack.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/sys/riscv/include/stack.h b/sys/riscv/include/stack.h
index 03b5794c2b13..fac8d4f317b6 100644
--- a/sys/riscv/include/stack.h
+++ b/sys/riscv/include/stack.h
@@ -48,12 +48,10 @@ bool unwind_frame(struct thread *, struct unwind_state *);
#ifdef _SYS_PROC_H_
-#include <machine/pcb.h>
-
/* 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 - sizeof(struct pcb); \
+ (total) = ptoa(td->td_kstack_pages); \
(used) = td->td_kstack + (total) - (char *)&td; \
} while (0)
@@ -61,8 +59,7 @@ 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 - sizeof(struct pcb));
+ va + len <= (vm_offset_t)td_kstack_top(td));
}
#endif /* _SYS_PROC_H_ */