[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v3 23/56] cpu: define cpu_interrupt_request helpers
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [RFC v3 23/56] cpu: define cpu_interrupt_request helpers |
Date: |
Thu, 18 Oct 2018 21:05:52 -0400 |
Signed-off-by: Emilio G. Cota <address@hidden>
---
include/qom/cpu.h | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 3bf6767cb0..cd66b8828a 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -504,6 +504,41 @@ static inline void cpu_halted_set(CPUState *cpu, uint32_t
val)
cpu_mutex_unlock(cpu);
}
+static inline uint32_t cpu_interrupt_request(CPUState *cpu)
+{
+ uint32_t ret;
+
+ if (cpu_mutex_locked(cpu)) {
+ return cpu->interrupt_request;
+ }
+ cpu_mutex_lock(cpu);
+ ret = cpu->interrupt_request;
+ cpu_mutex_unlock(cpu);
+ return ret;
+}
+
+static inline void cpu_interrupt_request_or(CPUState *cpu, uint32_t mask)
+{
+ if (cpu_mutex_locked(cpu)) {
+ cpu->interrupt_request |= mask;
+ return;
+ }
+ cpu_mutex_lock(cpu);
+ cpu->interrupt_request |= mask;
+ cpu_mutex_unlock(cpu);
+}
+
+static inline void cpu_interrupt_request_set(CPUState *cpu, uint32_t val)
+{
+ if (cpu_mutex_locked(cpu)) {
+ cpu->interrupt_request = val;
+ return;
+ }
+ cpu_mutex_lock(cpu);
+ cpu->interrupt_request = val;
+ cpu_mutex_unlock(cpu);
+}
+
static inline void cpu_tb_jmp_cache_clear(CPUState *cpu)
{
unsigned int i;
--
2.17.1
- [Qemu-devel] [RFC v3 08/56] cpu: define cpu_halted helpers, (continued)
- [Qemu-devel] [RFC v3 08/56] cpu: define cpu_halted helpers, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 09/56] arm: convert to cpu_halted, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 16/56] riscv: convert to cpu_halted, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 07/56] target/m68k: rename cpu_halted to cpu_halt, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 20/56] gdbstub: convert to cpu_halted, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 23/56] cpu: define cpu_interrupt_request helpers,
Emilio G. Cota <=
- [Qemu-devel] [RFC v3 19/56] xtensa: convert to cpu_halted, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 26/56] i386: use cpu_reset_interrupt, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 22/56] cpu-exec: convert to cpu_halted, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 15/56] mips: convert to cpu_halted, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 21/56] openrisc: convert to cpu_halted, Emilio G. Cota, 2018/10/18