2 * Mach Operating System
3 * Copyright (c) 1992 Carnegie Mellon University
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
16 * Carnegie Mellon requests users of this software to return to
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
29 #ifndef _MACHINE_STACK_H_
30 #define _MACHINE_STACK_H_
32 extern int trapexit[];
33 extern int asttrapexit[];
38 #include <machine/pcb.h>
40 /* Get the current kernel thread stack usage. */
41 #define GET_STACK_USAGE(total, used) do { \
42 struct thread *td = curthread; \
43 (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \
44 (used) = td->td_kstack + (total) - (vm_offset_t)&td; \
48 kstack_contains(struct thread *td, vm_offset_t va, size_t len)
50 return (va >= td->td_kstack && va + len >= va &&
51 va + len <= td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
54 #endif /* _SYS_PROC_H_ */
56 #endif /* !_MACHINE_STACK_H_ */