xiaoxiang781216 commented on code in PR #15081: URL: https://github.com/apache/nuttx/pull/15081#discussion_r1886253087
########## arch/risc-v/include/arch.h: ########## @@ -56,6 +56,21 @@ # define ARCH_SPGTS (ARCH_PGT_MAX_LEVELS - 1) #endif +/* Can be used by assembly code to access the structure, example: + * + * Get percpu structure: + * 1: csrr a0, CSR_SCRATCH + * + * Get hartid: + * 2: REGLOAD a0, RISCV_PERCPU_HARTID(a0) Review Comment: it isn't safe to do the action in two steps since the thread might move to the new cpu between them. -- 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]
