mirror of https://github.com/proxmox/mirror_qemu
target/riscv: Add MAX_INSN_LEN and insn_len
These will be useful in properly ending the TB. Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Acked-by: Ilya Leoshkevich <iii@linux.ibm.com> Tested-by: Ilya Leoshkevich <iii@linux.ibm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>master
parent
950936681f
commit
ef6e987b64
|
@ -1022,6 +1022,14 @@ static uint32_t opcode_at(DisasContextBase *dcbase, target_ulong pc)
|
||||||
/* Include decoders for factored-out extensions */
|
/* Include decoders for factored-out extensions */
|
||||||
#include "decode-XVentanaCondOps.c.inc"
|
#include "decode-XVentanaCondOps.c.inc"
|
||||||
|
|
||||||
|
/* The specification allows for longer insns, but not supported by qemu. */
|
||||||
|
#define MAX_INSN_LEN 4
|
||||||
|
|
||||||
|
static inline int insn_len(uint16_t first_word)
|
||||||
|
{
|
||||||
|
return (first_word & 3) == 3 ? 4 : 2;
|
||||||
|
}
|
||||||
|
|
||||||
static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode)
|
static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1037,7 +1045,7 @@ static void decode_opc(CPURISCVState *env, DisasContext *ctx, uint16_t opcode)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Check for compressed insn */
|
/* Check for compressed insn */
|
||||||
if (extract16(opcode, 0, 2) != 3) {
|
if (insn_len(opcode) == 2) {
|
||||||
if (!has_ext(ctx, RVC)) {
|
if (!has_ext(ctx, RVC)) {
|
||||||
gen_exception_illegal(ctx);
|
gen_exception_illegal(ctx);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue