Deleted Added
full compact
procfs_dbregs.c (189282) procfs_dbregs.c (205014)
1/*-
2 * Copyright (c) 1999 Brian Scott Dean, brdean@unx.sas.com.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Jan-Simon Pendry under the following copyrights and conditions:
7 *
8 * Copyright (c) 1993 Jan-Simon Pendry

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

35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * From: @(#)procfs_regs.c 8.4 (Berkeley) 6/15/94
40 *
41 * From:
42 * $Id: procfs_regs.c,v 3.2 1993/12/15 09:40:17 jsp Exp $
1/*-
2 * Copyright (c) 1999 Brian Scott Dean, brdean@unx.sas.com.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Jan-Simon Pendry under the following copyrights and conditions:
7 *
8 * Copyright (c) 1993 Jan-Simon Pendry

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

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

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

85#endif
86
87int
88procfs_doprocdbregs(PFS_FILL_ARGS)
89{
90 int error;
91 struct dbreg r;
92 struct thread *td2;
65
66/*
67 * PROC(write, dbregs, td2, &r) becomes
68 * proc_write_dbregs(td2, &r) or
69 * proc_write_dbregs32(td2, &r32)
70 *
71 * UIOMOVE_FROMBUF(r, uio) becomes
72 * uiomove_frombuf(&r, sizeof(r), uio) or

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

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

--- 17 unchanged lines hidden ---
109 if (SV_CURPROC_FLAG(SV_ILP32)) {
110 if ((td2->td_proc->p_sysent->sv_flags & SV_ILP32) == 0) {
111 PROC_UNLOCK(p);
112 return (EINVAL);
113 }
114 wrap32 = 1;
115 }
116#endif

--- 17 unchanged lines hidden ---