pussuw commented on code in PR #6069:
URL: https://github.com/apache/incubator-nuttx/pull/6069#discussion_r851733040


##########
arch/risc-v/src/common/riscv_addrenv.c:
##########
@@ -187,6 +193,38 @@ static int create_spgtables(group_addrenv_t *addrenv)
   return i;
 }
 
+/****************************************************************************
+ * Name: copy_kernel_mappings
+ *
+ * Description:
+ *   Copy kernel mappings to address environment. Expects that the user page
+ *   table does not contain any mappings yet (as they will be wiped).
+ *
+ * Input Parameters:
+ *   addrenv - Describes the address environment. The page tables must exist
+ *      at this point.
+ *
+ * Returned value:
+ *   OK on success, ERROR on failure
+ *
+ ****************************************************************************/
+
+static int copy_kernel_mappings(group_addrenv_t *addrenv)
+{
+  uintptr_t user_mappings = addrenv->spgtables[0];
+
+  /* Copy the L1 references */
+
+  if (user_mappings == 0)
+    {
+      return ERROR;
+    }
+
+  memcpy((void *)user_mappings, (void *)g_kernel_mappings, ENTRIES_PER_PGT);

Review Comment:
   Of course, the entire table needs to be copied. 



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

Reply via email to