first commit of extra ptrace code for fault injection

This commit is contained in:
Philip Homburg 2006-08-28 14:59:56 +00:00
parent 62cb625f1b
commit c5efbf71c0

View file

@ -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);
}