summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/proc.h
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2008-01-31 08:24:27 +0000
committermav <mav@FreeBSD.org>2008-01-31 08:24:27 +0000
commit739abe292fc89098c15e33660cbde41c7c3f900e (patch)
tree599b3da45155b4ddaecff1d725b0ac7c72de841e /sys/amd64/include/proc.h
parentc57fa547596c416598879f29dc61157e959392bd (diff)
downloadFreeBSD-src-739abe292fc89098c15e33660cbde41c7c3f900e.zip
FreeBSD-src-739abe292fc89098c15e33660cbde41c7c3f900e.tar.gz
Move GET_STACK_USAGE from MI header to i386/amd64 MD ones.
Somebody who can, please feel free to implement it for other archs or copy this one if it suits.
Diffstat (limited to 'sys/amd64/include/proc.h')
-rw-r--r--sys/amd64/include/proc.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/amd64/include/proc.h b/sys/amd64/include/proc.h
index ba6354b..a3ebd79 100644
--- a/sys/amd64/include/proc.h
+++ b/sys/amd64/include/proc.h
@@ -44,4 +44,17 @@ struct mdthread {
struct mdproc {
};
+#ifdef _KERNEL
+
+/* 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) = (char *)td->td_kstack + \
+ td->td_kstack_pages * PAGE_SIZE - \
+ (char *)&td; \
+} while (0)
+
+#endif /* _KERNEL */
+
#endif /* !_MACHINE_PROC_H_ */
OpenPOWER on IntegriCloud