From: Philip Homburg Date: Mon, 28 Aug 2006 14:59:56 +0000 (+0000) Subject: first commit of extra ptrace code for fault injection X-Git-Tag: v3.1.3~189 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=c5efbf71c0ea6fb9925fafc68c861ab6636fe14b;p=minix.git first commit of extra ptrace code for fault injection --- diff --git a/kernel/system/do_trace.c b/kernel/system/do_trace.c index 0ff740470..8977ceaad 100644 --- a/kernel/system/do_trace.c +++ b/kernel/system/do_trace.c @@ -45,6 +45,7 @@ register message *m_ptr; long tr_data = m_ptr->CTL_DATA; int tr_request = m_ptr->CTL_REQUEST; int tr_proc_nr_e = m_ptr->CTL_ENDPT, tr_proc_nr; + unsigned char ub; int i; if(!isokendpt(tr_proc_nr_e, &tr_proc_nr)) return(EINVAL); @@ -137,6 +138,32 @@ register message *m_ptr; m_ptr->CTL_DATA = 0; break; + case T_READB_INS: /* get value from instruction space */ + if (rp->p_memmap[T].mem_len != 0) { + if ((dst = umap_local(rp, T, tr_addr, 1)) == 0) return(EFAULT); + phys_copy(dst, vir2phys(&ub), (phys_bytes) 1); + m_ptr->CTL_DATA = ub; + break; + } + + if ((dst = umap_local(rp, D, tr_addr, 1)) == 0) return(EFAULT); + phys_copy(dst, vir2phys(&ub), (phys_bytes) 1); + m_ptr->CTL_DATA = ub; + break; + + case T_WRITEB_INS: /* set value in instruction space */ + if (rp->p_memmap[T].mem_len != 0) { + if ((dst = umap_local(rp, T, tr_addr, 1)) == 0) return(EFAULT); + phys_copy(vir2phys(&tr_data), dst, (phys_bytes) 1); + m_ptr->CTL_DATA = 0; + break; + } + + if ((dst = umap_local(rp, D, tr_addr, 1)) == 0) return(EFAULT); + phys_copy(vir2phys(&tr_data), dst, (phys_bytes) 1); + m_ptr->CTL_DATA = 0; + break; + default: return(EIO); }