[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/18] armv7m: fix RETTOBASE
From: |
Michael Davidsaver |
Subject: |
[Qemu-devel] [PATCH 08/18] armv7m: fix RETTOBASE |
Date: |
Sun, 8 Nov 2015 20:11:35 -0500 |
The polarity is reversed, and it should include
internal exceptions.
Should be set when # of active exceptions <= 1.
Signed-off-by: Michael Davidsaver <address@hidden>
---
hw/intc/armv7m_nvic.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
index 30e349e..3b10dee 100644
--- a/hw/intc/armv7m_nvic.c
+++ b/hw/intc/armv7m_nvic.c
@@ -432,16 +432,20 @@ static uint32_t nvic_readl(nvic_state *s, uint32_t offset)
val = cpu->env.v7m.exception;
/* VECTPENDING */
val |= (cpu->env.v7m.pending << 12)&0x1ff;
- /* ISRPENDING and RETTOBASE */
+ /* ISRPENDING - Set it any externel IRQ pending (vector>=16) */
for (irq = 16; irq < s->num_irq; irq++) {
if (s->vectors[irq].pending) {
val |= (1 << 22);
break;
}
+ }
+ /* RETTOBASE - Set if no (other) handler is active */
+ for (irq = 1; irq < s->num_irq; irq++) {
if (irq != cpu->env.v7m.exception && s->vectors[irq].active) {
- val |= (1 << 11);
+ val |= (1 << 11); /* some other handler is active */
}
}
+ val ^= (1<<11); /* invert */
/* PENDSTSET */
if (s->vectors[ARMV7M_EXCP_SYSTICK].pending) {
val |= (1 << 26);
@@ -454,6 +458,7 @@ static uint32_t nvic_readl(nvic_state *s, uint32_t offset)
if (s->vectors[ARMV7M_EXCP_NMI].pending) {
val |= (1 << 31);
}
+ /* ISRPREEMPT not implemented */
return val;
case 0xd08: /* Vector Table Offset. */
return cpu->env.v7m.vecbase;
@@ -588,10 +593,14 @@ static void nvic_writel(nvic_state *s, uint32_t offset,
uint32_t value)
qemu_irq_pulse(s->sysresetreq);
}
if (value & 2) {
- qemu_log_mask(LOG_UNIMP, "VECTCLRACTIVE unimplemented\n");
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "Setting VECTCLRACTIVE when not in DEBUG mode "
+ "is UNPREDICTABLE\n");
}
if (value & 1) {
- qemu_log_mask(LOG_UNIMP, "AIRCR system reset unimplemented\n");
+ qemu_log_mask(LOG_GUEST_ERROR,
+ "Setting VECTRESET when not in DEBUG mode "
+ "is UNPREDICTABLE\n");
}
if (value & 0x700) {
unsigned i;
--
2.1.4
- Re: [Qemu-devel] [PATCH 05/18] armv7m: expand NVIC state, (continued)
- [Qemu-devel] [PATCH 06/18] armv7m: new NVIC utility functions, Michael Davidsaver, 2015/11/08
- [Qemu-devel] [PATCH 04/18] armv7m: Explicit error for bad vector table, Michael Davidsaver, 2015/11/08
- [Qemu-devel] [PATCH 03/18] armv7m: Complain about incorrect exception table entries., Michael Davidsaver, 2015/11/08
- [Qemu-devel] [PATCH 01/18] armv7m: MRS/MSR handle unprivileged access, Michael Davidsaver, 2015/11/08
- [Qemu-devel] [PATCH 02/18] armv7m: Undo armv7m.hack, Michael Davidsaver, 2015/11/08
- [Qemu-devel] [PATCH 08/18] armv7m: fix RETTOBASE,
Michael Davidsaver <=
- [Qemu-devel] [PATCH 09/18] armv7m: NVIC update vmstate, Michael Davidsaver, 2015/11/08
- [Qemu-devel] [PATCH 12/18] armv7m: simpler/faster exception start, Michael Davidsaver, 2015/11/08
- [Qemu-devel] [PATCH 11/18] armv7m: fix I and F flag handling, Michael Davidsaver, 2015/11/08
- [Qemu-devel] [PATCH 10/18] armv7m: NVIC initialization, Michael Davidsaver, 2015/11/08
- [Qemu-devel] [PATCH 14/18] armv7m: auto-clear FAULTMASK, Michael Davidsaver, 2015/11/08
- [Qemu-devel] [PATCH 07/18] armv7m: Update NVIC registers, Michael Davidsaver, 2015/11/08
- [Qemu-devel] [PATCH 17/18] armv7m: implement CCR, Michael Davidsaver, 2015/11/08
- [Qemu-devel] [PATCH 15/18] arm: gic: Remove references to NVIC, Michael Davidsaver, 2015/11/08