lib: sbi_trap: Redirect exception based on hedeleg
authordramforever <dramforever@live.com>
Sun, 12 Jun 2022 05:57:37 +0000 (13:57 +0800)
committerAnup Patel <anup@brainfault.org>
Mon, 13 Jun 2022 05:32:49 +0000 (11:02 +0530)
commitadc3388d76af18487d8ba4a53a1d1e83655435f3
treedd439e726ea4330cc2123049538d9dcc8b09d010
parentcb8271c8e43e3c317436b7377c4fa0ac669f8fb5
lib: sbi_trap: Redirect exception based on hedeleg

HS-mode software can choose what exceptions to delegate to VS-mode using
the hedeleg CSR. Synthetic VS/VU-mode exceptions should also honor
hedeleg. They should be redirected to VS-mode if and only if delegated
by HS-mode.

Signed-off-by: dramforever <dramforever@live.com>
Reviewed-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
lib/sbi/sbi_trap.c