You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/03/15 12:11:40 UTC

[GitHub] [incubator-nuttx] pussuw commented on a change in pull request #5746: RISCV: Fix nasty bug in PMP region test

pussuw commented on a change in pull request #5746:
URL: https://github.com/apache/incubator-nuttx/pull/5746#discussion_r826901768



##########
File path: arch/risc-v/src/common/riscv_pmp.c
##########
@@ -318,19 +318,17 @@ static uintptr_t pmp_read_addr(uintptr_t region)
  *
  * Input Parameters:
  *   val  - Value to decode.
- *   base - Base out.
  *   size - Size out.
  *
  * Returned Value:
- *   None
+ *   Base address
  *
  ****************************************************************************/
 
-static void pmp_napot_decode(uintptr_t val, uintptr_t * base,
-                             uintptr_t * size)
+static uintptr_t pmp_napot_decode(uintptr_t val, uintptr_t * size)
 {
-  uint64_t mask = (uint64_t)(-1) >> 1;
-  uint64_t pot  = __riscv_xlen + 2;
+  uintptr_t mask = (uintptr_t)(-1) >> 1;
+  uintptr_t pot  = __riscv_xlen + 2;

Review comment:
       Can you elaborate a bit why __riscv_xlen is undesireable ? As far as I know the compiler provides this definition which can be trusted as long as it is invoked with the correct target type.
   I can of course avoid using it if there is a clear motivation to do so.
   
   Just a note sizeof(uintptr_t) != __riscv_xlen. It is the machine bit width I want here, not the size of uintptr_t in octets.




-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org