Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!gatech!gitpyr!stat!curci From: curci@stat.uucp (Ray Curci (scri)) Newsgroups: comp.os.minix Subject: Re: Passing pointers using callm1() (sendrec()) Message-ID: <7588@pyr.gatech.EDU> Date: 14 Mar 89 15:41:29 GMT References: <7575@pyr.gatech.EDU> Sender: news@pyr.gatech.EDU Reply-To: curci@stat.fsu.edu (Ray Curci (scri)) Organization: Dept. of Statistics, Florida State Univ. Lines: 25 In article <7575@pyr.gatech.EDU> curci@stat.fsu.edu (Ray Curci (scri)) writes: >I have written a minix device driver that sends packets of data between >minix machines. The send and receive routines attempt to pass a pointer >to a buffer using M.m1_p1. The problem is that when the device driver >receives the message, the pointer appears to be relative to the caller's >data or stack segment. To get at the buffer of data I have tried using >many combinations of proc_addr(), umap(), and phys_copy() without success. >Can anyone send me a simple example of how to do this? For starters, I >am simply trying to have my task copy the user's buffer into my own >local buffer. I will post a summary of responses to the newsgroup. >ray curci >curci@stat.fsu.edu After spending all night until 5am experimenting, I have found the answer to my own question. Assuming my process is called TRANSPORT and I have received the message in msg with a pointer to a 128 byte buffer in m1_p1: static unsigned char localbuf[128]; phys_bytes src, dest, umap(); src = umap(proc_addr(msg.m_source),D,(vir_bytes)msg.m1_p1,128); dest= umap(proc_addr(TRANSPORT),D,(vir_bytes)localbuf,128); if (src != (phys_bytes)0) phys_copy(src,dest,(phys_bytes)128); curci@stat.fsu.edu