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/01/24 18:09:39 UTC

[GitHub] [incubator-nuttx] pussuw commented on a change in pull request #5322: Mpfs build protected

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



##########
File path: arch/risc-v/src/common/riscv_pmp.c
##########
@@ -44,6 +58,361 @@
       reg |= attr << (offset * PMP_CFG_BITS_CNT); \
     } while(0);
 
+#define PMP_READ_REGION_FROM_REG(region, reg) \
+  ({ \
+    uintptr_t tmp = READ_CSR(reg); \
+    tmp >>= ((region % PMP_CFG_CNT_IN_REG) * PMP_CFG_BITS_CNT); \
+    tmp &= PMP_CFG_FLAG_MASK; \
+    tmp; \
+  })
+
+#ifndef min
+#define min(a,b) ((a) < (b) ? (a) : (b))
+#endif
+
+#ifndef max
+#define max(a,b) ((a) > (b) ? (a) : (b))
+#endif
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+/* Helper structure for handling a PMP entry */
+
+struct pmp_entry_s
+{
+  uintptr_t base;   /* Base address of region */
+  uintptr_t end;    /* End address of region */
+  uintptr_t size;   /* Region size */
+  uint8_t   mode;   /* Address matching mode */
+  uint8_t   rwx;    /* Access rights */
+};
+
+typedef struct pmp_entry_s pmp_entry_t;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: pmp_check_addrmatch_type
+ *
+ * Description:
+ *   Test if an address matching type is supported by the architecture.
+ *
+ * Input Parameters:
+ *   type - The type to test.
+ *
+ * Returned Value:
+ *   true if it is, false otherwise.
+ *
+ ****************************************************************************/
+
+static bool pmp_check_addrmatch_type(uintptr_t type)
+{
+  /* Parameter is potentially unused */
+
+  (void) type;

Review comment:
       Sure




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