no1wudi commented on a change in pull request #5758:
URL: https://github.com/apache/incubator-nuttx/pull/5758#discussion_r828623848
##########
File path: arch/risc-v/src/common/riscv_internal.h
##########
@@ -253,6 +253,19 @@ void riscv_cpu_boot(int cpu);
int riscv_pause_handler(int irq, void *c, void *arg);
#endif
+/****************************************************************************
+ * Name: riscv_mhartid
+ *
+ * Description:
+ * Context aware way to query hart id
+ *
+ * Returned Value:
+ * Hart id
+ *
+ ****************************************************************************/
+
+uint64_t riscv_mhartid(void);
Review comment:
How about extend existing up_cpu_index to support S-mode instead of a
new function ?
```
/* In riscv_cpuindex.c */
int up_cpu_index(void)
{
int mhartid;
asm volatile ("csrr %0, mhartid": "=r" (mhartid));
return mhartid;
}
```
--
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]