The bulk of the general register set is undefined on reset.
The zero register is for the most part special-cased in translate,
but the slot is still exposed to gdbstub and nios2_cpu_dump_state,
so continue to make sure that's zeroed.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/nios2/cpu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
index 182ddcc18f..97bdc0a61b 100644
--- a/target/nios2/cpu.c
+++ b/target/nios2/cpu.c
@@ -53,16 +53,16 @@ static void nios2_cpu_reset(DeviceState *dev)
ncc->parent_reset(dev);
- memset(env->regs, 0, sizeof(env->regs));
memset(env->ctrl, 0, sizeof(env->ctrl));
- env->pc = cpu->reset_addr;
-
#if defined(CONFIG_USER_ONLY)
/* Start in user mode with interrupts enabled. */
env->ctrl[CR_STATUS] = CR_STATUS_U | CR_STATUS_PIE;
#else
env->ctrl[CR_STATUS] = 0;
#endif
+
+ env->regs[R_ZERO] = 0;
+ env->pc = cpu->reset_addr;
}
#ifndef CONFIG_USER_ONLY
--
2.25.1