The next patch reports HWCAP_SPARC_CRYPTO to linux-user guests.
A multiarch glibc then picks its niagara4 memcpy/memset, which
store with ASI 0xe2. QEMU only allows that store on CPUs with
HYPV, so every dynamically linked program dies with SIGILL.

The crypto opcodes exist only on T4 and later, and all of those
have the block-init ASIs.

Reproduced with Gentoo sparc64 stage3 sysroot:
qemu-sparc64 -L <stage3 root> -cpu \
TI-UltraSparc-IIi,+crypto <stage3 root>/usr/bin/dd --version

Signed-off-by: Stian Halseth <[email protected]>
---
 target/sparc/translate.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index 921ffd2d1b..931fc006ce 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -1863,8 +1863,12 @@ static void gen_st_asi(DisasContext *dc, DisasASI *da, 
TCGv src, TCGv addr)
         if (TARGET_LONG_BITS == 32) {
             gen_exception(dc, TT_ILL_INSN);
             break;
-        } else if (!(dc->def->features & CPU_FEATURE_HYPV)) {
-            /* Pre OpenSPARC CPUs don't have these */
+        } else if (!(dc->def->features &
+                    (CPU_FEATURE_HYPV | CPU_FEATURE_CRYPTO))) {
+            /*
+             * Pre-OpenSPARC CPUs lack block-init stores. Crypto instructions
+             * imply T4 or later, which supports them.
+             */
             gen_exception(dc, TT_ILL_INSN);
             break;
         }
-- 
2.43.0


Reply via email to