当前位置:网站首页>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.
边栏推荐
- 小艺人黄鑫洋受邀参加巴黎时装周儿童单元武汉站
- [JS] - [throttling and anti shake function]
- Idea package together, using compact middle packages to solve &
- Study notes 22/1/19 and 22/1/20
- B_QuRT_User_Guide(29)
- 【js】-【节流、防抖函数】
- Section 9: dual core startup of zynq
- MySQL single table access method
- 图像翻译:UVCGAN: UNET VISION TRANSFORMER CYCLE-CONSISTENT GAN FOR UNPAIRED IMAGE-TO-IMAGE TRANSLATION
- Redis persistence problem and final solution
猜你喜欢

Today's notes 22/1/7

Activity隐式跳转

22/02/14 study notes

flex布局

Soft exam -- software designer -- afternoon question data flow diagram DFD

Disposition Flex

GPIO configuration of SOC

图像翻译/Transformer:ITTR: Unpaired Image-to-Image Translation with Transformers用Transfor进行非配对图像对图像的转换

Eslint syntax monitoring off

Devops foundation chapter Jenkins deployment (II)
随机推荐
【学习笔记】差分约束
你了解TCP协议吗(一)?
[shangpinhui] project notes
B_QuRT_User_Guide(28)
Airflow2.1.1 summary of the pits stepped on in actual combat!!
asp. Net to search products and realize paging function
MySQL row format parsing
Devops Basics: Jenkins deployment and use (I)
Prometheus monitoring (I)
Update pip to the latest version
ZYNQ_ IIC read / write m24m01 record board status
Vagrant installation
Flex layout
Do you know TCP protocol (2)?
三角变换公式
sql主從複制搭建
How to use redis to solve concurrency problems
Ambari (VI) -- ambari API use
Today's notes 22/1/7
HJ base conversion