]> Zhao Yanbai Git Server - minix.git/commitdiff
Added MIOCMAP and MIOCUNMAP ioctls.
authorPhilip Homburg <philip@cs.vu.nl>
Fri, 30 Sep 2005 12:57:30 +0000 (12:57 +0000)
committerPhilip Homburg <philip@cs.vu.nl>
Fri, 30 Sep 2005 12:57:30 +0000 (12:57 +0000)
drivers/memory/memory.c

index bac41804093a6662d48f6348e92b8b1a2f949ff2..280b8c9ce82bb500cc74268c9bb7af262aae8dad 100644 (file)
@@ -21,6 +21,8 @@
 #include "../../kernel/config.h"
 #include "../../kernel/type.h"
 
+#include <sys/vm.h>
+
 #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));