Deleted Added
full compact
procfs_fpregs.c (189282) procfs_fpregs.c (205014)
1/*-
2 * Copyright (c) 1993 Jan-Simon Pendry
3 * Copyright (c) 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Jan-Simon Pendry.
8 *

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

29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)procfs_fpregs.c 8.2 (Berkeley) 6/15/94
34 *
35 * From:
36 * $Id: procfs_regs.c,v 3.2 1993/12/15 09:40:17 jsp Exp $
1/*-
2 * Copyright (c) 1993 Jan-Simon Pendry
3 * Copyright (c) 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * Jan-Simon Pendry.
8 *

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

29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)procfs_fpregs.c 8.2 (Berkeley) 6/15/94
34 *
35 * From:
36 * $Id: procfs_regs.c,v 3.2 1993/12/15 09:40:17 jsp Exp $
37 * $FreeBSD: head/sys/fs/procfs/procfs_fpregs.c 189282 2009-03-02 18:43:50Z kib $
37 * $FreeBSD: head/sys/fs/procfs/procfs_fpregs.c 205014 2010-03-11 14:49:06Z nwhitehorn $
38 */
39
40#include "opt_compat.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/lock.h>
45#include <sys/mutex.h>
46#include <sys/proc.h>
47#include <sys/ptrace.h>
48#include <sys/sysent.h>
49#include <sys/uio.h>
50
51#include <machine/reg.h>
52
53#include <fs/pseudofs/pseudofs.h>
54#include <fs/procfs/procfs.h>
55
38 */
39
40#include "opt_compat.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/lock.h>
45#include <sys/mutex.h>
46#include <sys/proc.h>
47#include <sys/ptrace.h>
48#include <sys/sysent.h>
49#include <sys/uio.h>
50
51#include <machine/reg.h>
52
53#include <fs/pseudofs/pseudofs.h>
54#include <fs/procfs/procfs.h>
55
56#ifdef COMPAT_IA32
56#ifdef COMPAT_FREEBSD32
57#include <sys/procfs.h>
58#include <machine/fpu.h>
57#include <sys/procfs.h>
58#include <machine/fpu.h>
59#include <compat/ia32/ia32_reg.h>
60
61/*
62 * PROC(write, fpregs, td2, &r) becomes
63 * proc_write_fpregs(td2, &r) or
64 * proc_write_fpregs32(td2, &r32)
65 *
66 * UIOMOVE_FROMBUF(r, uio) becomes
67 * uiomove_frombuf(&r, sizeof(r), uio) or

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

79#endif
80
81int
82procfs_doprocfpregs(PFS_FILL_ARGS)
83{
84 int error;
85 struct fpreg r;
86 struct thread *td2;
59
60/*
61 * PROC(write, fpregs, td2, &r) becomes
62 * proc_write_fpregs(td2, &r) or
63 * proc_write_fpregs32(td2, &r32)
64 *
65 * UIOMOVE_FROMBUF(r, uio) becomes
66 * uiomove_frombuf(&r, sizeof(r), uio) or

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

78#endif
79
80int
81procfs_doprocfpregs(PFS_FILL_ARGS)
82{
83 int error;
84 struct fpreg r;
85 struct thread *td2;
87#ifdef COMPAT_IA32
86#ifdef COMPAT_FREEBSD32
88 struct fpreg32 r32;
89 int wrap32 = 0;
90#endif
91
92 if (uio->uio_offset != 0)
93 return (0);
94
95 PROC_LOCK(p);
96 KASSERT(p->p_lock > 0, ("proc not held"));
97 if (p_candebug(td, p)) {
98 PROC_UNLOCK(p);
99 return (EPERM);
100 }
101
102 /* XXXKSE: */
103 td2 = FIRST_THREAD_IN_PROC(p);
87 struct fpreg32 r32;
88 int wrap32 = 0;
89#endif
90
91 if (uio->uio_offset != 0)
92 return (0);
93
94 PROC_LOCK(p);
95 KASSERT(p->p_lock > 0, ("proc not held"));
96 if (p_candebug(td, p)) {
97 PROC_UNLOCK(p);
98 return (EPERM);
99 }
100
101 /* XXXKSE: */
102 td2 = FIRST_THREAD_IN_PROC(p);
104#ifdef COMPAT_IA32
103#ifdef COMPAT_FREEBSD32
105 if (SV_CURPROC_FLAG(SV_ILP32)) {
106 if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) {
107 PROC_UNLOCK(p);
108 return (EINVAL);
109 }
110 wrap32 = 1;
111 }
112#endif

--- 17 unchanged lines hidden ---
104 if (SV_CURPROC_FLAG(SV_ILP32)) {
105 if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) {
106 PROC_UNLOCK(p);
107 return (EINVAL);
108 }
109 wrap32 = 1;
110 }
111#endif

--- 17 unchanged lines hidden ---