aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-11-29 17:40:22 +0000
committerPeter Maydell <peter.maydell@linaro.org>2020-12-15 12:04:30 +0000
commit05bcbcf27954e664d85627f026970f62556fefa5 (patch)
tree6af686d2d86651350667b12ba1cd3afcd952053f /target
parent2c87548ef46040d0577cc362cab94561c1d98b8d (diff)
downloadqemu-05bcbcf27954e664d85627f026970f62556fefa5.zip
qemu-05bcbcf27954e664d85627f026970f62556fefa5.tar.gz
qemu-05bcbcf27954e664d85627f026970f62556fefa5.tar.bz2
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
Diffstat (limited to 'target')
-rw-r--r--target/nios2/cpu.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
index 52ebda8..58688e1 100644
--- a/target/nios2/cpu.c
+++ b/target/nios2/cpu.c
@@ -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];