[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 11/48] target/nios2: Do not zero the general registers on rese
From: |
Richard Henderson |
Subject: |
[PATCH v5 11/48] target/nios2: Do not zero the general registers on reset |
Date: |
Thu, 10 Mar 2022 03:26:48 -0800 |
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
- [PATCH v5 04/48] target/nios2: Split PC out of env->regs[], (continued)
- [PATCH v5 04/48] target/nios2: Split PC out of env->regs[], Richard Henderson, 2022/03/10
- [PATCH v5 03/48] target/nios2: Add NUM_GP_REGS and NUM_CP_REGS, Richard Henderson, 2022/03/10
- [PATCH v5 05/48] target/nios2: Split out helper for eret instruction, Richard Henderson, 2022/03/10
- [PATCH v5 06/48] target/nios2: Fix BRET instruction, Richard Henderson, 2022/03/10
- [PATCH v5 07/48] target/nios2: Do not create TCGv for control registers, Richard Henderson, 2022/03/10
- [PATCH v5 08/48] linux-user/nios2: Only initialize SP and PC in target_cpu_copy_regs, Richard Henderson, 2022/03/10
- [PATCH v5 09/48] target/nios2: Remove cpu_interrupts_enabled, Richard Henderson, 2022/03/10
- [PATCH v5 13/48] target/nios2: Use hw/registerfields.h for CR_STATUS fields, Richard Henderson, 2022/03/10
- [PATCH v5 11/48] target/nios2: Do not zero the general registers on reset,
Richard Henderson <=
- [PATCH v5 10/48] target/nios2: Split control registers away from general registers, Richard Henderson, 2022/03/10
- [PATCH v5 12/48] target/nios2: Clean up nios2_cpu_dump_state, Richard Henderson, 2022/03/10
- [PATCH v5 15/48] target/nios2: Use hw/registerfields.h for CR_TLBADDR fields, Richard Henderson, 2022/03/10
- [PATCH v5 14/48] target/nios2: Use hw/registerfields.h for CR_EXCEPTION fields, Richard Henderson, 2022/03/10
- [PATCH v5 17/48] target/nios2: Rename CR_TLBMISC_WR to CR_TLBMISC_WE, Richard Henderson, 2022/03/10