NAME | SYNOPSIS | FEATURES | DESCRIPTION | ALLOWED CALLING CONTEXTS | ATTRIBUTES | SEE ALSO
#include <dki/f_dki.h>KnError svAsyncExcepAttach(CpuExcepHandler excepHandler, void * excepCookie, CpuExcepId * excepId);
DKI
Provides UltraSPARC asynchronous exceptions management services.
svAsyncExcepAttach attaches a given exception handler to the UltraSPARC 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 succes, 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 follwing 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 in cases where 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, the host bus driver exception handler simply notifies an appropriate child driver (via the error handler invocation) if the exception is due to an I/O access initiated by this driver. In this case, the exception is recoverable and the host bus driver asks the microkernel to continue execution returning CPU_EXCEP_CLAIMED .
Note that multiple handlers may be attached to the asynchronous exceptions. When an exception occurs, the microkernel invokes all handlers sequentially iterating through the handlers list. Once 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 and data caches and asynchronous exceptions, sets NPC to PC+4 and returns from the exception. Note that NPC is incorrect when an asynchronous exception occurs, and 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. Note that the specific I/O service routines provided by the UltrsSPARC DKI allow drivers to recover from an asynchronous exception caused by this type of service routine.
The microkernel considers the exception as unrecoverable and panics, if all exception handlers return CPU_EXCEP_UNCLAIMED .
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 | FEATURES | DESCRIPTION | ALLOWED CALLING CONTEXTS | ATTRIBUTES | SEE ALSO