]> git.ipfire.org Git - thirdparty/qemu.git/commit
target/riscv: rvzicbo: Fixup CBO extension register calculation
authorAlistair Francis <alistair23@gmail.com>
Tue, 14 May 2024 02:39:10 +0000 (12:39 +1000)
committerAlistair Francis <alistair.francis@wdc.com>
Mon, 3 Jun 2024 01:12:12 +0000 (11:12 +1000)
commitc5eb8d6336741dbcb98efcc347f8265bf60bc9d1
treec0c57784763af70d8e38b413a472234ae020c04c
parent73ef14b1277d4c9d79bfe7cb080c09ddba18044f
target/riscv: rvzicbo: Fixup CBO extension register calculation

When running the instruction

```
    cbo.flush 0(x0)
```

QEMU would segfault.

The issue was in cpu_gpr[a->rs1] as QEMU does not have cpu_gpr[0]
allocated.

In order to fix this let's use the existing get_address()
helper. This also has the benefit of performing pointer mask
calculations on the address specified in rs1.

The pointer masking specificiation specifically states:

"""
Cache Management Operations: All instructions in Zicbom, Zicbop and Zicboz
"""

So this is the correct behaviour and we previously have been incorrectly
not masking the address.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reported-by: Fabian Thomas <fabian.thomas@cispa.de>
Fixes: e05da09b7cfd ("target/riscv: implement Zicbom extension")
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-stable <qemu-stable@nongnu.org>
Message-ID: <20240514023910.301766-1-alistair.francis@wdc.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
target/riscv/insn_trans/trans_rvzicbo.c.inc