pussuw commented on a change in pull request #5758:
URL: https://github.com/apache/incubator-nuttx/pull/5758#discussion_r829064963
##########
File path: arch/risc-v/src/common/riscv_cpuindex.c
##########
@@ -48,10 +50,14 @@
*
****************************************************************************/
-int up_cpu_index(void)
+uintptr_t riscv_cpuindex(void)
{
- int mhartid;
+ return READ_CSR(mhartid);
+}
- asm volatile ("csrr %0, mhartid": "=r" (mhartid));
- return mhartid;
+#ifdef CONFIG_SMP
+int up_cpu_index(void)
+{
+ return (int)riscv_cpuindex;
Review comment:
This should just become a tail call and is not dependent on preprocessor
substitution, would this solution suffice ?
--
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]