Context switch only on irq tail

This commit is contained in:
Stefan Kerkmann 2021-05-09 11:16:09 +02:00
parent 9c2bfa6aeb
commit 5e096e01c9
1 changed files with 4 additions and 1 deletions

View File

@ -287,7 +287,10 @@ struct port_context {
* @details This macro must be inserted at the end of all IRQ handlers
* enabled to invoke system APIs.
*/
#define PORT_IRQ_EPILOGUE() return chSchIsPreemptionRequired();
#define PORT_IRQ_EPILOGUE() port_lock_from_isr(); \
bool is_preemption_required = ((__RV_CSR_READ(CSR_MSUBM) & MSUBM_PTYP) == 0) && chSchIsPreemptionRequired(); \
port_unlock_from_isr(); \
return is_preemption_required;
/**
* @brief IRQ handler function declaration.