Fixed a bug in do_sdevio() that broke I/O size computations.

Removed redundant size computations.
Cleaned up code.
This commit is contained in:
Kees van Reeuwijk 2010-01-14 14:51:23 +00:00
parent 5459f3a607
commit da3b64d8bc
2 changed files with 13 additions and 25 deletions

View file

@ -21,8 +21,9 @@
/*===========================================================================* /*===========================================================================*
* do_sdevio * * do_sdevio *
*===========================================================================*/ *===========================================================================*/
PUBLIC int do_sdevio(m_ptr) PUBLIC int do_sdevio(
register message *m_ptr; /* pointer to request message */ register message *m_ptr /* pointer to request message */
)
{ {
vir_bytes newoffset; vir_bytes newoffset;
endpoint_t newep; endpoint_t newep;
@ -30,7 +31,7 @@ register message *m_ptr; /* pointer to request message */
int count = m_ptr->DIO_VEC_SIZE; int count = m_ptr->DIO_VEC_SIZE;
long port = m_ptr->DIO_PORT; long port = m_ptr->DIO_PORT;
phys_bytes phys_buf; phys_bytes phys_buf;
int i, req_type, req_dir, io_type, size, nr_io_range; int i, req_type, req_dir, size, nr_io_range;
struct proc *rp; struct proc *rp;
struct priv *privp; struct priv *privp;
struct io_range *iorp; struct io_range *iorp;
@ -103,25 +104,18 @@ register message *m_ptr; /* pointer to request message */
vm_set_cr3(destproc); vm_set_cr3(destproc);
switch (io_type) switch (req_type)
{ {
case _DIO_BYTE: size= 1; break; case _DIO_BYTE: size= 1; break;
case _DIO_WORD: size= 2; break; case _DIO_WORD: size= 2; break;
case _DIO_LONG: size= 4; break; case _DIO_LONG: size= 4; break;
default: size= 4; break; /* Be conservative */ default: size= 4; break; /* Be conservative */
} }
rp= proc_addr(who_p); rp= proc_addr(who_p);
privp= priv(rp); privp= priv(rp);
if (privp && privp->s_flags & CHECK_IO_PORT) if (privp && privp->s_flags & CHECK_IO_PORT)
{ {
switch (io_type)
{
case _DIO_BYTE: size= 1; break;
case _DIO_WORD: size= 2; break;
case _DIO_LONG: size= 4; break;
default: size= 4; break; /* Be conservative */
}
port= m_ptr->DIO_PORT; port= m_ptr->DIO_PORT;
nr_io_range= privp->s_nr_io_range; nr_io_range= privp->s_nr_io_range;
for (i= 0, iorp= privp->s_io_tab; i<nr_io_range; i++, iorp++) for (i= 0, iorp= privp->s_io_tab; i<nr_io_range; i++, iorp++)

View file

@ -17,8 +17,9 @@
/*===========================================================================* /*===========================================================================*
* do_devio * * do_devio *
*===========================================================================*/ *===========================================================================*/
PUBLIC int do_devio(m_ptr) PUBLIC int do_devio(
register message *m_ptr; /* pointer to request message */ register message *m_ptr /* pointer to request message */
)
{ {
struct proc *rp; struct proc *rp;
struct priv *privp; struct priv *privp;
@ -30,13 +31,13 @@ register message *m_ptr; /* pointer to request message */
io_type = m_ptr->DIO_REQUEST & _DIO_TYPEMASK; io_type = m_ptr->DIO_REQUEST & _DIO_TYPEMASK;
io_dir = m_ptr->DIO_REQUEST & _DIO_DIRMASK; io_dir = m_ptr->DIO_REQUEST & _DIO_DIRMASK;
switch (io_type) switch (io_type)
{ {
case _DIO_BYTE: size= 1; break; case _DIO_BYTE: size= 1; break;
case _DIO_WORD: size= 2; break; case _DIO_WORD: size= 2; break;
case _DIO_LONG: size= 4; break; case _DIO_LONG: size= 4; break;
default: size= 4; break; /* Be conservative */ default: size= 4; break; /* Be conservative */
} }
rp= proc_addr(who_p); rp= proc_addr(who_p);
privp= priv(rp); privp= priv(rp);
@ -47,13 +48,6 @@ register message *m_ptr; /* pointer to request message */
} }
if (privp->s_flags & CHECK_IO_PORT) if (privp->s_flags & CHECK_IO_PORT)
{ {
switch (io_type)
{
case _DIO_BYTE: size= 1; break;
case _DIO_WORD: size= 2; break;
case _DIO_LONG: size= 4; break;
default: size= 4; break; /* Be conservative */
}
port= m_ptr->DIO_PORT; port= m_ptr->DIO_PORT;
nr_io_range= privp->s_nr_io_range; nr_io_range= privp->s_nr_io_range;
for (i= 0, iorp= privp->s_io_tab; i<nr_io_range; i++, iorp++) for (i= 0, iorp= privp->s_io_tab; i<nr_io_range; i++, iorp++)