From 739abe292fc89098c15e33660cbde41c7c3f900e Mon Sep 17 00:00:00 2001 From: mav Date: Thu, 31 Jan 2008 08:24:27 +0000 Subject: 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. --- sys/amd64/include/proc.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sys/amd64/include/proc.h') 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_ */ -- cgit v1.1