[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] target/riscv: fence.i: update decode pattern
From: |
Andrew Jones |
Subject: |
Re: [PATCH 1/2] target/riscv: fence.i: update decode pattern |
Date: |
Fri, 12 Aug 2022 16:01:03 +0200 |
Please use a cover-letter for multi-patch patch series.
On Fri, Aug 12, 2022 at 03:13:03PM +0200, Philipp Tomsich wrote:
> The RISC-V specification specifies imm12, rs1 and rd to be all-zeros,
> so we can't ignore these bits when decoding into fence.i.
>
> Update the decode pattern to reflect the specification.
I got hung-up on this for a bit since there isn't any "must-be-0" fields,
only ignored fields, but the next patch gives a clue which helped me make
sense of this. The encoding of these instructions with ignored fields set
to anything except zero gets into reserved instruction territory, and QEMU
may legally raise an illegal-instruction in that case, which this patch
will start doing. It'd be nice to have a bit more text in this commit
message to make that clear.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
> ---
>
> target/riscv/insn32.decode | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/riscv/insn32.decode b/target/riscv/insn32.decode
> index 014127d066..089128c3dc 100644
> --- a/target/riscv/insn32.decode
> +++ b/target/riscv/insn32.decode
> @@ -151,7 +151,7 @@ sra 0100000 ..... ..... 101 ..... 0110011 @r
> or 0000000 ..... ..... 110 ..... 0110011 @r
> and 0000000 ..... ..... 111 ..... 0110011 @r
> fence ---- pred:4 succ:4 ----- 000 ----- 0001111
> -fence_i ---- ---- ---- ----- 001 ----- 0001111
> +fence_i 000000000000 00000 001 00000 0001111
^ need two more spaces here to line up with fence.
> csrrw ............ ..... 001 ..... 1110011 @csr
> csrrs ............ ..... 010 ..... 1110011 @csr
> csrrc ............ ..... 011 ..... 1110011 @csr
> --
> 2.34.1
>
>
Thanks,
drew