[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 04/24] target/riscv: additional code information for sw check
From: |
Deepak Gupta |
Subject: |
[PATCH v2 04/24] target/riscv: additional code information for sw check |
Date: |
Mon, 29 Jul 2024 10:53:06 -0700 |
sw check exception support was recently added. This patch further augments
sw check exception by providing support for additional code which is
provided in *tval. Adds `sw_check_code` field in cpuarchstate. Whenever
sw check exception is raised *tval gets the value deposited in
`sw_check_code`.
Signed-off-by: Deepak Gupta <debug@rivosinc.com>
---
target/riscv/cpu.h | 2 ++
target/riscv/cpu_helper.c | 2 ++
target/riscv/csr.c | 1 +
3 files changed, 5 insertions(+)
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 8c7841fc08..12334f9540 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -224,6 +224,8 @@ struct CPUArchState {
/* elp state for zicfilp extension */
cfi_elp elp;
+ /* sw check code for sw check exception */
+ target_ulong sw_check_code;
#ifdef CONFIG_USER_ONLY
uint32_t elf_flags;
bool ufcfien;
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
index fb4b6066d3..41bc73ad60 100644
--- a/target/riscv/cpu_helper.c
+++ b/target/riscv/cpu_helper.c
@@ -1762,6 +1762,8 @@ void riscv_cpu_do_interrupt(CPUState *cs)
cs->watchpoint_hit = NULL;
}
break;
+ case RISCV_EXCP_SW_CHECK:
+ tval = env->sw_check_code;
default:
break;
}
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index 5771a14848..a5a969a377 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -1179,6 +1179,7 @@ static const uint64_t all_ints = M_MODE_INTERRUPTS |
S_MODE_INTERRUPTS |
(1ULL << (RISCV_EXCP_INST_PAGE_FAULT)) | \
(1ULL << (RISCV_EXCP_LOAD_PAGE_FAULT)) | \
(1ULL << (RISCV_EXCP_STORE_PAGE_FAULT)) | \
+ (1ULL << (RISCV_EXCP_SW_CHECK)) | \
(1ULL << (RISCV_EXCP_INST_GUEST_PAGE_FAULT)) | \
(1ULL << (RISCV_EXCP_LOAD_GUEST_ACCESS_FAULT)) | \
(1ULL << (RISCV_EXCP_VIRT_INSTRUCTION_FAULT)) | \
--
2.44.0
- [PATCH v2 00/24] riscv support for control flow integrity extensions, Deepak Gupta, 2024/07/29
- [PATCH v2 01/24] target/riscv: Add zicfilp extension, Deepak Gupta, 2024/07/29
- [PATCH v2 02/24] target/riscv: Introduce elp state and enabling controls for zicfilp, Deepak Gupta, 2024/07/29
- [PATCH v2 03/24] target/riscv: save and restore elp state on priv transitions, Deepak Gupta, 2024/07/29
- [PATCH v2 05/24] target/riscv: tracking indirect branches (fcfi) for zicfilp, Deepak Gupta, 2024/07/29
- [PATCH v2 04/24] target/riscv: additional code information for sw check,
Deepak Gupta <=
- [PATCH v2 06/24] target/riscv: zicfilp `lpad` impl and branch tracking, Deepak Gupta, 2024/07/29
- [PATCH v2 07/24] disas/riscv: enabled `lpad` disassembly, Deepak Gupta, 2024/07/29
- [PATCH v2 08/24] linux-user/syscall: introduce prctl for indirect branch tracking, Deepak Gupta, 2024/07/29
- [PATCH v2 09/24] linux-user/riscv: implement indirect branch tracking prctls, Deepak Gupta, 2024/07/29
- [PATCH v2 10/24] target/riscv: Add zicfiss extension, Deepak Gupta, 2024/07/29
- [PATCH v2 11/24] target/riscv: introduce ssp and enabling controls for zicfiss, Deepak Gupta, 2024/07/29
- [PATCH v2 16/24] target/riscv: shadow stack mmu index for shadow stack instructions, Deepak Gupta, 2024/07/29
- [PATCH v2 12/24] target/riscv: tb flag for shadow stack instructions, Deepak Gupta, 2024/07/29