interrupts.hh (10905:a6ca6831e775) interrupts.hh (11566:b11410957c9e)
1/*
2 * Copyright (c) 2010, 2012-2013 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 135 unchanged lines hidden (view full) ---

144 SCR scr = tc->readMiscReg(MISCREG_SCR);
145
146 bool isHypMode = cpsr.mode == MODE_HYP;
147 bool isSecure = inSecureState(scr, cpsr);
148 bool allowVIrq = !cpsr.i && hcr.imo && !isSecure && !isHypMode;
149 bool allowVFiq = !cpsr.f && hcr.fmo && !isSecure && !isHypMode;
150 bool allowVAbort = !cpsr.a && hcr.amo && !isSecure && !isHypMode;
151
1/*
2 * Copyright (c) 2010, 2012-2013 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 135 unchanged lines hidden (view full) ---

144 SCR scr = tc->readMiscReg(MISCREG_SCR);
145
146 bool isHypMode = cpsr.mode == MODE_HYP;
147 bool isSecure = inSecureState(scr, cpsr);
148 bool allowVIrq = !cpsr.i && hcr.imo && !isSecure && !isHypMode;
149 bool allowVFiq = !cpsr.f && hcr.fmo && !isSecure && !isHypMode;
150 bool allowVAbort = !cpsr.a && hcr.amo && !isSecure && !isHypMode;
151
152 if ( !(intStatus || (hcr.vi && allowVIrq) || (hcr.vf && allowVFiq) ||
153 (hcr.va && allowVAbort)) )
154 return false;
155
152 bool take_irq = takeInt(tc, INT_IRQ);
153 bool take_fiq = takeInt(tc, INT_FIQ);
154 bool take_ea = takeInt(tc, INT_ABT);
155
156 return ((interrupts[INT_IRQ] && take_irq) ||
157 (interrupts[INT_FIQ] && take_fiq) ||
158 (interrupts[INT_ABT] && take_ea) ||
159 ((interrupts[INT_VIRT_IRQ] || hcr.vi) && allowVIrq) ||

--- 56 unchanged lines hidden (view full) ---

216 panic("Interrupt number out of range.\n");
217
218 return interrupts[interrupt];
219 }
220
221 Fault
222 getInterrupt(ThreadContext *tc)
223 {
156 bool take_irq = takeInt(tc, INT_IRQ);
157 bool take_fiq = takeInt(tc, INT_FIQ);
158 bool take_ea = takeInt(tc, INT_ABT);
159
160 return ((interrupts[INT_IRQ] && take_irq) ||
161 (interrupts[INT_FIQ] && take_fiq) ||
162 (interrupts[INT_ABT] && take_ea) ||
163 ((interrupts[INT_VIRT_IRQ] || hcr.vi) && allowVIrq) ||

--- 56 unchanged lines hidden (view full) ---

220 panic("Interrupt number out of range.\n");
221
222 return interrupts[interrupt];
223 }
224
225 Fault
226 getInterrupt(ThreadContext *tc)
227 {
228 assert(checkInterrupts(tc));
229
224 HCR hcr = tc->readMiscReg(MISCREG_HCR);
225 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
226 SCR scr = tc->readMiscReg(MISCREG_SCR);
227
228 // Calculate a few temp vars so we can work out if there's a pending
229 // virtual interrupt, and if its allowed to happen
230 // ARM ARM Issue C section B1.9.9, B1.9.11, and B1.9.13
231 bool isHypMode = cpsr.mode == MODE_HYP;
232 bool isSecure = inSecureState(scr, cpsr);
233 bool allowVIrq = !cpsr.i && hcr.imo && !isSecure && !isHypMode;
234 bool allowVFiq = !cpsr.f && hcr.fmo && !isSecure && !isHypMode;
235 bool allowVAbort = !cpsr.a && hcr.amo && !isSecure && !isHypMode;
236
230 HCR hcr = tc->readMiscReg(MISCREG_HCR);
231 CPSR cpsr = tc->readMiscReg(MISCREG_CPSR);
232 SCR scr = tc->readMiscReg(MISCREG_SCR);
233
234 // Calculate a few temp vars so we can work out if there's a pending
235 // virtual interrupt, and if its allowed to happen
236 // ARM ARM Issue C section B1.9.9, B1.9.11, and B1.9.13
237 bool isHypMode = cpsr.mode == MODE_HYP;
238 bool isSecure = inSecureState(scr, cpsr);
239 bool allowVIrq = !cpsr.i && hcr.imo && !isSecure && !isHypMode;
240 bool allowVFiq = !cpsr.f && hcr.fmo && !isSecure && !isHypMode;
241 bool allowVAbort = !cpsr.a && hcr.amo && !isSecure && !isHypMode;
242
237 if ( !(intStatus || (hcr.vi && allowVIrq) || (hcr.vf && allowVFiq) ||
238 (hcr.va && allowVAbort)) )
239 return NoFault;
240
241 bool take_irq = takeInt(tc, INT_IRQ);
242 bool take_fiq = takeInt(tc, INT_FIQ);
243 bool take_ea = takeInt(tc, INT_ABT);
244
243 bool take_irq = takeInt(tc, INT_IRQ);
244 bool take_fiq = takeInt(tc, INT_FIQ);
245 bool take_ea = takeInt(tc, INT_ABT);
246
245
246 if (interrupts[INT_IRQ] && take_irq)
247 return std::make_shared<Interrupt>();
248 if ((interrupts[INT_VIRT_IRQ] || hcr.vi) && allowVIrq)
249 return std::make_shared<VirtualInterrupt>();
250 if (interrupts[INT_FIQ] && take_fiq)
251 return std::make_shared<FastInterrupt>();
252 if ((interrupts[INT_VIRT_FIQ] || hcr.vf) && allowVFiq)
253 return std::make_shared<VirtualFastInterrupt>();

--- 37 unchanged lines hidden ---
247 if (interrupts[INT_IRQ] && take_irq)
248 return std::make_shared<Interrupt>();
249 if ((interrupts[INT_VIRT_IRQ] || hcr.vi) && allowVIrq)
250 return std::make_shared<VirtualInterrupt>();
251 if (interrupts[INT_FIQ] && take_fiq)
252 return std::make_shared<FastInterrupt>();
253 if ((interrupts[INT_VIRT_FIQ] || hcr.vf) && allowVFiq)
254 return std::make_shared<VirtualFastInterrupt>();

--- 37 unchanged lines hidden ---