This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new fb92b60000 arch/risc-v: Minor document improvement
fb92b60000 is described below

commit fb92b60000eb6f3d90470d01bee5aafcb2f1cc9a
Author: Huang Qi <huang...@xiaomi.com>
AuthorDate: Wed Nov 20 19:16:57 2024 +0800

    arch/risc-v: Minor document improvement
    
    Add function description for function prototype of `riscv_jump_to_user`
    to make it easier to read, and fix some inconsistent comment style in
    `riscv_internal.h`.
    
    Signed-off-by: Huang Qi <huang...@xiaomi.com>
---
 arch/risc-v/src/common/riscv_internal.h | 52 +++++++++++++++++++++++++++++----
 1 file changed, 46 insertions(+), 6 deletions(-)

diff --git a/arch/risc-v/src/common/riscv_internal.h 
b/arch/risc-v/src/common/riscv_internal.h
index ffa85d5450..a24245c69a 100644
--- a/arch/risc-v/src/common/riscv_internal.h
+++ b/arch/risc-v/src/common/riscv_internal.h
@@ -82,6 +82,7 @@
 #define STACK_ALIGN_UP(a)   (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK)
 
 /* Interrupt Stack macros */
+
 #define INT_STACK_SIZE  (STACK_ALIGN_DOWN(CONFIG_ARCH_INTERRUPTSTACK))
 
 /* Determine which (if any) console driver to use.  If a console is enabled
@@ -455,24 +456,63 @@ int riscv_cpuid_to_hartid(int cpu);
 void *riscv_perform_syscall(uintreg_t *regs);
 #endif
 
+/****************************************************************************
+ * Name: riscv_jump_to_user
+ *
+ * Description:
+ *   Routine to jump to user space, called when a user process is started and
+ *   the kernel is ready to give control to the user task in user space.
+ *
+ * Parameters:
+ *   entry - Process entry point.
+ *   a0    - Parameter 0 for the process.
+ *   a1    - Parameter 1 for the process.
+ *   a2    - Parameter 2 for the process.
+ *   sp    - User stack pointer.
+ *   regs  - Integer register save area to use.
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
 void riscv_jump_to_user(uintptr_t entry, uintreg_t a0, uintreg_t a1,
                         uintreg_t a2, uintreg_t sp,
                         uintreg_t *regs) noreturn_function;
 
 /* Context switching via system calls ***************************************/
 
-/* SYS call 1:
+/****************************************************************************
+ * Name: riscv_fullcontextrestore
  *
- * void riscv_fullcontextrestore(struct tcb_s *next) noreturn_function;
- */
+ * Description:
+ *   Restores the full context of the next task.
+ *
+ * Parameters:
+ *   next - Pointer to the next task control block.
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
 
 #define riscv_fullcontextrestore(next) \
   sys_call1(SYS_restore_context, (uintptr_t)next)
 
-/* SYS call 2:
+/****************************************************************************
+ * Name: riscv_switchcontext
  *
- * riscv_switchcontext(struct tcb_s *prev, struct tcb_s *next);
- */
+ * Description:
+ *   Switches the context from the previous task to the next task.
+ *
+ * Parameters:
+ *   prev - Pointer to the previous task control block.
+ *   next - Pointer to the next task control block.
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
 
 #define riscv_switchcontext(prev, next) \
   sys_call2(SYS_switch_context, (uintptr_t)prev, (uintptr_t)next)

Reply via email to