rtems-libbsd copyinstr

Joel Sherrill joel.sherrill at OARcorp.com
Thu Apr 19 18:44:00 UTC 2012

On 04/19/2012 01:59 AM, Sebastian Huber wrote:
> On 04/18/2012 05:54 PM, Joel Sherrill wrote:
>> On 04/18/2012 10:33 AM, Sebastian Huber wrote:
>>> On 04/18/2012 04:59 PM, Joel Sherrill wrote:
>>>> Hi,
>>>> copyinstr is currently undefined. According to cscope,
>>>> it is only defined in
>>>> powerpc/aim/copyinout.c
>>>> powerpc/booke/copyinout.c
>>>> in the source we are using. But when I look where it is
>>>> referenced in rtems-libbsd, it should have a generic
>>>> implementation. And these files have much more than this
>>>> one routine.
>>>> Any thoughts?
>>> I think these are the user/kernel space copy routines. Do we need them at all?
>> My gut was that we could have our own implementation which
>> called memcpy. We don't have user/kernel space but it does appear
>> to be copying data.
> These functions are documented here:
> http://www.freebsd.org/cgi/man.cgi?query=copy
> Maybe it is sufficient so simply assign the kernel address to the user pointer
> and vice versa?
 From the man page linked to...

The copy functions are designed to copy contiguous data from one address
to another.  All but copystr() copy data from user-space to kernel-space
or vice-versa.

I propose we implement those needed with memmove() in case the
addresses are overlapping.

If the source and destination addresses are the same, then
we could just return and avoid it. I don't know if this happens though.
But memmove() is save.

Joel Sherrill, Ph.D.             Director of Research&   Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
     Support Available             (256) 722-9985

More information about the devel mailing list