aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2024-11-05 10:09:56 +0000
committerPeter Maydell <peter.maydell@linaro.org>2024-11-05 10:09:56 +0000
commitc18a13edceca5419beb6eb703ffad6980d926f3b (patch)
tree2eead65a1cd607860bb400d996c02b04ca2c45b2
parent8403a5015c5d5ef01792dc5ebf3c10aa5594931f (diff)
downloadqemu-c18a13edceca5419beb6eb703ffad6980d926f3b.zip
qemu-c18a13edceca5419beb6eb703ffad6980d926f3b.tar.gz
qemu-c18a13edceca5419beb6eb703ffad6980d926f3b.tar.bz2
target/microblaze: Move setting of float rounding mode to reset
Although the floating point rounding mode for Microblaze is always nearest-even, we cannot set it just once in the CPU initfn. This is because env->fp_status is in the part of the CPU state struct that is zeroed on reset. Move the call to set_float_rounding_mode() into the reset fn. (This had no guest-visible effects because it happens that the float_round_nearest_even enum value is 0, so when the struct was zeroed it didn't corrupt the setting.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20241025141254.2141506-18-peter.maydell@linaro.org
-rw-r--r--target/microblaze/cpu.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
index 135947e..6329a77 100644
--- a/target/microblaze/cpu.c
+++ b/target/microblaze/cpu.c
@@ -201,6 +201,8 @@ static void mb_cpu_reset_hold(Object *obj, ResetType type)
env->pc = cpu->cfg.base_vectors;
+ set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
+
#if defined(CONFIG_USER_ONLY)
/* start in user mode with interrupts enabled. */
mb_cpu_write_msr(env, MSR_EE | MSR_IE | MSR_VM | MSR_UM);
@@ -311,15 +313,12 @@ static void mb_cpu_realizefn(DeviceState *dev, Error **errp)
static void mb_cpu_initfn(Object *obj)
{
MicroBlazeCPU *cpu = MICROBLAZE_CPU(obj);
- CPUMBState *env = &cpu->env;
gdb_register_coprocessor(CPU(cpu), mb_cpu_gdb_read_stack_protect,
mb_cpu_gdb_write_stack_protect,
gdb_find_static_feature("microblaze-stack-protect.xml"),
0);
- set_float_rounding_mode(float_round_nearest_even, &env->fp_status);
-
#ifndef CONFIG_USER_ONLY
/* Inbound IRQ and FIR lines */
qdev_init_gpio_in(DEVICE(cpu), microblaze_cpu_set_irq, 2);