blob: 7d821348be0e03dbc8a6285a79db4826349164d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/*
* This file is in the public domain.
*/
#ifndef _MACHINE_STACK_H_
#define _MACHINE_STACK_H_
#include <x86/stack.h>
#ifdef _SYS_PROC_H_
/* Get the current kernel thread stack usage. */
#define GET_STACK_USAGE(total, used) do { \
struct thread *td = curthread; \
(total) = ptoa(td->td_kstack_pages); \
(used) = td_kstack_top(td) - (char *)&td; \
} while (0)
static __inline bool
kstack_contains(struct thread *td, vm_offset_t va, size_t len)
{
return (va >= (vm_offset_t)td->td_kstack && va + len >= va &&
va + len <= (vm_offset_t)td_kstack_top(td));
}
#endif /* _SYS_PROC_H_ */
#endif
|