arch: fe310: Fix mstatus handling
In previous commit, mstatus.mie was set when creating a new task but this change was incorrect and had a side effect such that a machine interrupt would be enabled just before returning from interrupt handling routine to switch context. Also, mstatus.mpp is set to machine mode in up_get_newintctx() instead of fe310_dispatch_irq().
This commit is contained in:
parent
38b043da9f
commit
d76ba14d58
@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
#define MSTATUS_MIE (0x1 << 3) /* Machine Interrupt Enable */
|
#define MSTATUS_MIE (0x1 << 3) /* Machine Interrupt Enable */
|
||||||
#define MSTATUS_MPIE (0x1 << 7) /* Machine Previous Interrupt Enable */
|
#define MSTATUS_MPIE (0x1 << 7) /* Machine Previous Interrupt Enable */
|
||||||
|
#define MSTATUS_MPPM (0x3 << 11) /* Machine Previous Privilege (m-mode) */
|
||||||
|
|
||||||
/* In mie (machine interrupt enable) register */
|
/* In mie (machine interrupt enable) register */
|
||||||
|
|
||||||
|
@ -193,7 +193,11 @@ void up_enable_irq(int irq)
|
|||||||
|
|
||||||
uint32_t up_get_newintctx(void)
|
uint32_t up_get_newintctx(void)
|
||||||
{
|
{
|
||||||
return (MSTATUS_MPIE | MSTATUS_MIE);
|
/* Set machine previous privilege mode to machine mode.
|
||||||
|
* Also set machine previous interrupt enable
|
||||||
|
*/
|
||||||
|
|
||||||
|
return (MSTATUS_MPPM | MSTATUS_MPIE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
@ -131,10 +131,6 @@ void *fe310_dispatch_irq(uint32_t vector, uint32_t *regs)
|
|||||||
regs = (uint32_t *)g_current_regs;
|
regs = (uint32_t *)g_current_regs;
|
||||||
g_current_regs = NULL;
|
g_current_regs = NULL;
|
||||||
|
|
||||||
/* Set machine previous privilege mode to machine mode */
|
|
||||||
|
|
||||||
*(regs + REG_INT_CTX_NDX) |= 0x3 << 11;
|
|
||||||
|
|
||||||
return regs;
|
return regs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user