Revert "riscv/addrenv: Move addrenv_switch() to correct place after FPU change"

This reverts commit da319bbd853c8f8be79318c4cecf70abd444692d.
This commit is contained in:
Masayuki Ishikawa 2023-06-19 22:47:29 +09:00
parent 7410f4a6b8
commit 0124533cc3
3 changed files with 30 additions and 11 deletions

View File

@ -83,9 +83,25 @@ uintptr_t *riscv_doirq(int irq, uintptr_t *regs)
irq_dispatch(irq, regs);
/* Check for a context switch. If a context switch occurred, then
* CURRENT_REGS will have a different value than it did on entry.
* CURRENT_REGS will have a different value than it did on entry. If an
* interrupt level context switch has occurred, then restore the floating
* point state and the establish the correct address environment before
* returning from the interrupt.
*/
#ifdef CONFIG_ARCH_ADDRENV
if (regs != CURRENT_REGS)
{
/* Make sure that the address environment for the previously
* running task is closed down gracefully (data caches dump,
* MMU flushed) and set up the address environment for the new
* thread at the head of the ready-to-run list.
*/
addrenv_switch(NULL);
}
#endif
if (regs != CURRENT_REGS)
{
/* Restore the cpu lock */

View File

@ -229,16 +229,6 @@ static inline void riscv_restorecontext(struct tcb_s *tcb)
{
CURRENT_REGS = (uintptr_t *)tcb->xcp.regs;
#ifdef CONFIG_ARCH_ADDRENV
/* Make sure that the address environment for the previously
* running task is closed down gracefully (data caches dump,
* MMU flushed) and set up the address environment for the new
* thread at the head of the ready-to-run list.
*/
addrenv_switch(tcb);
#endif
#ifdef CONFIG_ARCH_FPU
/* Restore FPU after the new address environment is instantiated */

View File

@ -44,6 +44,19 @@ void *riscv_perform_syscall(uintptr_t *regs)
riscv_swint(0, regs, NULL);
#ifdef CONFIG_ARCH_ADDRENV
if (regs != CURRENT_REGS)
{
/* Make sure that the address environment for the previously
* running task is closed down gracefully (data caches dump,
* MMU flushed) and set up the address environment for the new
* thread at the head of the ready-to-run list.
*/
addrenv_switch(NULL);
}
#endif
if (regs != CURRENT_REGS)
{
/* Restore the cpu lock */