mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-10-31 04:59:55 +00:00 
			
		
		
		
	 a5d5ee7445
			
		
	
	a5d5ee7445
	
	
	
		
			
			This commit deprecates the "freertos/xtensa_context.h" and "xtensa/xtensa_context.h" include paths. Users should use "xtensa_context.h" instead. - Replace legacy include paths - Removed some unnecessary includes of "xtensa_api.h" - Add warning to compatibility header
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
 | |
|  *
 | |
|  * SPDX-License-Identifier: Apache-2.0
 | |
|  */
 | |
| 
 | |
| #include "xtensa_context.h"
 | |
| #include "esp_private/panic_internal.h"
 | |
| 
 | |
| extern void esp_panic_handler(panic_info_t *info);
 | |
| extern volatile bool g_override_illegal_instruction;
 | |
| 
 | |
| void __real_esp_panic_handler(panic_info_t *info);
 | |
| void __real_esp_cpu_stall(int core_id);
 | |
| 
 | |
| /* Memprot test specific IllegalInstruction exception handler:
 | |
|  * when testing the protection against a code execution, sample code
 | |
|  * is being injected into various memory regions which produces
 | |
|  * EXCCAUSE_ILLEGAL on execution attempt. Such a result is expected
 | |
|  * but it causes system reboot in the standard panic handler.
 | |
|  * The following variant of panic handling simply returns back to the
 | |
|  * next instruction and continues normal execution.
 | |
|  *
 | |
|  * NOTE: if EXCCAUSE_ILLEGAL comes from a different source than the testing code
 | |
|  * the behavior is undefined
 | |
|  * */
 | |
| void __wrap_esp_panic_handler(panic_info_t *info)
 | |
| {
 | |
|     XtExcFrame *frm = (XtExcFrame *)info->frame;
 | |
|     if (frm->exccause == EXCCAUSE_ILLEGAL && g_override_illegal_instruction == true) {
 | |
|         frm->pc = frm->a0;
 | |
|         return;
 | |
|     } else {
 | |
|         __real_esp_panic_handler(info);
 | |
|     }
 | |
| }
 | |
| 
 | |
| void __wrap_esp_cpu_stall(int core_id)
 | |
| {
 | |
|     if (g_override_illegal_instruction == true) {
 | |
|         return;
 | |
|     } else {
 | |
|         __real_esp_cpu_stall(core_id);
 | |
|     }
 | |
| }
 |