]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target/nios2: Use deposit32() to update ipending register
authorPeter Maydell <peter.maydell@linaro.org>
Sun, 29 Nov 2020 17:40:22 +0000 (17:40 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 15 Dec 2020 12:04:30 +0000 (12:04 +0000)
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

target/nios2/cpu.c

index 52ebda89ca726c364e6a1a34bb46384455c0ef75..58688e1623ab9a5d6ddb8dbe3c8870e4ba3d0d80 100644 (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];