]> 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)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 5 Jun 2024 10:06:15 +0000 (13:06 +0300)
commitfb1be88084b69e53bcd6c12534113e68dd98d39e
tree0a2a8219f3495d2a15f44fd2caadde08dd394ac3
parenta58758c5df749a0d7133231cf68c9d9384424304
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>
(cherry picked from commit c5eb8d6336741dbcb98efcc347f8265bf60bc9d1)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
target/riscv/insn_trans/trans_rvzicbo.c.inc