audk/MdePkg
Abner Chang e6042aec1b BaseLib:Fix RISC-V Supervisor mode (S-Mode) trap handler reentry issue.
While RISC-V hart is trapped into S-Mode, the S-Mode interrupt
CSR (SIE) is disabled by RISC-V hart. However the (SIE) is enabled
again by RestoreTPL, this causes the second S-Mode trap is triggered
by the machine mode (M-Mode)timer interrupt redirection. The SRET
instruction clear Supervisor Previous Privilege (SPP) to zero
(User mode) in the second S-Mode interrupt according to the RISC-V
spec. Above brings hart to the user mode (U-Mode) when execute
SRET in the nested S-Mode interrupt handler because SPP is set to
User Mode in the second interrupt. Afterward, system runs in U-Mode
and any accesses to S-Mode CSR causes the invalid instruction exception.

Signed-off-by: Abner Chang <abner.chang@hpe.com>

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Signed-off-by: Abner Chang <abner.chang@hpe.com>
Acked-by: Liming Gao <liming.gao@intel.com>
2020-08-12 04:01:39 +00:00
..
Include MdePkg Base.h: Delete prototype for __builtin_return_address 2020-07-28 00:28:14 +00:00
Library BaseLib:Fix RISC-V Supervisor mode (S-Mode) trap handler reentry issue. 2020-08-12 04:01:39 +00:00
Test MdePkg/Library/BaseLib: Add BaseLib instance for host based unit tests 2020-07-15 05:25:21 +00:00
MdePkg.ci.yaml MdePkg/MdePkg.ci.yaml: Add configuration for LicenseCheck 2020-07-31 02:49:51 +00:00
MdePkg.dec MdePkg/Library/BaseLib: Add BaseLib instance for host based unit tests 2020-07-15 05:25:21 +00:00
MdePkg.dsc MdePkg/BaseCacheMaintenanceLibNull: Add Null instance for host testing 2020-07-15 05:25:21 +00:00
MdePkg.uni MdePkg: Add PcdSpeculationBarrierType 2019-04-30 16:39:09 -07:00
MdePkgExtra.uni MdePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:13 -07:00