copy, copyin, copyout

Max Laier max at love2party.net
Tue Nov 25 09:55:50 PST 2008


On Tuesday 25 November 2008 18:37:50 Alexej Sokolov wrote:
> Hello,
> could anyone please explain to me the difference between functions:
> copystr() and copyinstr() ?
>
> For i386 copyinstr is implemented in assembler. I can not read
> the assembler code very well.
>
> I tried to allocate a memory in space of user process using vm_map_find
> and then with copystr() I could copy data between user and kernel
> memory. copystr() seemed to be  able to do the same what copyinstr do.

You might get lucky with copystr() if the user page is already resident, but 
if you page fault copystr() will kill the kernel.  copyinstr() handles page 
faults.

-- 
/"\  Best regards,                      | mlaier at freebsd.org
\ /  Max Laier                          | ICQ #67774661
 X   http://pf4freebsd.love2party.net/  | mlaier at EFnet
/ \  ASCII Ribbon Campaign              | Against HTML Mail and News


More information about the freebsd-hackers mailing list