From: Philip Homburg Date: Fri, 4 Nov 2005 17:16:54 +0000 (+0000) Subject: Set IOPL when /dev/mem is opened. Fixed small bug in MIOCMAP/MIOCUNMAP X-Git-Tag: v3.1.2a~516 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/named.html?a=commitdiff_plain;h=df279ac347ed857fef09ad3850623547712ab89a;p=minix.git Set IOPL when /dev/mem is opened. Fixed small bug in MIOCMAP/MIOCUNMAP --- diff --git a/drivers/memory/memory.c b/drivers/memory/memory.c index 5581d6cd3..52162d51e 100644 --- a/drivers/memory/memory.c +++ b/drivers/memory/memory.c @@ -205,8 +205,20 @@ PRIVATE int m_do_open(dp, m_ptr) struct driver *dp; message *m_ptr; { + int r; + /* Check device number on open. */ if (m_prepare(m_ptr->DEVICE) == NIL_DEV) return(ENXIO); + if (m_device == MEM_DEV) + { + r = sys_enable_iop(m_ptr->PROC_NR); + if (r != OK) + { + printf("m_do_open: sys_enable_iop failed for %d: %d\n", + m_ptr->PROC_NR, r); + return r; + } + } return(OK); } @@ -345,6 +357,7 @@ message *m_ptr; /* pointer to control message */ int r, do_map; struct mapreq mapreq; + if ((*dp->dr_prepare)(m_ptr->DEVICE) == NIL_DEV) return(ENXIO); if (m_device != MEM_DEV) return ENOTTY;