当前位置:网站首页>B_ QuRT_ User_ Guide(29)
B_ QuRT_ User_ Guide(29)
2022-06-28 08:08:00 【weixin_ thirty-eight million four hundred and ninety-eight thou】
B_QuRT_User_Guide(29)
19 exception handling
QuRT Support exception handling for software errors and hardware exceptions detected by the processor .
Exceptions are considered fatal or non fatal , And deal with it accordingly .
QuRT Handler exception ( Fatal or non fatal )、 Kernel exceptions and imprecise exceptions QuRT Program code threw a program exception —— They include page errors 、 Misaligned load / Storage operations and others Hexagon Processor exceptions, etc . QuRT API You can also throw program exceptions explicitly .
Threads registered as program exception handlers ( The first 3 section ) Handler exception .
Non fatal program exceptions can lead to QuRT Take the following measures :
- Save the context of the relevant hardware thread in the task control block (TCB) in .
- Scheduling registered program exception handling threads ( If there is ), Assign the error message to the parameter waiting for the abnormal operation .
Program exception handlers can be reloaded QuRT Program ( If it has the ability ) Or by termination QuRT The execution of the program system to handle non fatal exceptions .
Be careful : If no program exception handler is registered , Or a registered handler call throws a non fatal exception ,QuRT Will throw a kernel exception .
If the thread is running in supervisor mode , The error will be treated as a kernel exception .
If there are multiple program exceptions , Then all exceptions are forwarded to the program exception handler in the order in which they occur . The exception handler must repeatedly call qurt_exception_wait To handle error messages from queued exceptions .
Fatal program aborts QuRT Execution of program system , Instead of calling the program exception handler . Use programs to handle fatal program exceptions for all system shutdown operations .
By calling raise fatal exception The operation threw a fatal exception , This operation masks Hexagon The processor interrupts and stops Hexagon All other hardware threads in the processor . This operation returns , Therefore, the program can perform the necessary program level closing operations ( Data recording, etc. ).
Once the program is ready to shut down the system , It invokes the fatal close operation to perform the following actions :
- If the operation that throws a fatal exception has not been called , Mask processor interrupts and stop all other hardware threads .
- Save the context of all hardware threads .
- preservation TCM The content of .
- Save all TLB entry .
- Refresh the cache and update the cache refresh status .
- Call the registered fatal notification handler .
- Execute an infinite loop in the current hardware thread .
QuRT The kernel throws a kernel exception —— They include supervisor mode exceptions as well as page errors and other Hexagon Processor exception .
A kernel exception causes QuRT Terminates the execution of the program system and shuts down the system processor , At the same time, the processor state is saved to assist in investigating the problem that caused the exception .
Kernel exceptions can cause QuRT Do the following :
- Save the context of the current hardware thread to the kernel error data structure .
- Save the context of all other active hardware threads to their respective TCB.
- Stop other hardware threads .
- Wait until other hardware threads stop .
- Refresh Hexagon Processor cache .
- shielding Hexagon Processor interrupt .
- Call the registered fatal notification handler .
- Execute an infinite loop in the current hardware thread .
Be careful : Kernel exceptions do not invoke program exception handlers .
Imprecise exceptions can be found in QuRT A serious and unrecoverable error condition raised in the kernel or program code —— They include storing error addresses 、 Hardware parity errors or other imprecise dependent error conditions and unshielded interrupts ( NMI) Hexagon Exception thrown outside the processor .
QuRT Imprecise exceptions are not forwarded to the program exception handler . contrary , The kernel will terminate the execution of the current hardware thread while saving the processor state .
When an imprecise exception occurs ,QuRT Will perform the same procedure as the kernel exception , Only the thread context of all hardware threads is stored in the kernel error data structure .
Be careful : Imprecise exception handlers can override Hexagon Processor registers R23. This does not happen with program or kernel exceptions
Floating point exception —— User programs can optionally enable specific floating-point events ( Imprecise 、 underflow 、 overflow 、 Divided by zero and invalid ) To generate QuRT Abnormal program .
Program exception handling supports the following operations :
- qurt_exception_enable_fp_exceptions()
- qurt_exception_raise_fatal()
- qurt_exception_raise_nonfatal()
- qurt_exception_wait()
- qurt_assert_error()
19.1 qurt_exception_enable_fp_exceptions()
19.1.1 Function document
19.1.1.1 static unsigned int qurt_exception_enable_fp_exceptions ( unsigned int mask )
Enables the specified floating-point exception as QuRT Abnormal program .
By setting Hexagon Control register USR To enable exceptions .
mask Parameter specifies a mask value , Used to identify each floating-point exception to be set . Exceptions are represented as mappings to 32 Bit of flag value 0 Position to the first 31 Defined symbol of bit . Multiple floating-point exceptions are generated by placing each exception symbol “ or ” Designated together .
Be careful : This function must be called before any floating-point operation is performed .
Parameters
in | mask | Floating point exception type . Return value :QURT_FP_EXCEPTION_ALL QURT_FP_EXCEPTION_INEXACT QURT_FP_EXCEPTION_UNDERFLOW QURT_FP_EXCEPTION_OVERFLOW QURT_FP_EXCEPTION_DIVIDE0 QURT_FP_EXCEPTION_INVALID |
Return value
Updated USR The contents of the register .
Dependencies
None.
19.2 qurt_exception_raise_fatal()
19.2.1 Function document
19.2.1.1 void qurt_exception_raise_fatal ( void )
stay QuRT A fatal program exception was thrown in the system .
Fatal program aborts QuRT System execution , Instead of calling the program exception handler .
More about fatal program exceptions , Please refer to the first 19 section .
This operation always returns , So the calling program can perform the necessary closing operation ( Data recording, etc. ).
Be careful : After this operation is called , Context switch does not work .
Return value
None.
Dependencies
None.
19.3 qurt_exception_raise_nonfatal()
19.3.1 Function document
19.3.1.1 int qurt_exception_raise_nonfatal ( int error )
stay QuRT A non fatal program exception is thrown in the program system .
More information about program exceptions , Please refer to the first 19 section .
This operation will never return - Suppose the program exception handler is terminating or reloading QuRT All exception handling is performed before the program system .
Be careful :C Library function abort() Call this operation to indicate a software error .
Parameters
in | error | QuRT Error result code ( The first 25 section ). |
Return value
Integers - not used .
Dependencies
None.
19.4 qurt_exception_wait()
19.4.1 Function document
19.4.1.1 unsigned int qurt_exception_wait ( unsigned int ∗ ip, unsigned int ∗ sp,unsigned int ∗ badva, unsigned int ∗ cause )
Register program exception handlers . This function specifies the current thread as QuRT Program exception handler , And pause the thread until a program exception occurs .
When a program exception occurs , The thread is awakened , Error message the parameters assigned to the operation .
Be careful : If no program exception handler is registered , Or the registered handler calls exit, that QuRT Will throw a kernel exception . If the thread is running in super user mode , Any errors will be treated as kernel exceptions .
Parameters
out | ip | Pointer to the memory address of the instruction where the exception occurred . |
out | sp | Stack pointer . |
out | badva | Pointer to the virtual data address where the exception occurred . |
out | cause | Point to QuRT Pointer to error result code . |
Return value
Registration status :
- Thread identifier —— Handler successfully registered .
- QURT_EFATAL – Registration failed .
Dependencies
None.
19.5 qurt_assert_error()
19.5.1 Function document
19.5.1.1 void qurt_assert_error ( const char ∗ filename, int lineno )
Write diagnostic information to the debug buffer , And to QuRT The kernel raised an error .
Related data types
None.
Parameters
in | filename | Pointer to file name string . |
in | lineno | Line number . |
Return value
None.
Dependencies
None.
边栏推荐
猜你喜欢
flex布局
SQL analysis (query interception analysis for SQL optimization)
Airflow2.x distributed deployment DAG execution failure log cannot be obtained normally
asp. Net datalist when there are multiple data displays
匿名页的反向映射
Porting ucosiii to stm32f429
nlp序列完全可以模拟人脑智能
2022第六季完美童模 佛山赛区 初赛圆满落幕
Image translation /transformer:ittr: unpaired image to image translation with transformers
Prometheus deployment alarm docking QQ mailbox
随机推荐
Idea package together, using compact middle packages to solve &
Prometheus service discovery
B_QuRT_User_Guide(27)
Dataset filling data, and the use of rows and columns
Kubernetes cluster command line tool kubectl
asp. Net registration page
SOC timer and interrupt configuration
es数据导出csv文件
Devops foundation chapter Jenkins deployment (II)
【js】-【节流、防抖函数】
你了解TCP協議嗎(二)?
Ambari (V) ---ambari integrated Azkaban (valid for personal test)
Localization SoC development plan
Is it reliable for securities companies to register and open accounts? Is it safe?
HJ字符个数统计
同花顺注册开户靠谱吗?安全吗?
HJ字符串排序
Uvcgan: unt vision transformer cycle-consistent Gan for unpropared image-to-image translation
Co process, asyncio, asynchronous programming
你了解TCP协议吗(二)?