Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jul 1997 10:23:04 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        dg@root.com
Cc:        msmith@atrad.adelaide.edu.au, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Location of copyin() and copyout()..
Message-ID:  <199707301723.KAA05290@phaeton.artisoft.com>
In-Reply-To: <199707300310.UAA12221@implode.root.com> from "David Greenman" at Jul 29, 97 08:10:28 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> >If the kernel function(s) use copyin/copyout, they cannot access these
> >buffers, and thus the emulation cannot be performed.
> 
>    I still don't understand. copyin/out is only for copying between the kernel
> and user memory. If this is what you're doing and you don't need the extra
> features of uiomove (which is designed to do piecemeal copies by keeping track
> of offsets/lengths in a struct uio), then copyin/out is the function to use.
> If on the other hand you're copying from kernel<->kernel, then you can just
> use bcopy. I'm afraid that I started reading this thread rather late into it
> and don't have the original context...so what are we talking about? :-)



bsd_syscall_X()
{
	...
	copyin(...);	/* copy in arguments*/

	...  /* do syscall stuff*/

	copyout(...);	/* copy out results*/
}


/*
 * XXX BROKEN!  BSD SYSCALL CALLS COPYIN/COPYOUT, AND CAN NOT USE
 * XXX DATA FROM KERNEL SPACE INSTEAD OF USER SPACE!
 */
linux_syscall_X()
{
	...

	copyin(...);	/* copy in arguments*/

	...	/* massage Linux arguments into BSD format...*/

	/* call BSD call to implement Linux call...*/
	bsd_syscall_X();

	...	/* massage BSD returns into Linux format...*/

	copyout(...);	/* copy out results*/
}


I didn't get this part from his orginal posting either, since
my interpretation of his original posting assumed that he was
worried about kernel preeemption for RT and threading and SMP
(like I was) instead of being worried about calling functions
from within the kernel *from other functions within the kernel*.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707301723.KAA05290>