Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!udel!mmdf From: minixug!root@nluug.nl (The Master) Newsgroups: comp.os.minix Subject: mem_copy problem in MM Message-ID: <21169@nigel.udel.EDU> Date: 6 Jun 90 04:19:53 GMT Sender: mmdf@udel.EDU Lines: 47 Hi! I have a problem, and I don't know what I am doing wrong here. Thus, it is probably some very obvious error... In MM, I have a structure of data, say: PUBLIC struct testdata testdata; Now, I add a system call with format m1, which has a pointer to a similar structure in user space. The ptr is in m1_p1. To copy the MM version of the data to the address in user space, I can use the following code: vir_bytes src, dst; int len, r; /* Get the SRC and DST addresses right. */ src = (vir_bytes) &testdada; dst = (vir_bytes) mm_in.m1_p1; len = sizeof(struct testdata); r = mem_copy(MM_PROC_NR, D, (long) src, who, D, (long) dst, (long) len); return(r); Now, when I call this system call with the function: #include #include #include #include int testit(bufp) struct testdata *bufp; { int st; st = callm1(MM, TESTCALL, 0, 0, 0, bufp, NIL_PTR, NIL_PTR); return(st); } I get the result "-1", and perror() says "Invalid argument" . Does anyone know what is going on here? It is driving me up the wall!