target/nios2: Use deposit32() to update ipending register

In nios2_cpu_set_irq(), use deposit32() rather than raw shift-and-mask
operations to set the appropriate bit in the ipending register.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20201129174022.26530-4-peter.maydell@linaro.org
This commit is contained in:
Peter Maydell 2020-11-29 17:40:22 +00:00
parent 2c87548ef4
commit 05bcbcf279
1 changed files with 1 additions and 2 deletions

View File

@ -71,8 +71,7 @@ static void nios2_cpu_set_irq(void *opaque, int irq, int level)
CPUNios2State *env = &cpu->env;
CPUState *cs = CPU(cpu);
env->regs[CR_IPENDING] &= ~(1 << irq);
env->regs[CR_IPENDING] |= !!level << irq;
env->regs[CR_IPENDING] = deposit32(env->regs[CR_IPENDING], irq, 1, !!level);
env->irq_pending = env->regs[CR_IPENDING] & env->regs[CR_IENABLE];