From 816ddc886753183e006b88396284e10d5ab1a491 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Wed, 29 Jun 2022 22:19:33 +0800 Subject: [PATCH] freertos(SMP): Fix SMP FreeRTOS portDISABLE_INTERRUPTS() macro on xtensa port The portDISABLE_INTERRUPTS() macro on Xtensa should return only the interrupt mask/level before the interrupts were disabled. Previously, the entire contents of PS register were returned (i.e., direct return from RSIL instruction without any bit masking or shifting). This commit fixes the portDISABLE_INTERRUPTS() macro to return the INTLEVEL bitfield of the PS register. --- .../portable/xtensa/include/freertos/portmacro.h | 1 + 1 file changed, 1 insertion(+) diff --git a/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos/portmacro.h index 6121f981cb..ae8b5875b6 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel-SMP/portable/xtensa/include/freertos/portmacro.h @@ -143,6 +143,7 @@ void vPortCleanUpTCB ( void *pxTCB ); #define portDISABLE_INTERRUPTS() ({ \ unsigned int prev_level = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); \ portbenchmarkINTERRUPT_DISABLE(); \ + prev_level = ((prev_level >> XCHAL_PS_INTLEVEL_SHIFT) & XCHAL_PS_INTLEVEL_MASK); \ prev_level; \ })