pussuw commented on code in PR #15563:
URL: https://github.com/apache/nuttx/pull/15563#discussion_r1916597216


##########
arch/risc-v/include/irq.h:
##########
@@ -749,6 +749,34 @@ int up_this_cpu(void);
  * Inline Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Schedule acceleration macros
+ ****************************************************************************/
+
+/* When thread local storage is disabled (the usual case), the TP
+ * (Thread Pointer) register is available for use as a general purpose
+ * register. We use it to store the current task's TCB pointer for quick
+ * access.
+ * Note: If you want to use TLS (CONFIG_SCHED_THREAD_LOCAL), your toolchain
+ * must be compiled with --enable-tls option to properly support
+ * thread-local storage.
+ */
+
+#ifndef CONFIG_SCHED_THREAD_LOCAL

Review Comment:
   We could use TP when system calls are enabled as well, even when 
SCHED_THREAD_LOCAL is in use.
   
   The current logic in exception_common just needs to be modified to swap user 
TP with kernel TP (from the scratch area) always (not just when a system call 
is taken).
   
   In flat mode where the kernel symbols are directly visible/callable this 
obviously does not work.



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