You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/03/12 19:27:30 UTC
[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5729: arch/xtensa: Small improvements around xtensa_context
gustavonihei commented on a change in pull request #5729:
URL: https://github.com/apache/incubator-nuttx/pull/5729#discussion_r825340332
##########
File path: arch/xtensa/src/common/xtensa_context.S
##########
@@ -164,16 +161,28 @@ _xtensa_context_save:
#error Overlay support is not implemented
#endif
- s32i a0, a2, (4 * REG_TMP0) /* Save return address */
- s32i sp, a2, (4 * REG_TMP1) /* Save current stack pointer */
- wsr a2, EXCSAVE_1 /* Preserve register save area */
-
- l32i sp, a2, (4 * REG_A1) /* Restore the interruptee's SP */
- call0 _xtensa_window_spill /* Preserves only a4-a5, a8-a9, a12-a13 */
+ s32i a0, sp, (4 * REG_TMP0)
+ rsr a2, PS /* to be restored after SPILL_ALL_WINDOWS */
+ movi a0, PS_INTLEVEL_MASK
+ and a3, a2, a0 /* get the current INTLEVEL */
+ bgeui a3, XCHAL_EXCM_LEVEL, 1f /* calculate max(INTLEVEL, XCHAL_EXCM_LEVEL) */
+ movi a3, XCHAL_EXCM_LEVEL
+1:
+ movi a0, PS_UM | PS_WOE /* clear EXCM, enable window overflow, set new INTLEVEL */
+ or a3, a3, a0
+ wsr a3, ps
+ rsync
+ rsr a0, EPC1 /* to be restored after SPILL_ALL_WINDOWS */
+
+ addi sp, sp, XCPTCONTEXT_SIZE /* go back to spill register region */
+ SPILL_ALL_WINDOWS /* place the live register windows there */
+ addi sp, sp, -XCPTCONTEXT_SIZE /* return the current stack pointer and proceed with context save*/
+
+ wsr a2, PS /* restore to the value at entry */
+ wsr a0, EPC1 /* likewise */
+ rsync
+ l32i a0, sp, (4 * REG_TMP0)
Review comment:
This new piece of code is indented with spaces, while the others are indented with tabs.
Please, uniformize it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org