zyfeier commented on code in PR #19041:
URL: https://github.com/apache/nuttx/pull/19041#discussion_r3367081275


##########
arch/tricore/include/irq.h:
##########
@@ -314,41 +196,27 @@ static inline_function bool up_interrupt_context(void)
 
 static inline_function uintptr_t up_getusrsp(void *regs)
 {
-  uintptr_t *csaregs = (uintptr_t *)regs;
+  uintptr_t *csa = regs;
 
-  if (csaregs[REG_LPCXI] & PCXI_UL)
+  while (((uintptr_t)csa & PCXI_UL) == 0)
     {
-      csaregs = tricore_csa2addr(csaregs[REG_LPCXI]);
+      csa = tricore_csa2addr((uintptr_t)csa);
+      csa = (uintptr_t *)csa[0];
     }
-  else
-    {
-       csaregs += TC_CONTEXT_REGS;
-    }
-
-  return csaregs[REG_SP];
-}
 
-#endif /* __ASSEMBLY__ */
-
-/****************************************************************************
- * Name: up_switch_context
- ****************************************************************************/
+  csa = tricore_csa2addr((uintptr_t)csa);
 
-#define up_switch_context(tcb, rtcb)                              \

Review Comment:
   keep up_switch_context in irq.h and remove the function in 
tricore_switchcontext.c



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to