summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/include
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2013-10-02 20:40:21 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2013-10-02 20:40:21 +0000
commit3f1d7fea0ef65364bd48c79e15a8adb62926b908 (patch)
tree6701dd9dcf83d9211d66f11c836bef2f7936efe2 /sys/powerpc/include
parent8ff2d520091393b06e526a412f4f24c98825d660 (diff)
downloadFreeBSD-src-3f1d7fea0ef65364bd48c79e15a8adb62926b908.zip
FreeBSD-src-3f1d7fea0ef65364bd48c79e15a8adb62926b908.tar.gz
Implement GET_STACK_USAGE() on PowerPC. This implementation is identical
to that on x86 and sparc64. Approved by: re (kib)
Diffstat (limited to 'sys/powerpc/include')
-rw-r--r--sys/powerpc/include/proc.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/powerpc/include/proc.h b/sys/powerpc/include/proc.h
index 627fbf2..4981581 100644
--- a/sys/powerpc/include/proc.h
+++ b/sys/powerpc/include/proc.h
@@ -54,6 +54,18 @@ struct mdproc {
#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) = (char *)td->td_kstack + \
+ td->td_kstack_pages * PAGE_SIZE - \
+ (char *)&td; \
+} while (0)
+
struct syscall_args {
u_int code;
struct sysent *callp;
OpenPOWER on IntegriCloud