Deleted Added
sdiff udiff text old ( 278976 ) new ( 284919 )
full compact
1/*-
2 * Copyright (c) 2011 Konstantin Belousov <kib@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/amd64/amd64/ptrace_machdep.c 278976 2015-02-18 23:34:03Z jhb $");
30
31#include "opt_compat.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/malloc.h>
36#include <sys/proc.h>
37#include <sys/ptrace.h>
38#include <sys/sysent.h>
39#include <machine/md_var.h>
40#include <machine/pcb.h>
41
42static int
43cpu_ptrace_xstate(struct thread *td, int req, void *addr, int data)
44{
45 struct ptrace_xstate_info info;
46 char *savefpu;
47 int error;
48

--- 56 unchanged lines hidden (view full) ---

105 default:
106 error = EINVAL;
107 break;
108 }
109
110 return (error);
111}
112
113#ifdef COMPAT_FREEBSD32
114#define PT_I386_GETXMMREGS (PT_FIRSTMACH + 0)
115#define PT_I386_SETXMMREGS (PT_FIRSTMACH + 1)
116
117static int
118cpu32_ptrace(struct thread *td, int req, void *addr, int data)
119{
120 struct savefpu *fpstate;
121 int error;
122
123 switch (req) {
124 case PT_I386_GETXMMREGS:
125 fpugetregs(td);
126 error = copyout(get_pcb_user_save_td(td), addr,
127 sizeof(*fpstate));
128 break;

--- 8 unchanged lines hidden (view full) ---

137 case PT_GETXSTATE_OLD:
138 case PT_SETXSTATE_OLD:
139 case PT_GETXSTATE_INFO:
140 case PT_GETXSTATE:
141 case PT_SETXSTATE:
142 error = cpu_ptrace_xstate(td, req, addr, data);
143 break;
144
145 default:
146 error = EINVAL;
147 break;
148 }
149
150 return (error);
151}
152#endif
153
154int
155cpu_ptrace(struct thread *td, int req, void *addr, int data)
156{
157 int error;
158
159#ifdef COMPAT_FREEBSD32
160 if (SV_CURPROC_FLAG(SV_ILP32))
161 return (cpu32_ptrace(td, req, addr, data));
162#endif
163
164 /* Support old values of PT_GETXSTATE_OLD and PT_SETXSTATE_OLD. */

--- 6 unchanged lines hidden (view full) ---

171 case PT_GETXSTATE_OLD:
172 case PT_SETXSTATE_OLD:
173 case PT_GETXSTATE_INFO:
174 case PT_GETXSTATE:
175 case PT_SETXSTATE:
176 error = cpu_ptrace_xstate(td, req, addr, data);
177 break;
178
179 default:
180 error = EINVAL;
181 break;
182 }
183
184 return (error);
185}