diff --git a/target-arm-Fix-some-compile-errors.patch b/target-arm-Fix-some-compile-errors.patch new file mode 100644 index 0000000..2a0e1e9 --- /dev/null +++ b/target-arm-Fix-some-compile-errors.patch @@ -0,0 +1,89 @@ +From 6a5a391c9c6f6c0cd105ce3495acc10868bad884 Mon Sep 17 00:00:00 2001 +From: Dongxu Sun +Date: Tue, 15 Feb 2022 14:40:48 +0800 +Subject: [PATCH] target/arm: Fix some compile errors + +fix compile errors like: + "implicit declaration of function 'kvm_arm_cpu_feature_supported'"; + "undefined reference to 'kvm_arm_get_one_reg'" + "undefined reference to 'kvm_arm_set_one_reg'" + "'kvmval' may be used uninitialized" + "'oldval' may be used uninitialized" + +Signed-off-by: Dongxu Sun +--- + target/arm/helper.c | 4 ++-- + target/arm/kvm_arm.h | 23 ++++++++++++++++++++--- + 2 files changed, 22 insertions(+), 5 deletions(-) + +diff --git a/target/arm/helper.c b/target/arm/helper.c +index 1dd5d64d96..80737a8d7b 100644 +--- a/target/arm/helper.c ++++ b/target/arm/helper.c +@@ -168,8 +168,8 @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync) + if (kvm_sync) { + if (is_id_reg(ri)) { + /* Only sync if we can sync to KVM successfully. */ +- uint64_t oldval; +- uint64_t kvmval; ++ uint64_t oldval = 0; ++ uint64_t kvmval = 0; + + if (kvm_arm_get_one_reg(cpu, cpu->cpreg_indexes[i], &oldval)) { + continue; +diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h +index 82145607ec..8b644b3924 100644 +--- a/target/arm/kvm_arm.h ++++ b/target/arm/kvm_arm.h +@@ -377,6 +377,9 @@ void kvm_arm_pvtime_init(CPUState *cs, uint64_t ipa); + + int kvm_arm_set_irq(int cpu, int irqtype, int irq, int level); + ++int kvm_arm_get_one_reg(ARMCPU *cpu, uint64_t regidx, uint64_t *target); ++int kvm_arm_set_one_reg(ARMCPU *cpu, uint64_t regidx, uint64_t *source); ++ + #else + + /* +@@ -403,6 +406,11 @@ static inline bool kvm_arm_steal_time_supported(void) + return false; + } + ++static inline bool kvm_arm_cpu_feature_supported(void) ++{ ++ return false; ++} ++ + /* + * These functions should never actually be called without KVM support. + */ +@@ -451,6 +459,18 @@ static inline void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) + g_assert_not_reached(); + } + ++static inline int kvm_arm_get_one_reg(ARMCPU *cpu, uint64_t regidx, ++ uint64_t *target) ++{ ++ g_assert_not_reached(); ++} ++ ++static inline int kvm_arm_set_one_reg(ARMCPU *cpu, uint64_t regidx, ++ uint64_t *source) ++{ ++ g_assert_not_reached(); ++} ++ + #endif + + static inline const char *gic_class_name(void) +@@ -535,7 +555,4 @@ static inline const char *its_class_name(void) + } + } + +-int kvm_arm_get_one_reg(ARMCPU *cpu, uint64_t regidx, uint64_t *target); +-int kvm_arm_set_one_reg(ARMCPU *cpu, uint64_t regidx, uint64_t *source); +- + #endif +-- +2.27.0 +