xref: /freebsd/share/man/man9/kstack_contains.9 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1*c2eae5c3SJoseph Koshy.\" SPDX-License-Identifier: BSD-2-Clause
2*c2eae5c3SJoseph Koshy.\"
3*c2eae5c3SJoseph Koshy.\" Copyright (c) 2023 Joseph Koshy <jkoshy@FreeBSD.org>
4*c2eae5c3SJoseph Koshy.\"
5*c2eae5c3SJoseph Koshy.\" Redistribution and use in source and binary forms, with or without
6*c2eae5c3SJoseph Koshy.\" modification, are permitted provided that the following conditions
7*c2eae5c3SJoseph Koshy.\" are met:
8*c2eae5c3SJoseph Koshy.\" 1. Redistributions of source code must retain the above copyright
9*c2eae5c3SJoseph Koshy.\"    notice, this list of conditions and the following disclaimer.
10*c2eae5c3SJoseph Koshy.\" 2. Redistributions in binary form must reproduce the above copyright
11*c2eae5c3SJoseph Koshy.\"    notice, this list of conditions and the following disclaimer in the
12*c2eae5c3SJoseph Koshy.\"    documentation and/or other materials provided with the distribution.
13*c2eae5c3SJoseph Koshy.\"
14*c2eae5c3SJoseph Koshy.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
15*c2eae5c3SJoseph Koshy.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16*c2eae5c3SJoseph Koshy.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17*c2eae5c3SJoseph Koshy.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
18*c2eae5c3SJoseph Koshy.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19*c2eae5c3SJoseph Koshy.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20*c2eae5c3SJoseph Koshy.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21*c2eae5c3SJoseph Koshy.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22*c2eae5c3SJoseph Koshy.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23*c2eae5c3SJoseph Koshy.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24*c2eae5c3SJoseph Koshy.\"
25*c2eae5c3SJoseph Koshy.Dd May 2, 2023
26*c2eae5c3SJoseph Koshy.Dt KSTACK_CONTAINS 9
27*c2eae5c3SJoseph Koshy.Os
28*c2eae5c3SJoseph Koshy.Sh NAME
29*c2eae5c3SJoseph Koshy.Nm kstack_contains
30*c2eae5c3SJoseph Koshy.Nd determine if an address range lies within the kernel stack for a thread
31*c2eae5c3SJoseph Koshy.Sh SYNOPSIS
32*c2eae5c3SJoseph Koshy.In machine/stack.h
33*c2eae5c3SJoseph Koshy.Ft bool
34*c2eae5c3SJoseph Koshy.Fn kstack_contains "struct thread *td" "vm_offset_t va" "size_t len"
35*c2eae5c3SJoseph Koshy.Sh DESCRIPTION
36*c2eae5c3SJoseph KoshyThis function can be used to determine whether a given address range
37*c2eae5c3SJoseph Koshyfalls within the kernel stack for the thread pointed to by
38*c2eae5c3SJoseph Koshy.Fa td .
39*c2eae5c3SJoseph Koshy.Sh RETURN VALUES
40*c2eae5c3SJoseph KoshyThe function
41*c2eae5c3SJoseph Koshy.Fn kstack_contains
42*c2eae5c3SJoseph Koshyreturns
43*c2eae5c3SJoseph Koshy.Dv true
44*c2eae5c3SJoseph Koshyif the range of addresses
45*c2eae5c3SJoseph Koshy.Bo
46*c2eae5c3SJoseph Koshy.Fa va Ns .. Ns (
47*c2eae5c3SJoseph Koshy.Fa va Ns + Ns
48*c2eae5c3SJoseph Koshy.Fa len Ns - Ns 1 )
49*c2eae5c3SJoseph Koshy.Bc
50*c2eae5c3SJoseph Koshy(both addresses inclusive) lies within the kernel stack for the thread
51*c2eae5c3SJoseph Koshypointed to by argument
52*c2eae5c3SJoseph Koshy.Fa td ,
53*c2eae5c3SJoseph Koshyor returns
54*c2eae5c3SJoseph Koshy.Dv false
55*c2eae5c3SJoseph Koshyotherwise.
56*c2eae5c3SJoseph Koshy.Sh ERRORS
57*c2eae5c3SJoseph KoshyThis function does not return an error.
58*c2eae5c3SJoseph Koshy.Sh SEE ALSO
59*c2eae5c3SJoseph Koshy.Xr kproc 9 ,
60*c2eae5c3SJoseph Koshy.Xr kthread 9
61