target/loongarch: check_vec support check LASX instructions
Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Song Gao <gaosong@loongson.cn> Message-Id: <20230914022645.1151356-13-gaosong@loongson.cn>
This commit is contained in:
parent
008a3b1662
commit
b8f1bdf3d1
@ -55,6 +55,7 @@ static const char * const excp_names[] = {
|
||||
[EXCCODE_DBP] = "Debug breakpoint",
|
||||
[EXCCODE_BCE] = "Bound Check Exception",
|
||||
[EXCCODE_SXD] = "128 bit vector instructions Disable exception",
|
||||
[EXCCODE_ASXD] = "256 bit vector instructions Disable exception",
|
||||
};
|
||||
|
||||
const char *loongarch_exception_name(int32_t exception)
|
||||
@ -190,6 +191,7 @@ static void loongarch_cpu_do_interrupt(CPUState *cs)
|
||||
case EXCCODE_FPD:
|
||||
case EXCCODE_FPE:
|
||||
case EXCCODE_SXD:
|
||||
case EXCCODE_ASXD:
|
||||
env->CSR_BADV = env->pc;
|
||||
QEMU_FALLTHROUGH;
|
||||
case EXCCODE_BCE:
|
||||
|
@ -462,6 +462,7 @@ static inline void set_pc(CPULoongArchState *env, uint64_t value)
|
||||
#define HW_FLAGS_CRMD_PG R_CSR_CRMD_PG_MASK /* 0x10 */
|
||||
#define HW_FLAGS_EUEN_FPE 0x04
|
||||
#define HW_FLAGS_EUEN_SXE 0x08
|
||||
#define HW_FLAGS_EUEN_ASXE 0x10
|
||||
#define HW_FLAGS_VA32 0x20
|
||||
|
||||
static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, vaddr *pc,
|
||||
@ -472,6 +473,7 @@ static inline void cpu_get_tb_cpu_state(CPULoongArchState *env, vaddr *pc,
|
||||
*flags = env->CSR_CRMD & (R_CSR_CRMD_PLV_MASK | R_CSR_CRMD_PG_MASK);
|
||||
*flags |= FIELD_EX64(env->CSR_EUEN, CSR_EUEN, FPE) * HW_FLAGS_EUEN_FPE;
|
||||
*flags |= FIELD_EX64(env->CSR_EUEN, CSR_EUEN, SXE) * HW_FLAGS_EUEN_SXE;
|
||||
*flags |= FIELD_EX64(env->CSR_EUEN, CSR_EUEN, ASXE) * HW_FLAGS_EUEN_ASXE;
|
||||
*flags |= is_va32(env) * HW_FLAGS_VA32;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,12 @@ static bool check_vec(DisasContext *ctx, uint32_t oprsz)
|
||||
generate_exception(ctx, EXCCODE_SXD);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((oprsz == 32) && ((ctx->base.tb->flags & HW_FLAGS_EUEN_ASXE) == 0)) {
|
||||
generate_exception(ctx, EXCCODE_ASXD);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user