audk/MdePkg/Library/BaseLib/RiscV64
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
..
CpuBreakpoint.c MdePkg/BaseLib: BaseLib for RISCV64 architecture 2020-05-07 03:17:15 +00:00
CpuPause.c MdePkg/BaseLib: BaseLib for RISCV64 architecture 2020-05-07 03:17:15 +00:00
DisableInterrupts.c MdePkg/BaseLib: BaseLib for RISCV64 architecture 2020-05-07 03:17:15 +00:00
EnableInterrupts.c MdePkg/BaseLib: BaseLib for RISCV64 architecture 2020-05-07 03:17:15 +00:00
FlushCache.S MdePkg/BaseLib: BaseLib for RISCV64 architecture 2020-05-07 03:17:15 +00:00
GetInterruptState.c MdePkg/BaseLib: BaseLib for RISCV64 architecture 2020-05-07 03:17:15 +00:00
InternalSwitchStack.c MdePkg/BaseLib: BaseLib for RISCV64 architecture 2020-05-07 03:17:15 +00:00
RiscVCpuBreakpoint.S MdePkg/BaseLib: BaseLib for RISCV64 architecture 2020-05-07 03:17:15 +00:00
RiscVCpuPause.S MdePkg/BaseLib: BaseLib for RISCV64 architecture 2020-05-07 03:17:15 +00:00
RiscVInterrupt.S BaseLib:Fix RISC-V Supervisor mode (S-Mode) trap handler reentry issue. 2020-08-12 04:01:39 +00:00
RiscVSetJumpLongJump.S MdePkg/BaseLib: BaseLib for RISCV64 architecture 2020-05-07 03:17:15 +00:00