mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
Suggested by: kib Reviewed by: kib, andrew (arm changes) Sponsored by: AFRL, DARPA Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23
54 lines
1.7 KiB
C
54 lines
1.7 KiB
C
/*-
|
|
* Mach Operating System
|
|
* Copyright (c) 1992 Carnegie Mellon University
|
|
* All Rights Reserved.
|
|
*
|
|
* Permission to use, copy, modify and distribute this software and its
|
|
* documentation is hereby granted, provided that both the copyright
|
|
* notice and this permission notice appear in all copies of the
|
|
* software, derivative works or modified versions, and any portions
|
|
* thereof, and that both notices appear in supporting documentation.
|
|
*
|
|
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
|
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
|
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
|
*
|
|
* Carnegie Mellon requests users of this software to return to
|
|
*
|
|
* Software Distribution Coordinator or [email protected]
|
|
* School of Computer Science
|
|
* Carnegie Mellon University
|
|
* Pittsburgh PA 15213-3890
|
|
*
|
|
* any improvements or extensions that they make and grant Carnegie Mellon
|
|
* the rights to redistribute these changes.
|
|
*/
|
|
|
|
#ifndef _MACHINE_STACK_H_
|
|
#define _MACHINE_STACK_H_
|
|
|
|
extern int trapexit[];
|
|
extern int asttrapexit[];
|
|
extern int end[];
|
|
|
|
#ifdef _SYS_PROC_H_
|
|
|
|
#include <machine/pcb.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) - sizeof(struct pcb); \
|
|
(used) = td->td_kstack + (total) - (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) - sizeof(struct pcb));
|
|
}
|
|
#endif /* _SYS_PROC_H_ */
|
|
|
|
#endif /* !_MACHINE_STACK_H_ */
|