From: Philip Homburg Date: Fri, 22 Feb 2008 10:51:37 +0000 (+0000) Subject: Added do_mapdma. X-Git-Tag: v3.1.4~280 X-Git-Url: http://zhaoyanbai.com/repos/icons/static/man.3.ps?a=commitdiff_plain;h=2679321ba05b9419c0d9e8be590c1b7b4dea49a2;p=minix.git Added do_mapdma. --- diff --git a/kernel/system/Makefile b/kernel/system/Makefile index fa1462e30..c6a4a0f66 100644 --- a/kernel/system/Makefile +++ b/kernel/system/Makefile @@ -54,7 +54,8 @@ OBJECTS = \ $(SYSTEM)(do_vm_setbuf.o) \ $(SYSTEM)(do_sprofile.o) \ $(SYSTEM)(do_cprofile.o) \ - $(SYSTEM)(do_profbuf.o) + $(SYSTEM)(do_profbuf.o) \ + $(SYSTEM)(do_mapdma.o) build $(SYSTEM): $(OBJECTS) aal cr $@ *.o @@ -168,3 +169,6 @@ $(SYSTEM)(do_cprofile.o): do_cprofile.c $(SYSTEM)(do_profbuf.o): do_profbuf.c $(CC) do_profbuf.c + +$(SYSTEM)(do_mapdma.o): do_mapdma.c + $(CC) do_mapdma.c diff --git a/kernel/system/do_mapdma.c b/kernel/system/do_mapdma.c new file mode 100644 index 000000000..47f0c43ca --- /dev/null +++ b/kernel/system/do_mapdma.c @@ -0,0 +1,44 @@ +/* The kernel call implemented in this file: + * m_type: SYS_MAPDMA + * + * The parameters for this kernel call are: + * m5_l1: CP_SRC_ADDR (virtual address) + * m5_l3: CP_NR_BYTES (size of datastructure) + */ + +#include "../system.h" + +/*==========================================================================* + * do_mapdma * + *==========================================================================*/ +PUBLIC int do_mapdma(m_ptr) +register message *m_ptr; /* pointer to request message */ +{ + int r; + endpoint_t proc_e; + int proc_p; + vir_bytes base, size; + phys_bytes phys_base; + struct proc *proc; + message m; + + proc_e = m_ptr->CP_SRC_ENDPT; + base= m_ptr->CP_SRC_ADDR; + size= m_ptr->CP_NR_BYTES; + + if (!isokendpt(proc_e, &proc_p)) + return(EINVAL); + + proc = proc_addr(proc_p); + + phys_base= umap_local(proc, D, base, size); + if (!phys_base) + { + kprintf("do_mapdma: umap_local failed\n"); + return EFAULT; + } + + m_ptr->CP_DST_ADDR = phys_base; + return OK; +} +