From: Florian Krohm Date: Thu, 27 Mar 2025 16:30:03 +0000 (+0000) Subject: s390x: PRNO tidy X-Git-Tag: VALGRIND_3_25_0~83 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f373a5f779c9e35b1fe1235298357db73aee088;p=thirdparty%2Fvalgrind.git s390x: PRNO tidy The mnemonics PRNO and PPNO denote the same opcode. Both names were used in the code. Not anymore. From now on: consistent naming PRNO / prno While I was at it: - Remove left-overs from the early days when PRNO was implemented by means of dirty helpers. - Fix disassembly to use "prno". - Fix a bug in s390_irgen_DFLTCC which was using "ppno" as mnemonic. --- diff --git a/VEX/priv/guest_s390_defs.h b/VEX/priv/guest_s390_defs.h index 607773ad1..0039f5e78 100644 --- a/VEX/priv/guest_s390_defs.h +++ b/VEX/priv/guest_s390_defs.h @@ -90,9 +90,7 @@ UInt s390_do_cvb(ULong decimal); ULong s390_do_cvd(ULong binary); ULong s390_do_ecag(ULong op2addr); UInt s390_do_pfpo(UInt gpr0); -void s390x_dirtyhelper_PPNO_query(VexGuestS390XState *guest_state, ULong r1, ULong r2); -ULong s390x_dirtyhelper_PPNO_sha512(VexGuestS390XState *guest_state, ULong r1, ULong r2); -void s390x_dirtyhelper_PPNO_sha512_load_param_block( void ); + /* The various ways to compute the condition code. */ enum { S390_CC_OP_BITWISE = 0, diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index 94d0a242d..bbba22b47 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -2659,75 +2659,6 @@ s390x_dirtyhelper_vec_op(VexGuestS390XState *guest_state, #endif -/*-----------------------------------------------------------------*/ -/*--- Dirty helper for Perform Pseudorandom number instruction ---*/ -/*-----------------------------------------------------------------*/ - -/* Dummy helper that is needed to indicate load of parameter block. - We have to use it because dirty helper cannot have two memory side - effects. - */ -void s390x_dirtyhelper_PPNO_sha512_load_param_block( void ) -{ -} - -#if defined(VGA_s390x) - -/* IMPORTANT! - We return here bit mask where only supported functions are set to one. - If you implement new functions don't forget the supported array. - */ -void -s390x_dirtyhelper_PPNO_query(VexGuestS390XState *guest_state, ULong r1, ULong r2) -{ - ULong supported[2] = {0x9000000000000000ULL, 0x0000000000000000ULL}; - ULong *result = (ULong*) guest_state->guest_r1; - - result[0] = supported[0]; - result[1] = supported[1]; -} - -ULong -s390x_dirtyhelper_PPNO_sha512(VexGuestS390XState *guest_state, ULong r1, ULong r2) -{ - ULong* op1 = (ULong*) (((ULong)(&guest_state->guest_r0)) + r1 * sizeof(ULong)); - ULong* op2 = (ULong*) (((ULong)(&guest_state->guest_r0)) + r2 * sizeof(ULong)); - - register ULong reg0 asm("0") = guest_state->guest_r0; - register ULong reg1 asm("1") = guest_state->guest_r1; - register ULong reg2 asm("2") = op1[0]; - register ULong reg3 asm("3") = op1[1]; - register ULong reg4 asm("4") = op2[0]; - register ULong reg5 asm("5") = op2[1]; - - ULong cc = 0; - asm volatile(".insn rre, 0xb93c0000, %%r2, %%r4\n" - "ipm %[cc]\n" - "srl %[cc], 28\n" - : "+d"(reg0), "+d"(reg1), - "+d"(reg2), "+d"(reg3), - "+d"(reg4), "+d"(reg5), - [cc] "=d"(cc) - : - : "cc", "memory"); - - return cc; -} - -#else - -void -s390x_dirtyhelper_PPNO_query(VexGuestS390XState *guest_state, ULong r1, ULong r2) -{ -} - -ULong -s390x_dirtyhelper_PPNO_sha512(VexGuestS390XState *guest_state, ULong r1, ULong r2) -{ - return 0; -} - -#endif /* VGA_s390x */ /*---------------------------------------------------------------*/ /*--- end guest_s390_helpers.c ---*/ /*---------------------------------------------------------------*/ diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index f8caf5316..1ed10acbb 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -17357,20 +17357,19 @@ s390_irgen_LCBB(UChar r1, IRTemp op2addr, UChar m3) return "lcbb"; } -/* Also known as "PRNO" */ static const HChar * -s390_irgen_PPNO(UChar r1, UChar r2) +s390_irgen_PRNO(UChar r1, UChar r2) { if (!s390_host_has_msa5) { - emulation_failure(EmFail_S390X_ppno); - return "ppno"; + emulation_failure(EmFail_S390X_prno); + return "prno"; } /* Check for obvious specification exceptions */ - s390_insn_assert("ppno", r1 % 2 == 0 && r2 % 2 == 0 && r1 != 0 && r2 != 0); + s390_insn_assert("prno", r1 % 2 == 0 && r2 % 2 == 0 && r1 != 0 && r2 != 0); extension(S390_EXT_PRNO, r1 | (r2 << 4)); - return "ppno"; + return "prno"; } static const HChar * @@ -17378,7 +17377,7 @@ s390_irgen_DFLTCC(UChar r3, UChar r1, UChar r2) { if (!s390_host_has_dflt) { emulation_failure(EmFail_S390X_dflt); - return "ppno"; + return "dfltcc"; } /* Check for obvious specification exceptions */ @@ -21083,7 +21082,7 @@ s390_decode_4byte_and_irgen(const UChar *bytes) case 0xb93a: s390_format_RRE_RR(s390_irgen_KDSA, RRE_r1(ovl), RRE_r2(ovl)); goto ok; case 0xb93b: s390_format_E(s390_irgen_NNPA); goto ok; - case 0xb93c: s390_format_RRE_RR(s390_irgen_PPNO, RRE_r1(ovl), + case 0xb93c: s390_format_RRE_RR(s390_irgen_PRNO, RRE_r1(ovl), RRE_r2(ovl)); goto ok; case 0xb93e: s390_format_RRE_RR(s390_irgen_KIMD, RRE_r1(ovl), RRE_r2(ovl)); goto ok; diff --git a/VEX/priv/main_main.c b/VEX/priv/main_main.c index 80f6d6a6d..fe3cf9e57 100644 --- a/VEX/priv/main_main.c +++ b/VEX/priv/main_main.c @@ -1561,8 +1561,8 @@ const HChar* LibVEX_EmNote_string ( VexEmNote ew ) case EmFail_S390X_vx: return "Encountered an instruction that requires the vector facility.\n" " That facility is not available on this host"; - case EmFail_S390X_ppno: - return "Instruction ppno is not supported on this host."; + case EmFail_S390X_prno: + return "Instruction prno is not supported on this host."; case EmFail_S390X_vxe: return "Encountered an instruction that requires the vector-extensions" " facility 1.\n" diff --git a/VEX/priv/s390_defs.h b/VEX/priv/s390_defs.h index da5113f7d..482dc4f0e 100644 --- a/VEX/priv/s390_defs.h +++ b/VEX/priv/s390_defs.h @@ -144,27 +144,6 @@ typedef enum { S390_PFPO_D128_TO_F128 = 0x01070A } s390_pfpo_function_t; -/* PPNO function code as it is encoded in bits [57:63] of GR0 - when PPNO insn is executed. */ -typedef enum -{ - S390_PPNO_QUERY = 0x00, - S390_PPNO_SHA512_GEN = 0x03, - S390_PPNO_SHA512_SEED = 0x83 -} s390_ppno_function_t; - -/* Size of parameter block for PPNO functions. - All values are in bytes. - */ -#define S390_PPNO_PARAM_BLOCK_SIZE_QUERY 16 -#define S390_PPNO_PARAM_BLOCK_SIZE_SHA512 240 - -/* Maximum length of modified memory for PPNO functions. - All values are in bytes. -*/ -#define S390_PPNO_MAX_SIZE_SHA512_SEED 512 -#define S390_PPNO_MAX_SIZE_SHA512_GEN 64 - /* The length of the longest mnemonic: locfhrnhe */ #define S390_MAX_MNEMONIC_LEN 9 diff --git a/VEX/pub/libvex_emnote.h b/VEX/pub/libvex_emnote.h index c3ebcf420..27b95880c 100644 --- a/VEX/pub/libvex_emnote.h +++ b/VEX/pub/libvex_emnote.h @@ -121,8 +121,8 @@ typedef /* some insn needs vector facility which is not available on this host */ EmFail_S390X_vx, - /* ppno insn is not supported on this host */ - EmFail_S390X_ppno, + /* prno insn is not supported on this host */ + EmFail_S390X_prno, /* insn needs vector-enhancements facility 1 which is not available on this host */