This repository has been archived on 2023-11-05. You can view files and clone it, but cannot push or open issues or pull requests.
FreeRTOS-Kernel/portable/GCC
RichardBarry bac101c988
Fix/clear MIE bit in initial RISC-V mstatus register. (#57)
* fix: CLEAR MIE BIT IN INITIAL RISC-V MSTATUS VALUE
The MIE bit in the RISC-V MSTATUS register is used to globally enable
or disable interrupts.  It is copied into the MPIE bit and cleared
on entry to an interrupt, and then copied back from the MPIE bit on
exit from an interrupt.

When a task is created it is given an initial MSTATUS value that is
derived from the current MSTATUS value with the MPIE bit force to 1,
but the MIE bit is not forced into any state.  This change forces
the MIE bit to 0 (interrupts disabled).

Why:
If a task is created before the scheduler is started the MIE bit
will happen to be 0 (interrupts disabled), which is fine.  If a
task is created after the scheduler has been started the MIE bit
is set (interrupts enabled), causing interrupts to unintentionally
become enabled inside the interrupt in which the task is first
moved to the running state - effectively breaking a critical
section which in turn could cause a crash if enabling interrupts
causes interrupts to nest.  It is only an issue when starting a
newly created task that was created after the scheduler was started.

Related Issues:
https://forums.freertos.org/t/risc-v-port-pxportinitialisestack-issue-about-mstatus-value-onto-the-stack/9622
Co-authored-by: Cobus van Eeden <35851496+cobusve@users.noreply.github.com>
2020-05-01 22:35:42 -07:00
..
ARM7_AT91FR40008 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
ARM7_AT91SAM7S version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
ARM7_LPC23xx version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
ARM7_LPC2000 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
ARM_CA9 Cortex-A9 port: Adding stack alignment directive to assembly code 2020-03-13 12:19:31 -07:00
ARM_CA53_64_BIT version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
ARM_CM0 Add definition of portDONT_DISCARD to ARMv7-M ports (#50) 2020-04-14 09:03:11 -07:00
ARM_CM3 Add definition of portDONT_DISCARD to ARMv7-M ports (#50) 2020-04-14 09:03:11 -07:00
ARM_CM3_MPU Add definition of portDONT_DISCARD to ARMv7-M ports (#50) 2020-04-14 09:03:11 -07:00
ARM_CM4_MPU Add definition of portDONT_DISCARD to ARMv7-M ports (#50) 2020-04-14 09:03:11 -07:00
ARM_CM4F Add definition of portDONT_DISCARD to ARMv7-M ports (#50) 2020-04-14 09:03:11 -07:00
ARM_CM7 Add definition of portDONT_DISCARD to ARMv7-M ports (#50) 2020-04-14 09:03:11 -07:00
ARM_CM23 Add "Tickless Idle" support for ARMv8M ports (#29) 2020-03-16 10:50:49 -07:00
ARM_CM23_NTZ/non_secure Add "Tickless Idle" support for ARMv8M ports (#29) 2020-03-16 10:50:49 -07:00
ARM_CM33 Add "Tickless Idle" support for ARMv8M ports (#29) 2020-03-16 10:50:49 -07:00
ARM_CM33_NTZ/non_secure Add "Tickless Idle" support for ARMv8M ports (#29) 2020-03-16 10:50:49 -07:00
ARM_CR5 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
ARM_CRx_No_GIC version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
ATMega323 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
AVR32_UC3 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
ColdFire_V2 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
CORTUS_APS3 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
H8S2329 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
HCS12 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
IA32_flat version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
MCF5235 Re-sync with upstream and stripping away none kernel related. 2020-02-10 13:45:57 -08:00
MicroBlaze version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
MicroBlazeV8 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
MicroBlazeV9 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
MSP430F449 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
NiosII version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
PPC405_Xilinx version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
PPC440_Xilinx version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
RISC-V Fix/clear MIE bit in initial RISC-V mstatus register. (#57) 2020-05-01 22:35:42 -07:00
RL78 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
RX100 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
RX600 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
RX600v2 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
STR75x version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00
TriCore_1782 version bump to v10.3.1 (#16) 2020-02-18 22:03:54 -08:00