summaryrefslogtreecommitdiff
path: root/sys/powerpc/include
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2023-01-31 22:47:40 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2023-02-01 22:59:26 +0000
commit2555f175b368569dd98e1bd2b6bd095c933faed7 (patch)
tree3f76e0db85c9aef6e715153204b8f4ec6893373b /sys/powerpc/include
parent6cc52efa13ed180c35232b833d38cf288679b2db (diff)
Diffstat (limited to 'sys/powerpc/include')
-rw-r--r--sys/powerpc/include/proc.h12
-rw-r--r--sys/powerpc/include/stack.h19
2 files changed, 19 insertions, 12 deletions
diff --git a/sys/powerpc/include/proc.h b/sys/powerpc/include/proc.h
index 2c6a00536b8a..0f8d36bfe856 100644
--- a/sys/powerpc/include/proc.h
+++ b/sys/powerpc/include/proc.h
@@ -59,16 +59,4 @@ struct mdproc {
#define KINFO_PROC_SIZE 816
#endif
-#ifdef _KERNEL
-
-#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); \
- (used) = td->td_kstack + (total) - (vm_offset_t)&td; \
-} while (0)
-#endif
-
#endif /* !_MACHINE_PROC_H_ */
diff --git a/sys/powerpc/include/stack.h b/sys/powerpc/include/stack.h
index c433a9fe09eb..953afd6f0aa4 100644
--- a/sys/powerpc/include/stack.h
+++ b/sys/powerpc/include/stack.h
@@ -33,4 +33,23 @@ extern int trapexit[];
extern int asttrapexit[];
extern int end[];
+#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); \
+ (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_ */