This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Autoconfiguration question


Hi,

On 02/28/2011 11:51 AM, Schwarz, Konrad wrote:
> GCC generates calls to memcpy() to implement assignment of structures larger than some internally-defined size.  After studying the manual, I am convinced it is not possible to turn this off.  GCC requires the standard library to provide these routines.

FWIW it seems GCC for PPC in current SVN trunk has the
-mblock-move-inline-limit= option that lets the user control when a call
to memcpy is emitted. But maybe this flag is more recent than your
version of GCC.

> For a 32-bit implementation, in particular in the e200 series of cores, the 32-bit only store/load multiple word instructions are a convenient and fast way of context switching the 32-bit portion of the task context; to keep interrupt-service-routine latency low, only the minimal context should be saved when entering an ISR, which is also handily achieved by the load/store multiple word instructions; ISR authors can't be faulted when GCC emits calls to memcpy()--it is not even clear when exactly GCC will do this.

I would argue that ISR authors can't be faulted for calling memcpy
directly either.

But the version of memcpy called from ISR context may well need to be
different from the memcpy in user space context: different context,
different rules.

> A memcpy() that traps and causes each task to aquire extended context is of questional value anyhow for predominantly integer code. 

Do you mean in general, or for your particular combination of CPU, OS
and application?

Just my opinion, but I think it really depends a lot on the workload,
and how well the OS/environment (ISR handlers, context switching)
handles it.

For instance, the context switching code may well reset the status
register after a while, so there is no need to use an extended context
until the next call to memcpy.

That said, I have no idea what approach is best in the common case, so
you may well be right that it's not optimal.


Cheers,
Jean-Marc


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]