IPC@CHIP® RTOS-PPC – API Documentation

Header image

Main page

BOOL TryDejavu ( sTRY_CATCH try_ptr  ) 

This library function provide an exception handling mechanism.

Some signature patterns and program state information are written into the provided stack object. The signatures signal the system to resume execution after a fault at the return address from this function.

When an MMU or other fault (e.g. invalid opcode) occurs, the system will scan the faulting task's stack in search of the signature pattern written by this function into the sTRY_CATCH stack object at try_ptr. If this signature pattern is detected, the system assumes that this stack memory contains a valid sTRY_CATCH and an attempt will be made to resume execution at the point where this library function was called. This return address was recorded in the sTRY_CATCH::tcRtnAdr member.

The following example shows how this function should be used. In any case, the TRY_ERASE() macro should be used to terminate the try/catch sequence.

    sTRY_CATCH myCatch ;
    if (TryDejavu(&myCatch))
        // ... Reach here after a fault,
        // ... clean up after program fault.

So for the case where a fault occurs, it appears as if the TryDejavu() has returned a second time. The second time it magically returns with a zero return value to indicate that the fault has occurred. Interrupts will be enabled regardless of their masking state at the time of the fault.

try_ptr Pointer to object on stack used to mark program state information needed for recovery after a fault. (Note that it is essential that this object be on the stack, otherwise this function serves no purpose.)
1 on return from preparation call (first return).
0 on resume after fault detected.
The function does not exists in the SC1x, SC2x and SC1x3 C-Library.
See also:
SC2x3 V1.00 - CLIB V1.00

Top of page | Main page

Copyright © 2018 Beck IPC GmbH
Generated on Thu Nov 1 13:20:15 2018 by Doxygen 1.6.1