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/04/28 15:14:13 UTC

[GitHub] [incubator-nuttx] gustavonihei commented on a diff in pull request #6167: arch/xtensa: Replace the xcp context with stack context to improve context switching

gustavonihei commented on code in PR #6167:
URL: https://github.com/apache/incubator-nuttx/pull/6167#discussion_r861013872


##########
arch/xtensa/src/common/xtensa.h:
##########
@@ -105,12 +105,9 @@
 
 /* In the XTENSA model, the state is copied from the stack to the TCB, but
  * only a referenced is passed to get the state from the TCB.
- *
- * REVISIT: It would not be too difficult to save only a pointer to the
- * state save area in the TCB and thus avoid the copy.
  */
 
-#define xtensa_savestate(regs)    xtensa_copystate(regs, (uint32_t*)CURRENT_REGS)
+#define xtensa_savestate(regs)    do { regs = (uint32_t *)CURRENT_REGS; } while (0)
 #define xtensa_restorestate(regs) do { CURRENT_REGS = regs; } while (0)

Review Comment:
   ```suggestion
   #define xtensa_savestate(regs)    (regs = (uint32_t *)CURRENT_REGS)
   #define xtensa_restorestate(regs) (CURRENT_REGS = regs)
   ```
   nit: These defines are composed of a single statement, we could remove the `do {...} while(0)`.



-- 
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