@@ -65,6 +65,7 @@ static bool trans_lpad(DisasContext *ctx, arg_lpad *a)
tcg_constant_tl(RISCV_EXCP_SW_CHECK_FCFI_TVAL),
tcg_env, offsetof(CPURISCVState, sw_check_code));
generate_exception(ctx, RISCV_EXCP_SW_CHECK);
+ trace_zicfilp_unaligned_lpad_instr((uint64_t) ctx->base.pc_next);
return true;
}
}
@@ -24,6 +24,7 @@
#include "exec/exec-all.h"
#include "exec/cpu_ldst.h"
#include "exec/helper-proto.h"
+#include "trace.h"
/* Exceptions processing helpers */
G_NORETURN void riscv_raise_exception(CPURISCVState *env,
@@ -283,6 +284,8 @@ void helper_cfi_check_landing_pad(CPURISCVState *env, int lbl)
* greater than 31 and then shift 12 right
*/
if (lbl && (lbl != ((env->gpr[xT2] & 0xFFFFFFFF) >> 12))) {
+ trace_zicfilp_lpad_reg_mismatch(lbl,
+ (env->gpr[xT2] & 0xFFFFFFFF) >> 12);
env->sw_check_code = RISCV_EXCP_SW_CHECK_FCFI_TVAL;
riscv_raise_exception(env, RISCV_EXCP_SW_CHECK, GETPC());
}
@@ -295,6 +298,7 @@ void helper_sschk_mismatch(CPURISCVState *env, target_ulong rs1,
target_ulong ssra)
{
if (rs1 != ssra) {
+ trace_zicfiss_sspopchk_reg_mismatch((uint64_t)ssra, (uint64_t) rs1);
env->sw_check_code = RISCV_EXCP_SW_CHECK_BCFI_TVAL;
riscv_raise_exception(env, RISCV_EXCP_SW_CHECK, GETPC());
}
@@ -9,3 +9,9 @@ pmpaddr_csr_write(uint64_t mhartid, uint32_t addr_index, uint64_t val) "hart %"
mseccfg_csr_read(uint64_t mhartid, uint64_t val) "hart %" PRIu64 ": read mseccfg, val: 0x%" PRIx64
mseccfg_csr_write(uint64_t mhartid, uint64_t val) "hart %" PRIu64 ": write mseccfg, val: 0x%" PRIx64
+
+# zicfiss/lp
+zicfiss_sspopchk_reg_mismatch(uint64_t ssra, uint64_t rs1) "shadow_stack_ra: 0x%" PRIx64 ", rs1: 0x%" PRIx64
+zicfilp_missing_lpad_instr(uint64_t pc_first) "pc_first: 0x%" PRIx64
+zicfilp_unaligned_lpad_instr(uint64_t pc_next) "pc_next: 0x%" PRIx64
+zicfilp_lpad_reg_mismatch(int lpad_label, int t2_label) "lpad_label: 0x%x, t2_label: 0x%x"
@@ -30,6 +30,7 @@
#include "semihosting/semihost.h"
#include "internals.h"
+#include "trace.h"
#define HELPER_H "helper.h"
#include "exec/helper-info.c.inc"
@@ -1380,6 +1381,7 @@ static void riscv_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
* illegal instruction exception.
*/
tcg_set_insn_param(cfi_lp_check, 1, tcgv_i32_arg(tcg_constant_i32(1)));
+ trace_zicfilp_missing_lpad_instr((uint64_t) ctx->base.pc_first);
}
}