audk/MdePkg
Andrei Warkentin 69da506c92 UefiCpuPkg: BaseRiscV64CpuExceptionHandlerLib: clean up
RegisterCpuInterruptHandler did not allow setting
exception handlers for anything beyond the timer IRQ.
Beyond that, it didn't meet the spec around handling
of inputs.

RiscVSupervisorModeTrapHandler now will invoke
set handlers for both exceptions and interrupts.
Two arrays of handlers are maintained - one for exceptions
and one for interrupts.

For unhandled traps, RiscVSupervisorModeTrapHandler dumps
state using the now implemented DumpCpuContext.

For EFI_SYSTEM_CONTEXT_RISCV64, extend this with the trapped
PC address (SEPC), just like on AArch64 (ELR). This is
necessary for X86EmulatorPkg to work as it allows a trap
handler to return execution to a different place. Add
SSTATUS/STVAL as well, at least for debugging purposes. There
is no value in hiding this.

Fix nested exception handling. Handler code should not
be saving SIE (the value is saved in SSTATUS.SPIE) or
directly restored (that's done by SRET). Save and
restore the entire SSTATUS and STVAL, too.

Cc: Daniel Schaefer <git@danielschaefer.me>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Andrei Warkentin <andrei.warkentin@intel.com>
2023-03-08 18:10:34 +00:00
..
Include UefiCpuPkg: BaseRiscV64CpuExceptionHandlerLib: clean up 2023-03-08 18:10:34 +00:00
Library MdePkg: BaseCpuLib: Fix RISCV CpuSleep symbol name. 2023-03-08 18:10:34 +00:00
Test MdePkg/Test: Add port of BaseSafeIntLib unit tests to GoogleTest 2022-11-11 05:46:51 +00:00
MdeLibs.dsc.inc MdePkg/ArmTrngLib: Add NULL instance of Arm TRNG Library 2022-11-06 16:32:28 +00:00
MdePkg.ci.yaml MdePkg: Add Acpi65.h to IgnoreFiles area 2023-01-31 02:27:58 +00:00
MdePkg.dec MdePkg: Add BaseRiscVSbiLib Library for RISC-V 2023-02-16 05:53:28 +00:00
MdePkg.dsc MdePkg: Add BaseRiscVSbiLib Library for RISC-V 2023-02-16 05:53:28 +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