summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2013-09-29 13:09:25 +0000
committermarius <marius@FreeBSD.org>2013-09-29 13:09:25 +0000
commitfe39ca00e6754caf3b1302fc7fb2a1e4521c9339 (patch)
treed6d4f42f07b5dda30be52d55f868cdff3adbd1b2 /sys/sparc64
parent974f9452c8413133f0270ec632b7e925c1a66d9f (diff)
downloadFreeBSD-src-fe39ca00e6754caf3b1302fc7fb2a1e4521c9339.zip
FreeBSD-src-fe39ca00e6754caf3b1302fc7fb2a1e4521c9339.tar.gz
Implement GET_STACK_USAGE.
Discussed with: mav Approved by: re (kib) MFC after: 1 week
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/include/proc.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/sparc64/include/proc.h b/sys/sparc64/include/proc.h
index 006fcfa..4b5e1c9 100644
--- a/sys/sparc64/include/proc.h
+++ b/sys/sparc64/include/proc.h
@@ -55,6 +55,17 @@ struct mdproc {
#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