diff options
author | mav <mav@FreeBSD.org> | 2008-02-06 21:02:56 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2008-02-06 21:02:56 +0000 |
commit | b53943d8dfa775db10b8fc50cc8828c840a32320 (patch) | |
tree | 0095fa2da2e524ff58df37f89a551d8c7bbad52f /sys/amd64/include | |
parent | d15554fc2fa2c05f5fdb431d2c5e2ed808d1407b (diff) | |
download | FreeBSD-src-b53943d8dfa775db10b8fc50cc8828c840a32320.zip FreeBSD-src-b53943d8dfa775db10b8fc50cc8828c840a32320.tar.gz |
MFC GET_STACK_USAGE() macro to be used for netgraph stack protection.
Diffstat (limited to 'sys/amd64/include')
-rw-r--r-- | sys/amd64/include/proc.h | 13 |
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_ */ |