ptrace.h revision 1.13.2.2 1 1.13.2.2 christos /* $NetBSD: ptrace.h,v 1.13.2.2 2006/03/05 07:17:22 christos Exp $ */
2 1.13.2.2 christos
3 1.13.2.2 christos /*
4 1.13.2.2 christos * Copyright (c) 2001 Wasabi Systems, Inc.
5 1.13.2.2 christos * All rights reserved.
6 1.13.2.2 christos *
7 1.13.2.2 christos * Written by Jason R. Thorpe for Wasabi Systems, Inc.
8 1.13.2.2 christos *
9 1.13.2.2 christos * Redistribution and use in source and binary forms, with or without
10 1.13.2.2 christos * modification, are permitted provided that the following conditions
11 1.13.2.2 christos * are met:
12 1.13.2.2 christos * 1. Redistributions of source code must retain the above copyright
13 1.13.2.2 christos * notice, this list of conditions and the following disclaimer.
14 1.13.2.2 christos * 2. Redistributions in binary form must reproduce the above copyright
15 1.13.2.2 christos * notice, this list of conditions and the following disclaimer in the
16 1.13.2.2 christos * documentation and/or other materials provided with the distribution.
17 1.13.2.2 christos * 3. All advertising materials mentioning features or use of this software
18 1.13.2.2 christos * must display the following acknowledgement:
19 1.13.2.2 christos * This product includes software developed for the NetBSD Project by
20 1.13.2.2 christos * Wasabi Systems, Inc.
21 1.13.2.2 christos * 4. The name of Wasabi Systems, Inc. may not be used to endorse
22 1.13.2.2 christos * or promote products derived from this software without specific prior
23 1.13.2.2 christos * written permission.
24 1.13.2.2 christos *
25 1.13.2.2 christos * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
26 1.13.2.2 christos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 1.13.2.2 christos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 1.13.2.2 christos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
29 1.13.2.2 christos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 1.13.2.2 christos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 1.13.2.2 christos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 1.13.2.2 christos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 1.13.2.2 christos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 1.13.2.2 christos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 1.13.2.2 christos * POSSIBILITY OF SUCH DAMAGE.
36 1.13.2.2 christos */
37 1.13.2.2 christos
38 1.13.2.2 christos /*
39 1.13.2.2 christos * Copyright (c) 1993 Christopher G. Demetriou
40 1.13.2.2 christos * All rights reserved.
41 1.13.2.2 christos *
42 1.13.2.2 christos * Redistribution and use in source and binary forms, with or without
43 1.13.2.2 christos * modification, are permitted provided that the following conditions
44 1.13.2.2 christos * are met:
45 1.13.2.2 christos * 1. Redistributions of source code must retain the above copyright
46 1.13.2.2 christos * notice, this list of conditions and the following disclaimer.
47 1.13.2.2 christos * 2. Redistributions in binary form must reproduce the above copyright
48 1.13.2.2 christos * notice, this list of conditions and the following disclaimer in the
49 1.13.2.2 christos * documentation and/or other materials provided with the distribution.
50 1.13.2.2 christos * 3. All advertising materials mentioning features or use of this software
51 1.13.2.2 christos * must display the following acknowledgement:
52 1.13.2.2 christos * This product includes software developed by Christopher G. Demetriou.
53 1.13.2.2 christos * 4. The name of the author may not be used to endorse or promote products
54 1.13.2.2 christos * derived from this software without specific prior written permission
55 1.13.2.2 christos *
56 1.13.2.2 christos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
57 1.13.2.2 christos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
58 1.13.2.2 christos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
59 1.13.2.2 christos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
60 1.13.2.2 christos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
61 1.13.2.2 christos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
62 1.13.2.2 christos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
63 1.13.2.2 christos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
64 1.13.2.2 christos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
65 1.13.2.2 christos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
66 1.13.2.2 christos */
67 1.13.2.2 christos
68 1.13.2.2 christos #ifndef _I386_PTRACE_H_
69 1.13.2.2 christos #define _I386_PTRACE_H_
70 1.13.2.2 christos
71 1.13.2.2 christos /*
72 1.13.2.2 christos * i386-dependent ptrace definitions
73 1.13.2.2 christos */
74 1.13.2.2 christos #define PT_STEP (PT_FIRSTMACH + 0)
75 1.13.2.2 christos #define PT_GETREGS (PT_FIRSTMACH + 1)
76 1.13.2.2 christos #define PT_SETREGS (PT_FIRSTMACH + 2)
77 1.13.2.2 christos #define PT_GETFPREGS (PT_FIRSTMACH + 3)
78 1.13.2.2 christos #define PT_SETFPREGS (PT_FIRSTMACH + 4)
79 1.13.2.2 christos
80 1.13.2.2 christos /* We have machine-dependent process tracing needs. */
81 1.13.2.2 christos #define __HAVE_PTRACE_MACHDEP
82 1.13.2.2 christos
83 1.13.2.2 christos /* We have machine-dependent procfs nodes. */
84 1.13.2.2 christos #define __HAVE_PROCFS_MACHDEP
85 1.13.2.2 christos
86 1.13.2.2 christos /* The machine-dependent ptrace(2) requests. */
87 1.13.2.2 christos #define PT_GETXMMREGS (PT_FIRSTMACH + 5)
88 1.13.2.2 christos #define PT_SETXMMREGS (PT_FIRSTMACH + 6)
89 1.13.2.2 christos
90 1.13.2.2 christos #define PT_MACHDEP_STRINGS \
91 1.13.2.2 christos "PT_STEP", \
92 1.13.2.2 christos "PT_GETREGS", \
93 1.13.2.2 christos "PT_SETREGS", \
94 1.13.2.2 christos "PT_GETFPREGS", \
95 1.13.2.2 christos "PT_SETFPREGS", \
96 1.13.2.2 christos "PT_GETXMMREGS", \
97 1.13.2.2 christos "PT_SETXMMREGS",
98 1.13.2.2 christos
99 1.13.2.2 christos #ifdef _KERNEL
100 1.13.2.2 christos
101 1.13.2.2 christos /*
102 1.13.2.2 christos * These are used in sys_ptrace() to find good ptrace(2) requests.
103 1.13.2.2 christos */
104 1.13.2.2 christos #define PTRACE_MACHDEP_REQUEST_CASES \
105 1.13.2.2 christos case PT_GETXMMREGS: \
106 1.13.2.2 christos case PT_SETXMMREGS:
107 1.13.2.2 christos
108 1.13.2.2 christos /*
109 1.13.2.2 christos * These are used to define machine-dependent procfs node types.
110 1.13.2.2 christos */
111 1.13.2.2 christos #define PROCFS_MACHDEP_NODE_TYPES \
112 1.13.2.2 christos Pmachdep_xmmregs, /* extended FP register set */
113 1.13.2.2 christos
114 1.13.2.2 christos /*
115 1.13.2.2 christos * These are used in switch statements to catch machine-dependent
116 1.13.2.2 christos * procfs node types.
117 1.13.2.2 christos */
118 1.13.2.2 christos #define PROCFS_MACHDEP_NODETYPE_CASES \
119 1.13.2.2 christos case Pmachdep_xmmregs:
120 1.13.2.2 christos
121 1.13.2.2 christos /*
122 1.13.2.2 christos * These are used to protect a privileged process's state.
123 1.13.2.2 christos */
124 1.13.2.2 christos #define PROCFS_MACHDEP_PROTECT_CASES \
125 1.13.2.2 christos case Pmachdep_xmmregs:
126 1.13.2.2 christos
127 1.13.2.2 christos /*
128 1.13.2.2 christos * These are used to define the machine-dependent procfs nodes.
129 1.13.2.2 christos */
130 1.13.2.2 christos #define PROCFS_MACHDEP_NODETYPE_DEFNS \
131 1.13.2.2 christos { DT_REG, N("xmmregs"), Pmachdep_xmmregs, \
132 1.13.2.2 christos procfs_machdep_validxmmregs },
133 1.13.2.2 christos
134 1.13.2.2 christos struct xmmregs;
135 1.13.2.2 christos
136 1.13.2.2 christos /* Functions used by both ptrace(2) and procfs. */
137 1.13.2.2 christos int process_machdep_doxmmregs(struct lwp *, struct lwp *, struct uio *);
138 1.13.2.2 christos int process_machdep_validxmmregs(struct proc *);
139 1.13.2.2 christos
140 1.13.2.2 christos /* Functions used by procfs. */
141 1.13.2.2 christos struct mount;
142 1.13.2.2 christos struct pfsnode;
143 1.13.2.2 christos int procfs_machdep_doxmmregs(struct lwp *, struct lwp *,
144 1.13.2.2 christos struct pfsnode *, struct uio *);
145 1.13.2.2 christos int procfs_machdep_validxmmregs(struct lwp *, struct mount *);
146 1.13.2.2 christos
147 1.13.2.2 christos #endif /* _KERNEL */
148 1.13.2.2 christos
149 1.13.2.2 christos #endif /* _I386_PTRACE_H_ */
150