Skip to content

Commit

Permalink
target/nios2: Check supervisor on eret
Browse files Browse the repository at this point in the history
eret instruction is only allowed in supervisor mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Amir Gonnen <amir.gonnen@neuroblade.ai>
Message-Id: <20220303153906.2024748-2-amir.gonnen@neuroblade.ai>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220421151735.31996-14-richard.henderson@linaro.org>
  • Loading branch information
amirgon authored and rth7680 committed Apr 26, 2022
1 parent 3a0a43e commit b106e7b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions target/nios2/translate.c
Expand Up @@ -384,6 +384,8 @@ static const Nios2Instruction i_type_instructions[] = {
*/
static void eret(DisasContext *dc, uint32_t code, uint32_t flags)
{
gen_check_supervisor(dc);

tcg_gen_mov_tl(cpu_R[CR_STATUS], cpu_R[CR_ESTATUS]);
tcg_gen_mov_tl(cpu_R[R_PC], cpu_R[R_EA]);

Expand Down

0 comments on commit b106e7b

Please sign in to comment.