From: Philip Homburg Date: Fri, 30 Sep 2005 12:57:30 +0000 (+0000) Subject: Added MIOCMAP and MIOCUNMAP ioctls. X-Git-Tag: v3.1.2a~683 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=e281ad893ddf2633970c6c3c3c5677db594dbc84;p=minix.git Added MIOCMAP and MIOCUNMAP ioctls. --- diff --git a/drivers/memory/memory.c b/drivers/memory/memory.c index bac418040..280b8c9ce 100644 --- a/drivers/memory/memory.c +++ b/drivers/memory/memory.c @@ -21,6 +21,8 @@ #include "../../kernel/config.h" #include "../../kernel/type.h" +#include + #include "assert.h" #define NR_DEVS 6 /* number of minor devices */ @@ -310,6 +312,26 @@ message *m_ptr; /* pointer to control message */ } break; } + case MIOCMAP: + case MIOCUNMAP: { + int r, do_map; + struct mapreq mapreq; + + if (m_device != MEM_DEV) + return ENOTTY; + + do_map= (m_ptr->REQUEST == MIOCMAP); /* else unmap */ + + /* Get request structure */ + r= sys_vircopy(m_ptr->PROC_NR, D, (vir_bytes)m_ptr->ADDRESS, + SELF, D, (vir_bytes)&mapreq, sizeof(mapreq)); + if (r != OK) + return r; + r= sys_vm_map(m_ptr->PROC_NR, do_map, + (phys_bytes)mapreq.base, mapreq.size, mapreq.offset); + printf("m_ioctl MIOC(UN)MAP: result %d\n", r); + return r; + } default: return(do_diocntl(&m_dtab, m_ptr));