[PATCH v3 03/17] bsd-user: Implement RISC-V CPU register cloning and reset functions

Ajeet Singh posted 17 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH v3 03/17] bsd-user: Implement RISC-V CPU register cloning and reset functions
Posted by Ajeet Singh 1 month, 3 weeks ago
From: Mark Corbin <mark@dibsco.co.uk>

Added functions for cloning CPU registers and resetting the CPU state
for RISC-V architecture.

Signed-off-by: Mark Corbin <mark@dibsco.co.uk>
Signed-off-by: Ajeet Singh <itachis@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 bsd-user/riscv/target_arch_cpu.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/bsd-user/riscv/target_arch_cpu.h b/bsd-user/riscv/target_arch_cpu.h
index eb37b062a3..522cfc099b 100644
--- a/bsd-user/riscv/target_arch_cpu.h
+++ b/bsd-user/riscv/target_arch_cpu.h
@@ -130,4 +130,18 @@ static inline void target_cpu_loop(CPURISCVState *env)
     }
 }
 
+static inline void target_cpu_clone_regs(CPURISCVState *env, target_ulong newsp)
+{
+    if (newsp) {
+        env->gpr[xSP] = newsp;
+    }
+
+    env->gpr[xA0] = 0; /* a0 */
+    env->gpr[xT0] = 0; /* t0 */
+}
+
+static inline void target_cpu_reset(CPUArchState *env)
+{
+}
+
 #endif /* TARGET_ARCH_CPU_H */
-- 
2.34.1
Re: [PATCH v3 03/17] bsd-user: Implement RISC-V CPU register cloning and reset functions
Posted by Richard Henderson 1 month, 3 weeks ago
On 8/24/24 14:56, Ajeet Singh wrote:
> From: Mark Corbin <mark@dibsco.co.uk>
> 
> Added functions for cloning CPU registers and resetting the CPU state
> for RISC-V architecture.
> 
> Signed-off-by: Mark Corbin <mark@dibsco.co.uk>
> Signed-off-by: Ajeet Singh <itachis@FreeBSD.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   bsd-user/riscv/target_arch_cpu.h | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/bsd-user/riscv/target_arch_cpu.h b/bsd-user/riscv/target_arch_cpu.h
> index eb37b062a3..522cfc099b 100644
> --- a/bsd-user/riscv/target_arch_cpu.h
> +++ b/bsd-user/riscv/target_arch_cpu.h
> @@ -130,4 +130,18 @@ static inline void target_cpu_loop(CPURISCVState *env)
>       }
>   }
>   
> +static inline void target_cpu_clone_regs(CPURISCVState *env, target_ulong newsp)
> +{
> +    if (newsp) {
> +        env->gpr[xSP] = newsp;
> +    }
> +
> +    env->gpr[xA0] = 0; /* a0 */
> +    env->gpr[xT0] = 0; /* t0 */

Now that you're using proper symbolic constants, the comments don't add anything.


r~