Added MIOCMAP and MIOCUNMAP ioctls.

This commit is contained in:
Philip Homburg 2005-09-30 12:57:30 +00:00
parent 42e1dad99c
commit e281ad893d

View 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));