NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | ALLOWED CALLING CONTEXTS | ATTRIBUTES | SEE ALSO
#include <dki/f_dki.h>KnError svAsyncExcepAttach(CpuExcepHandler excepHandler, void * excepCookie, CpuExcepId * excepId);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
DKI
Provides asynchronous exceptions management services.
svAsyncExcepAttach() attaches a given exception handler to the asynchronous exceptions.
The excepHandler argument specifies the handler to call back when an asynchronous exception occurs.
The excepCookie argument specifies a parameter to pass back to the handler when called. It is opaque to the microkernel.
On success, K_OK is returned and an identifier for the attached exception handler is also returned in excepId . This identifier must be used in subsequent invocations of svAsyncExcepDetach() .
On failure, an error code is returned as follows:
The system is out of memory.
typedef CpuExcepStatus (*CpuExcepHandler) (void* cookie, uint64_f afsr, uint64_f afar);
The asynchronous exception handler is invoked by the microkernel when one of the following bits is set in the Asynchronous Fault Status Register (AFSR):
Time-out from system bus.
Bus error from system bus.
DMA external cache parity error.
The asynchronous exception handler is called with masked CPU interrupts and disabled asynchronous exceptions. In addition, the CPU instruction and data caches are disabled. A cookie, specified in svAsyncExcepAttach() , is passed back to the exception handler as the first argument. The asynchronous fault status and address registers are given to the handler.
The exception handler should return either CPU_EXCEP_CLAIMED or CPU_EXCEP_UNCLAIMED . The CPU_EXCEP_CLAIMED value is returned by the handler when the handler detects that the exception is due to an I/O or DMA access on the underlying bus, and the exception is recoverable. For instance, if the exception is due to an I/O access initiated by this driver, the host bus driver exception handler simply notifies an appropriate child driver (using the error handler invocation). In this case, the exception is recoverable and the host bus driver asks the microkernel to continue execution returning CPU_EXCEP_CLAIMED .
Multiple handlers may be attached to the asynchronous exceptions. When an exception occurs, the microkernel invokes all handlers sequentially iterating through the handlers list. After CPU_EXCEP_CLAIMED is returned by a handler, the iteration is aborted and the microkernel tries to continue the execution. It re-enables the CPU instruction, data caches, and asynchronous exceptions. It then sets NPC to PC+4 and returns from the exception.
NPC is incorrect when an asynchronous exception occurs. Therefore, it should be corrected prior to continuing the execution. As a consequence, accesses to the bus I/O space should be synchronized by issuing a membar #Sync instruction after a load/store one. Also, the membar instruction should not be put in a delayed slot. Otherwise, asynchronous exceptions related to the I/O accesses are not granted to be recoverable.
The specific I/O service routines provided by the DKI allow drivers to recover from an asynchronous exception caused by this type of service routine.
If all exception handlers return CPU_EXCEP_UNCLAIMED , the microkernel considers the exception unrecoverable.
svAsyncExcepDetach() detaches the exception handler previously connected by svAsyncExcepAttach() .
The excepId argument identifies the attached exception handler, previously returned by svAsyncExcepAttach() .
The following table specifies the contexts in which a caller is allowed to invoke each exceptions management service.
Services | Base level | DKI thread | Interrupt | Blocking |
svAsyncExcepAttach() | + | + | - | + |
svAsyncExcepDetach() | + | + | - | + |
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
load_sync_8_usparc(9DKI) , store_sync_8_usparc(9DKI) , loadSwap_sync_16_usparc(9DKI) , storeSwap_sync_16_usparc(9DKI) , load_sync_16_usparc(9DKI) , store_sync_16_usparc(9DKI) , loadSwap_sync_32_usparc(9DKI) , storeSwap_sync_32_usparc(9DKI) , load_sync_32_usparc(9DKI) , store_sync_32_usparc(9DKI) , loadSwap_sync_64_usparc(9DKI) , storeSwap_sync_64_usparc(9DKI) , load_sync_64_usparc(9DKI) , store_sync_64_usparc(9DKI) ,
NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | ALLOWED CALLING CONTEXTS | ATTRIBUTES | SEE ALSO