From e281ad893ddf2633970c6c3c3c5677db594dbc84 Mon Sep 17 00:00:00 2001 From: Philip Homburg Date: Fri, 30 Sep 2005 12:57:30 +0000 Subject: [PATCH] Added MIOCMAP and MIOCUNMAP ioctls. --- drivers/memory/memory.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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));