From owner-p4-projects@FreeBSD.ORG Fri Aug 11 03:56:40 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 34E7716A4DD; Fri, 11 Aug 2006 03:56:40 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0BB3916A4DE for ; Fri, 11 Aug 2006 03:56:40 +0000 (UTC) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD1BB43D4C for ; Fri, 11 Aug 2006 03:56:39 +0000 (GMT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k7B3ud4a006774 for ; Fri, 11 Aug 2006 03:56:39 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7B3udkp006771 for perforce@freebsd.org; Fri, 11 Aug 2006 03:56:39 GMT (envelope-from marcel@freebsd.org) Date: Fri, 11 Aug 2006 03:56:39 GMT Message-Id: <200608110356.k7B3udkp006771@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Cc: Subject: PERFORCE change 103625 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Aug 2006 03:56:40 -0000 http://perforce.freebsd.org/chv.cgi?CH=103625 Change 103625 by marcel@marcel_nfs on 2006/08/11 03:56:05 Provide backward compatible defaults. Affected files ... .. //depot/projects/gdb/sys/fs/procfs/procfs_dbregs.c#5 edit .. //depot/projects/gdb/sys/fs/procfs/procfs_fpregs.c#5 edit .. //depot/projects/gdb/sys/fs/procfs/procfs_regs.c#5 edit Differences ... ==== //depot/projects/gdb/sys/fs/procfs/procfs_dbregs.c#5 (text+ko) ==== @@ -55,6 +55,8 @@ #include #include +#include + #include #include @@ -62,9 +64,16 @@ extern struct sysentvec ia32_freebsd_sysvec; #endif +static struct ptregset default_dbreg = { + .rs_size = sizeof(struct dbreg), + .rs_read = (ptregset_readf)fill_dbregs, + .rs_write = (ptregset_writef)set_dbregs +}; + int procfs_doprocdbregs(PFS_FILL_ARGS) { + struct ptregset *rs; struct sysentvec *sv; struct thread *td2; void *buf; @@ -77,41 +86,35 @@ return (EPERM); } - /* XXXKSE: */ - td2 = FIRST_THREAD_IN_PROC(p); - sv = td2->td_proc->p_sysent; + sv = p->p_sysent; + rs = (sv->sv_dbreg != NULL) ? sv->sv_dbreg : &default_dbreg; + PROC_UNLOCK(p); - if (sv->sv_dbreg == NULL) { - PROC_UNLOCK(p); - return (ENXIO); - } #ifdef COMPAT_IA32 if (td->td_proc->p_sysent == &ia32_freebsd_sysvec && - sv != &ia32_freebsd_sysvec) { - PROC_UNLOCK(p); + sv != &ia32_freebsd_sysvec) return (EINVAL); - } #endif - PROC_UNLOCK(p); - buf = malloc(sv->sv_dbreg->rs_size, M_TEMP, M_WAITOK); + buf = malloc(rs->rs_size, M_TEMP, M_WAITOK); if (buf == NULL) return (ENOMEM); PROC_LOCK(p); - error = ptrace_read_regf(td2, buf, sv->sv_dbreg->rs_read); + /* XXXKSE: */ + td2 = FIRST_THREAD_IN_PROC(p); + error = ptrace_read_regf(td2, buf, rs->rs_read); if (error == 0) { PROC_UNLOCK(p); - error = uiomove_frombuf(buf, sv->sv_dbreg->rs_size, uio); + error = uiomove_frombuf(buf, rs->rs_size, uio); PROC_LOCK(p); } if (error == 0 && uio->uio_rw == UIO_WRITE) { - if (!P_SHOULDSTOP(p)) /* XXXKSE should be P_TRACED? */ + if (!P_SHOULDSTOP(p)) error = EBUSY; else /* XXXKSE: */ - error = ptrace_write_regf(td2, buf, - sv->sv_dbreg->rs_write); + error = ptrace_write_regf(td2, buf, rs->rs_write); } PROC_UNLOCK(p); ==== //depot/projects/gdb/sys/fs/procfs/procfs_fpregs.c#5 (text+ko) ==== @@ -49,6 +49,8 @@ #include #include +#include + #include #include @@ -56,9 +58,16 @@ extern struct sysentvec ia32_freebsd_sysvec; #endif +static struct ptregset default_fpreg = { + .rs_size = sizeof(struct fpreg), + .rs_read = (ptregset_readf)fill_fpregs, + .rs_write = (ptregset_writef)set_fpregs +}; + int procfs_doprocfpregs(PFS_FILL_ARGS) { + struct ptregset *rs; struct sysentvec *sv; struct thread *td2; void *buf; @@ -71,33 +80,27 @@ return (EPERM); } - /* XXXKSE: */ - td2 = FIRST_THREAD_IN_PROC(p); - sv = td2->td_proc->p_sysent; - - if (sv->sv_fpreg == NULL) { - PROC_UNLOCK(p); - return (ENXIO); - } + sv = p->p_sysent; + rs = (sv->sv_fpreg != NULL) ? sv->sv_fpreg : &default_fpreg; + PROC_UNLOCK(p); #ifdef COMPAT_IA32 if (td->td_proc->p_sysent == &ia32_freebsd_sysvec && - sv != &ia32_freebsd_sysvec) { - PROC_UNLOCK(p); + sv != &ia32_freebsd_sysvec) return (EINVAL); - } #endif - PROC_UNLOCK(p); - buf = malloc(sv->sv_fpreg->rs_size, M_TEMP, M_WAITOK); + buf = malloc(rs->rs_size, M_TEMP, M_WAITOK); if (buf == NULL) return (ENOMEM); PROC_LOCK(p); - error = ptrace_read_regf(td2, buf, sv->sv_fpreg->rs_read); + /* XXXKSE: */ + td2 = FIRST_THREAD_IN_PROC(p); + error = ptrace_read_regf(td2, buf, rs->rs_read); if (error == 0) { PROC_UNLOCK(p); - error = uiomove_frombuf(buf, sv->sv_fpreg->rs_size, uio); + error = uiomove_frombuf(buf, rs->rs_size, uio); PROC_LOCK(p); } if (error == 0 && uio->uio_rw == UIO_WRITE) { @@ -105,8 +108,7 @@ error = EBUSY; else /* XXXKSE: */ - error = ptrace_write_regf(td2, buf, - sv->sv_fpreg->rs_write); + error = ptrace_write_regf(td2, buf, rs->rs_write); } PROC_UNLOCK(p); ==== //depot/projects/gdb/sys/fs/procfs/procfs_regs.c#5 (text+ko) ==== @@ -49,6 +49,8 @@ #include #include +#include + #include #include @@ -56,9 +58,16 @@ extern struct sysentvec ia32_freebsd_sysvec; #endif +static struct ptregset default_reg = { + .rs_size = sizeof(struct reg), + .rs_read = (ptregset_readf)fill_regs, + .rs_write = (ptregset_writef)set_regs +}; + int procfs_doprocregs(PFS_FILL_ARGS) { + struct ptregset *rs; struct sysentvec *sv; struct thread *td2; void *buf; @@ -71,33 +80,27 @@ return (EPERM); } - /* XXXKSE: */ - td2 = FIRST_THREAD_IN_PROC(p); - sv = td2->td_proc->p_sysent; - - if (sv->sv_reg == NULL) { - PROC_UNLOCK(p); - return (ENXIO); - } + sv = p->p_sysent; + rs = (sv->sv_reg != NULL) ? sv->sv_reg : &default_reg; + PROC_UNLOCK(p); #ifdef COMPAT_IA32 if (td->td_proc->p_sysent == &ia32_freebsd_sysvec && - sv != &ia32_freebsd_sysvec) { - PROC_UNLOCK(p); + sv != &ia32_freebsd_sysvec) return (EINVAL); - } #endif - PROC_UNLOCK(p); - buf = malloc(sv->sv_reg->rs_size, M_TEMP, M_WAITOK); + buf = malloc(rs->rs_size, M_TEMP, M_WAITOK); if (buf == NULL) return (ENOMEM); PROC_LOCK(p); - error = ptrace_read_regf(td2, buf, sv->sv_reg->rs_read); + /* XXXKSE: */ + td2 = FIRST_THREAD_IN_PROC(p); + error = ptrace_read_regf(td2, buf, rs->rs_read); if (error == 0) { PROC_UNLOCK(p); - error = uiomove_frombuf(buf, sv->sv_reg->rs_size, uio); + error = uiomove_frombuf(buf, rs->rs_size, uio); PROC_LOCK(p); } if (error == 0 && uio->uio_rw == UIO_WRITE) { @@ -105,8 +108,7 @@ error = EBUSY; else /* XXXKSE: */ - error = ptrace_write_regf(td2, buf, - sv->sv_reg->rs_write); + error = ptrace_write_regf(td2, buf, rs->rs_write); } PROC_UNLOCK(p);