]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
linux-user/loongarch64: Convert target_elf_gregset_t to a struct
authorRichard Henderson <richard.henderson@linaro.org>
Wed, 27 Aug 2025 22:07:32 +0000 (08:07 +1000)
committerRichard Henderson <richard.henderson@linaro.org>
Fri, 29 Aug 2025 21:03:57 +0000 (07:03 +1000)
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
linux-user/elfload.c

index 0dd76937f968c5c4074a5446b44370addfed112d..1e59399afaf25568dac618c546a2a605de3c9f82 100644 (file)
@@ -518,7 +518,9 @@ static void elf_core_copy_regs(target_elf_gregset_t *r, const CPUPPCState *env)
 
 /* See linux kernel: arch/loongarch/include/asm/elf.h */
 #define ELF_NREG 45
-typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
+typedef struct target_elf_gregset_t {
+    target_elf_greg_t regs[ELF_NREG];
+} target_elf_gregset_t;
 
 enum {
     TARGET_EF_R0 = 0,
@@ -526,19 +528,17 @@ enum {
     TARGET_EF_CSR_BADV = TARGET_EF_R0 + 34,
 };
 
-static void elf_core_copy_regs(target_elf_gregset_t *regs,
+static void elf_core_copy_regs(target_elf_gregset_t *r,
                                const CPULoongArchState *env)
 {
-    int i;
-
-    (*regs)[TARGET_EF_R0] = 0;
+    r->regs[TARGET_EF_R0] = 0;
 
-    for (i = 1; i < ARRAY_SIZE(env->gpr); i++) {
-        (*regs)[TARGET_EF_R0 + i] = tswapreg(env->gpr[i]);
+    for (int i = 1; i < ARRAY_SIZE(env->gpr); i++) {
+        r->regs[TARGET_EF_R0 + i] = tswapreg(env->gpr[i]);
     }
 
-    (*regs)[TARGET_EF_CSR_ERA] = tswapreg(env->pc);
-    (*regs)[TARGET_EF_CSR_BADV] = tswapreg(env->CSR_BADV);
+    r->regs[TARGET_EF_CSR_ERA] = tswapreg(env->pc);
+    r->regs[TARGET_EF_CSR_BADV] = tswapreg(env->CSR_BADV);
 }
 
 #define USE_ELF_CORE_DUMP