PBS.c.xx-xxx-xxx File Reference
PBS library, contains the PPC specific code for PBS.
More...
#include <stdlib.h>
#include <strings.h>
|
Functions |
void | PBS_fast_clear (void *ptr, unsigned int nbytes) |
| Clears (Zeroes) the specified memory.
|
Detailed Description
PBS library, contains the PPC specific code for PBS.
- Author:
- JJRussell - russell@slac.stanford.edu
CVS $Id: PBS.c.xx-xxx-xxx,v 1.4 2009/03/26 01:43:11 russell Exp $
Function Documentation
void PBS_fast_clear |
( |
void * |
ptr, |
|
|
unsigned int |
nbytes | |
|
) |
| | |
Clears (Zeroes) the specified memory.
- Parameters:
-
| ptr | Pointer to the memory to zero |
| nbytes | The number of bytes to zero |
- This provides a fast way of zeroing large chunks of memory on PPC platforms using the dcbz instruction. This instruction zeroes a cache line at a time. The savings in speed varies by processor, but factors of 5 or more are in the ballpark, saturating out at a factor of 2 once the data cache size is exceeded (32Kbytes).
- On other platforms, the library supplied routine is used.
- Warning:
- On PPC platforms, this will work if and only if the memory being cleared is cache enabled. For the most part this is not a problem since usually all memory but memory mapped to IO space and set aside for driver use is marked cacheable. This routine does check to make sure the data cache is globally enabled. If not, the generic clear routine is called. The routine is protected if the data cache is globally disabled, in this case, dropping make and using the generic routine.