Example #1
0
volatile void* alt_uncached_malloc (size_t size)
{
  void* ptr;

  ptr = malloc (size);

  alt_dcache_flush (ptr, size);

  return ptr ? (volatile void*) (((alt_u32) ptr) | BYPASS_DCACHE_MASK) : NULL;
}
/*
 * alt_ecc_fatal_exception_register() is called to register a handler to
 * service likely fatal ECC error exceptions. 
 * 
 * Passing null (0x0) in the handler argument will disable a previously-
 * registered handler.
 *
 * Note that if no handler is registered, just normal exception processing
 * occurs on a likely fatal ECC exception and the exception processing
 * code might trigger an infinite exception loop.
 */
void 
alt_ecc_fatal_exception_register(alt_u32 handler)
{
    alt_exception_ecc_fatal_handler = handler;

    /* 
     * Flush this from the cache. Required because the exception handler uses ldwio
     * to read this value to avoid trigger another data cache ECC error exception.
     */
    alt_dcache_flush(&alt_exception_ecc_fatal_handler, sizeof(alt_exception_ecc_fatal_handler));
}