You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(122) |
Nov
(152) |
Dec
(69) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(6) |
Feb
(25) |
Mar
(73) |
Apr
(82) |
May
(24) |
Jun
(25) |
Jul
(10) |
Aug
(11) |
Sep
(10) |
Oct
(54) |
Nov
(203) |
Dec
(182) |
2004 |
Jan
(307) |
Feb
(305) |
Mar
(430) |
Apr
(312) |
May
(187) |
Jun
(342) |
Jul
(487) |
Aug
(637) |
Sep
(336) |
Oct
(373) |
Nov
(441) |
Dec
(210) |
2005 |
Jan
(385) |
Feb
(480) |
Mar
(636) |
Apr
(544) |
May
(679) |
Jun
(625) |
Jul
(810) |
Aug
(838) |
Sep
(634) |
Oct
(521) |
Nov
(965) |
Dec
(543) |
2006 |
Jan
(494) |
Feb
(431) |
Mar
(546) |
Apr
(411) |
May
(406) |
Jun
(322) |
Jul
(256) |
Aug
(401) |
Sep
(345) |
Oct
(542) |
Nov
(308) |
Dec
(481) |
2007 |
Jan
(427) |
Feb
(326) |
Mar
(367) |
Apr
(255) |
May
(244) |
Jun
(204) |
Jul
(223) |
Aug
(231) |
Sep
(354) |
Oct
(374) |
Nov
(497) |
Dec
(362) |
2008 |
Jan
(322) |
Feb
(482) |
Mar
(658) |
Apr
(422) |
May
(476) |
Jun
(396) |
Jul
(455) |
Aug
(267) |
Sep
(280) |
Oct
(253) |
Nov
(232) |
Dec
(304) |
2009 |
Jan
(486) |
Feb
(470) |
Mar
(458) |
Apr
(423) |
May
(696) |
Jun
(461) |
Jul
(551) |
Aug
(575) |
Sep
(134) |
Oct
(110) |
Nov
(157) |
Dec
(102) |
2010 |
Jan
(226) |
Feb
(86) |
Mar
(147) |
Apr
(117) |
May
(107) |
Jun
(203) |
Jul
(193) |
Aug
(238) |
Sep
(300) |
Oct
(246) |
Nov
(23) |
Dec
(75) |
2011 |
Jan
(133) |
Feb
(195) |
Mar
(315) |
Apr
(200) |
May
(267) |
Jun
(293) |
Jul
(353) |
Aug
(237) |
Sep
(278) |
Oct
(611) |
Nov
(274) |
Dec
(260) |
2012 |
Jan
(303) |
Feb
(391) |
Mar
(417) |
Apr
(441) |
May
(488) |
Jun
(655) |
Jul
(590) |
Aug
(610) |
Sep
(526) |
Oct
(478) |
Nov
(359) |
Dec
(372) |
2013 |
Jan
(467) |
Feb
(226) |
Mar
(391) |
Apr
(281) |
May
(299) |
Jun
(252) |
Jul
(311) |
Aug
(352) |
Sep
(481) |
Oct
(571) |
Nov
(222) |
Dec
(231) |
2014 |
Jan
(185) |
Feb
(329) |
Mar
(245) |
Apr
(238) |
May
(281) |
Jun
(399) |
Jul
(382) |
Aug
(500) |
Sep
(579) |
Oct
(435) |
Nov
(487) |
Dec
(256) |
2015 |
Jan
(338) |
Feb
(357) |
Mar
(330) |
Apr
(294) |
May
(191) |
Jun
(108) |
Jul
(142) |
Aug
(261) |
Sep
(190) |
Oct
(54) |
Nov
(83) |
Dec
(22) |
2016 |
Jan
(49) |
Feb
(89) |
Mar
(33) |
Apr
(50) |
May
(27) |
Jun
(34) |
Jul
(53) |
Aug
(53) |
Sep
(98) |
Oct
(206) |
Nov
(93) |
Dec
(53) |
2017 |
Jan
(65) |
Feb
(82) |
Mar
(102) |
Apr
(86) |
May
(187) |
Jun
(67) |
Jul
(23) |
Aug
(93) |
Sep
(65) |
Oct
(45) |
Nov
(35) |
Dec
(17) |
2018 |
Jan
(26) |
Feb
(35) |
Mar
(38) |
Apr
(32) |
May
(8) |
Jun
(43) |
Jul
(27) |
Aug
(30) |
Sep
(43) |
Oct
(42) |
Nov
(38) |
Dec
(67) |
2019 |
Jan
(32) |
Feb
(37) |
Mar
(53) |
Apr
(64) |
May
(49) |
Jun
(18) |
Jul
(14) |
Aug
(53) |
Sep
(25) |
Oct
(30) |
Nov
(49) |
Dec
(31) |
2020 |
Jan
(87) |
Feb
(45) |
Mar
(37) |
Apr
(51) |
May
(99) |
Jun
(36) |
Jul
(11) |
Aug
(14) |
Sep
(20) |
Oct
(24) |
Nov
(40) |
Dec
(23) |
2021 |
Jan
(14) |
Feb
(53) |
Mar
(85) |
Apr
(15) |
May
(19) |
Jun
(3) |
Jul
(14) |
Aug
(1) |
Sep
(57) |
Oct
(73) |
Nov
(56) |
Dec
(22) |
2022 |
Jan
(3) |
Feb
(22) |
Mar
(6) |
Apr
(55) |
May
(46) |
Jun
(39) |
Jul
(15) |
Aug
(9) |
Sep
(11) |
Oct
(34) |
Nov
(20) |
Dec
(36) |
2023 |
Jan
(79) |
Feb
(41) |
Mar
(99) |
Apr
(169) |
May
(48) |
Jun
(16) |
Jul
(16) |
Aug
(57) |
Sep
(83) |
Oct
(89) |
Nov
(97) |
Dec
(30) |
2024 |
Jan
(25) |
Feb
(73) |
Mar
(76) |
Apr
(122) |
May
(46) |
Jun
(44) |
Jul
(27) |
Aug
(30) |
Sep
(33) |
Oct
(67) |
Nov
(91) |
Dec
(70) |
2025 |
Jan
(44) |
Feb
(36) |
Mar
(85) |
Apr
(100) |
May
(138) |
Jun
(55) |
Jul
(107) |
Aug
(27) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Paul F. <pa...@so...> - 2025-03-23 17:10:51
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=d337969da4a5a2870414854fed0dd2f9ea969d4e commit d337969da4a5a2870414854fed0dd2f9ea969d4e Author: Paul Floyd <pj...@wa...> Date: Sun Mar 23 18:09:14 2025 +0100 FreeBSD: update comments for amd64 do_syscall_WRK Get the comments about the last two stack arguments right. Diff: --- coregrind/m_syscall.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/coregrind/m_syscall.c b/coregrind/m_syscall.c index 54c7bd8952..c76f1df81b 100644 --- a/coregrind/m_syscall.c +++ b/coregrind/m_syscall.c @@ -755,8 +755,9 @@ asm( #elif defined(VGP_amd64_freebsd) /* Convert function calling convention --> SYSCALL_STD calling - convention - PJF - not sure why we don't use SYSCALL0 convention like x86 + convention. + Last stack arguments need to be pushed first, hence + a8 is pushed before a7. */ extern UWord do_syscall_WRK ( UWord syscall_no, /* %rdi */ @@ -782,10 +783,10 @@ asm( " movq %rcx, %rdx\n" /* a3 */ " movq %r8, %r10\n" /* a4 */ " movq %r9, %r8\n" /* a5 */ -" movq 16(%rbp), %r9\n" /* a6 last arg from stack, account for %rbp */ -" movq 32(%rbp), %r11\n" /* a7 from stack */ +" movq 16(%rbp), %r9\n" /* a6 last register arg from stack, account for %rbp */ +" movq 32(%rbp), %r11\n" /* a8 from stack */ " pushq %r11\n" -" movq 24(%rbp), %r11\n" /* a8 from stack */ +" movq 24(%rbp), %r11\n" /* a7 from stack */ " pushq %r11\n" " subq $8,%rsp\n" /* fake return addr */ " syscall\n" |
From: Florian K. <fk...@so...> - 2025-03-23 16:01:10
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=18126eeccca9f257824ba3d899400cc21b4dff74 commit 18126eeccca9f257824ba3d899400cc21b4dff74 Author: Florian Krohm <fl...@ei...> Date: Sun Mar 23 16:00:19 2025 +0000 Tweak debuginfod-check.pl Testing the presence of debuginfod causes an error message in case it is not installed. Suppress that message. Diff: --- memcheck/tests/linux/debuginfod-check.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/memcheck/tests/linux/debuginfod-check.pl b/memcheck/tests/linux/debuginfod-check.pl index 4a2c1c1e1d..797aad210d 100755 --- a/memcheck/tests/linux/debuginfod-check.pl +++ b/memcheck/tests/linux/debuginfod-check.pl @@ -30,8 +30,8 @@ sub mysystem($) } # Check that debuginfod and debuginfod-find can be found -mysystem("debuginfod --help > /dev/null"); -mysystem("debuginfod-find --help > /dev/null"); +mysystem("debuginfod --help > /dev/null 2> /dev/null"); +mysystem("debuginfod-find --help > /dev/null 2> /dev/null"); $SIG{'INT'} = sub { cleanup_and_exit(1) }; |
From: Paul F. <pj...@wa...> - 2025-03-23 15:43:27
|
On 3/22/25 20:03, Florian Krohm wrote: > When I run perl tests/vg_regtest > memcheck/tests/linux/debuginfod-check.vgtest > I see this error: > > sh: 1: debuginfod: not found > > debuginfod-check: (skipping, prereq failed: ./debuginfod-check.pl) > > which is caused by debuginfod not being installed on my machine. > The patch below suppressed the error message. > > OK? OK with me. A+ Paul |
From: Paul F. <pa...@so...> - 2025-03-23 09:22:45
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=f87c58e89c4a0e85c59f39a7ae01027686bfff73 commit f87c58e89c4a0e85c59f39a7ae01027686bfff73 Author: Paul Floyd <pj...@wa...> Date: Sun Mar 23 10:21:29 2025 +0100 Bug 501893 - Missing suppression for __wcscat_avx2 (strcat-strlen-avx2.h.S:68)? Diff: --- .gitignore | 1 + NEWS | 1 + memcheck/tests/Makefile.am | 2 ++ memcheck/tests/wcpncpy.stderr.exp | 8 ++++---- memcheck/tests/wcscat.c | 20 ++++++++++++++++++++ memcheck/tests/wcscat.stderr.exp | 0 memcheck/tests/wcscat.stdout.exp | 1 + memcheck/tests/wcscat.vgtest | 2 ++ shared/vg_replace_strmem.c | 29 +++++++++++++++++++++++++++++ 9 files changed, 60 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 45290719a6..d64b9fab74 100644 --- a/.gitignore +++ b/.gitignore @@ -1045,6 +1045,7 @@ /memcheck/tests/vcpu_fnfns /memcheck/tests/vgtest_ume /memcheck/tests/wcs +/memcheck/tests/wcscat /memcheck/tests/weirdioctl /memcheck/tests/with space /memcheck/tests/wcpncpy diff --git a/NEWS b/NEWS index d42a5f479a..e4e6769ba8 100644 --- a/NEWS +++ b/NEWS @@ -68,6 +68,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 501365 syscall userfaultfd not wrapped 501846 Add x86 Linux shm wrappers 501850 FreeBSD syscall arguments 7 and 8 incorrect. +501893 Missing suppression for __wcscat_avx2 (strcat-strlen-avx2.h.S:68)? To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index 8a5e0e1f72..bdaa9d761e 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -450,6 +450,7 @@ EXTRA_DIST = \ vcpu_fnfns.stderr.exp vcpu_fnfns.vgtest \ wcpncpy.stderr.exp wcpncpy.vgtest \ wcs.vgtest wcs.stderr.exp wcs.stdout.exp \ + wcscat.vgtest wcscat.stderr.exp wcscat.stdout.exp \ wcsncpy.vgtest wcsncpy.stderr.exp \ wmemcmp.vgtest wmemcmp.stderr.exp \ wrap1.vgtest wrap1.stdout.exp wrap1.stderr.exp \ @@ -556,6 +557,7 @@ check_PROGRAMS = \ varinforestrict \ vcpu_fbench vcpu_fnfns \ wcs \ + wcscat \ xml1 \ wmemcmp \ wrap1 wrap2 wrap3 wrap4 wrap5 wrap6 wrap7 wrap7so.so wrap8 \ diff --git a/memcheck/tests/wcpncpy.stderr.exp b/memcheck/tests/wcpncpy.stderr.exp index abe23b7730..0ff9e5c741 100644 --- a/memcheck/tests/wcpncpy.stderr.exp +++ b/memcheck/tests/wcpncpy.stderr.exp @@ -1,19 +1,19 @@ Conditional jump or move depends on uninitialised value(s) - at 0x........: wcpncpy (vg_replace_strmem.c:2426) + at 0x........: wcpncpy (vg_replace_strmem.c:2427) by 0x........: main (wcpncpy.c:14) Invalid write of size 4 - at 0x........: wcpncpy (vg_replace_strmem.c:2426) + at 0x........: wcpncpy (vg_replace_strmem.c:2427) by 0x........: main (wcpncpy.c:27) Address 0x........ is 20 bytes inside a block of size 22 alloc'd at 0x........: malloc (vg_replace_malloc.c:...) by 0x........: main (wcpncpy.c:10) Source and destination overlap in wcpncpy(0x........, 0x........) - at 0x........: wcpncpy (vg_replace_strmem.c:2426) + at 0x........: wcpncpy (vg_replace_strmem.c:2427) by 0x........: main (wcpncpy.c:35) Source and destination overlap in wcpncpy(0x........, 0x........) - at 0x........: wcpncpy (vg_replace_strmem.c:2426) + at 0x........: wcpncpy (vg_replace_strmem.c:2427) by 0x........: main (wcpncpy.c:43) diff --git a/memcheck/tests/wcscat.c b/memcheck/tests/wcscat.c new file mode 100644 index 0000000000..bf3ec70c6d --- /dev/null +++ b/memcheck/tests/wcscat.c @@ -0,0 +1,20 @@ +// See https://bugs.kde.org/show_bug.cgi?id=501893 +#include <wchar.h> +#include <stdio.h> +#include <locale.h> +#include <stdlib.h> + +int main(void) +{ + wchar_t* str = malloc(sizeof(L"/usr/lib/python310.zip:/usr/lib/python3.10:")); + wchar_t* add1 = wcsdup(L"/usr/lib/python310.zip:/usr/lib/python3.10"); + wchar_t* add2 = wcsdup(L":"); + str[0] = 0; + wcscat(str, add1); + wcscat(str, add2); + setlocale(LC_ALL, "en_US.utf8"); + printf("%ls\n", str); + free(str); + free(add1); + free(add2); +} diff --git a/memcheck/tests/wcscat.stderr.exp b/memcheck/tests/wcscat.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/memcheck/tests/wcscat.stdout.exp b/memcheck/tests/wcscat.stdout.exp new file mode 100644 index 0000000000..b5b8c09e53 --- /dev/null +++ b/memcheck/tests/wcscat.stdout.exp @@ -0,0 +1 @@ +/usr/lib/python310.zip:/usr/lib/python3.10: diff --git a/memcheck/tests/wcscat.vgtest b/memcheck/tests/wcscat.vgtest new file mode 100644 index 0000000000..30b25d0efc --- /dev/null +++ b/memcheck/tests/wcscat.vgtest @@ -0,0 +1,2 @@ +prog: wcscat +vgopts: -q diff --git a/shared/vg_replace_strmem.c b/shared/vg_replace_strmem.c index ae13a2a5f8..71f15c85fb 100644 --- a/shared/vg_replace_strmem.c +++ b/shared/vg_replace_strmem.c @@ -108,6 +108,7 @@ 20480 WCSNCPY 20490 MEMCCPY 20500 WCPNCPY + 20510 WCSCAT */ #if defined(VGO_solaris) @@ -2426,6 +2427,34 @@ static inline void my_exit ( int x ) WCPNCPY(VG_Z_LIBC_SONAME, wcpncpy) #endif +/*----------------------- wcscat ----------------------*/ + +#define WCSCAT(soname, fnname) \ + Int* VG_REPLACE_FUNCTION_EZU(20510,soname,fnname) \ + ( Int *restrict dest, const Int *restrict src ); \ + Int* VG_REPLACE_FUNCTION_EZU(20510,soname,fnname) \ + ( Int *restrict dest, const Int *restrict src ) \ + { \ + const Int* src_orig = src; \ + Int* dest_orig = dest; \ + while (*dest) dest++; \ + while (*src) *dest++ = *src++; \ + *dest = 0; \ + \ + /* This is a bit redundant, I think; any overlap and the wcscat will */ \ + /* go forever... or until a seg fault occurs. */ \ + if (is_overlap(dest_orig, \ + src_orig, \ + (Addr)dest-(Addr)dest_orig+1, \ + (Addr)src-(Addr)src_orig+1)) \ + RECORD_OVERLAP_ERROR("wcscat", dest_orig, src_orig, 0); \ + \ + return dest_orig; \ + } + +#if defined(VGO_linux) + WCSCAT(VG_Z_LIBC_SONAME, __wcscat_avx2) +#endif /*------------------------------------------------------------*/ /*--- Improve definedness checking of process environment ---*/ |
From: Florian K. <fl...@ei...> - 2025-03-22 19:17:05
|
When I run perl tests/vg_regtest memcheck/tests/linux/debuginfod-check.vgtest I see this error: sh: 1: debuginfod: not found debuginfod-check: (skipping, prereq failed: ./debuginfod-check.pl) which is caused by debuginfod not being installed on my machine. The patch below suppressed the error message. OK? diff --git a/memcheck/tests/linux/debuginfod-check.pl b/memcheck/tests/linux/debuginfod-check.pl index 4a2c1c1e1..797aad210 100755 --- a/memcheck/tests/linux/debuginfod-check.pl +++ b/memcheck/tests/linux/debuginfod-check.pl @@ -30,8 +30,8 @@ sub mysystem($) } # Check that debuginfod and debuginfod-find can be found -mysystem("debuginfod --help > /dev/null"); -mysystem("debuginfod-find --help > /dev/null"); +mysystem("debuginfod --help > /dev/null 2> /dev/null"); +mysystem("debuginfod-find --help > /dev/null 2> /dev/null"); $SIG{'INT'} = sub { cleanup_and_exit(1) }; |
From: Florian K. <fk...@so...> - 2025-03-22 18:57:18
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=165681b33af3a97338781f57da531c2d22885c02 commit 165681b33af3a97338781f57da531c2d22885c02 Author: Florian Krohm <fl...@ei...> Date: Sat Mar 22 18:56:09 2025 +0000 s390x: Fix BZ 498629 IR generation for S[L]HHHR and S[L]HHLR was broken. Now fixed as obvious. Fixes https://bugs.kde.org/show_bug.cgi?id=498629 Diff: --- NEWS | 1 + VEX/priv/guest_s390_toIR.c | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index 4ae8bde25e..d42a5f479a 100644 --- a/NEWS +++ b/NEWS @@ -55,6 +55,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. even though it's generated by --gen-suppressions=yes 498422 s390x: Fix VLRL and VSTRL insns 498492 none/tests/amd64/lzcnt64 crashes on FreeBSD compiled with clang +498629 s390x: Fix S[L]HHHR and S[L]HHLR insns 498632 s390x: Fix LNGFR insn 498942 s390x: Rework s390_disasm interface 499183 FreeBSD: differences in avx-vmovq output diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 3bebca53a0..835d81dd76 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -10664,14 +10664,14 @@ s390_irgen_SHY(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_SHHHR(UChar r3 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_SHHHR(UChar r3, UChar r1, UChar r2) { IRTemp op2 = newTemp(Ity_I32); IRTemp op3 = newTemp(Ity_I32); IRTemp result = newTemp(Ity_I32); - assign(op2, get_gpr_w0(r1)); - assign(op3, get_gpr_w0(r2)); + assign(op2, get_gpr_w0(r2)); + assign(op3, get_gpr_w0(r3)); assign(result, binop(Iop_Sub32, mkexpr(op2), mkexpr(op3))); s390_cc_thunk_putSS(S390_CC_OP_SIGNED_SUB_32, op2, op3); put_gpr_w0(r1, mkexpr(result)); @@ -10680,14 +10680,14 @@ s390_irgen_SHHHR(UChar r3 __attribute__((unused)), UChar r1, UChar r2) } static const HChar * -s390_irgen_SHHLR(UChar r3 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_SHHLR(UChar r3, UChar r1, UChar r2) { IRTemp op2 = newTemp(Ity_I32); IRTemp op3 = newTemp(Ity_I32); IRTemp result = newTemp(Ity_I32); - assign(op2, get_gpr_w0(r1)); - assign(op3, get_gpr_w1(r2)); + assign(op2, get_gpr_w0(r2)); + assign(op3, get_gpr_w1(r3)); assign(result, binop(Iop_Sub32, mkexpr(op2), mkexpr(op3))); s390_cc_thunk_putSS(S390_CC_OP_SIGNED_SUB_32, op2, op3); put_gpr_w0(r1, mkexpr(result)); @@ -10874,14 +10874,14 @@ s390_irgen_SLGFI(UChar r1, UInt i2) } static const HChar * -s390_irgen_SLHHHR(UChar r3 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_SLHHHR(UChar r3, UChar r1, UChar r2) { IRTemp op2 = newTemp(Ity_I32); IRTemp op3 = newTemp(Ity_I32); IRTemp result = newTemp(Ity_I32); - assign(op2, get_gpr_w0(r1)); - assign(op3, get_gpr_w0(r2)); + assign(op2, get_gpr_w0(r2)); + assign(op3, get_gpr_w0(r3)); assign(result, binop(Iop_Sub32, mkexpr(op2), mkexpr(op3))); s390_cc_thunk_putZZ(S390_CC_OP_UNSIGNED_SUB_32, op2, op3); put_gpr_w0(r1, mkexpr(result)); @@ -10890,14 +10890,14 @@ s390_irgen_SLHHHR(UChar r3 __attribute__((unused)), UChar r1, UChar r2) } static const HChar * -s390_irgen_SLHHLR(UChar r3 __attribute__((unused)), UChar r1, UChar r2) +s390_irgen_SLHHLR(UChar r3, UChar r1, UChar r2) { IRTemp op2 = newTemp(Ity_I32); IRTemp op3 = newTemp(Ity_I32); IRTemp result = newTemp(Ity_I32); - assign(op2, get_gpr_w0(r1)); - assign(op3, get_gpr_w1(r2)); + assign(op2, get_gpr_w0(r2)); + assign(op3, get_gpr_w1(r3)); assign(result, binop(Iop_Sub32, mkexpr(op2), mkexpr(op3))); s390_cc_thunk_putZZ(S390_CC_OP_UNSIGNED_SUB_32, op2, op3); put_gpr_w0(r1, mkexpr(result)); |
From: Florian K. <fk...@so...> - 2025-03-22 18:51:40
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=fc40fe4f6472fef88ef78515782deb24e585aea3 commit fc40fe4f6472fef88ef78515782deb24e585aea3 Author: Florian Krohm <fl...@ei...> Date: Sat Mar 22 18:51:04 2025 +0000 s390x: Fix BZ 498632 IR generation for LNGFR was broken. Now fixed. Fixes https://bugs.kde.org/show_bug.cgi?id=498632 Diff: --- NEWS | 1 + VEX/priv/guest_s390_toIR.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 741ea73191..4ae8bde25e 100644 --- a/NEWS +++ b/NEWS @@ -55,6 +55,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. even though it's generated by --gen-suppressions=yes 498422 s390x: Fix VLRL and VSTRL insns 498492 none/tests/amd64/lzcnt64 crashes on FreeBSD compiled with clang +498632 s390x: Fix LNGFR insn 498942 s390x: Rework s390_disasm interface 499183 FreeBSD: differences in avx-vmovq output 499212 mmap() with MAP_ALIGNED() returns unaligned pointer diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index db8cea1e8a..3bebca53a0 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -8477,12 +8477,12 @@ s390_irgen_LNGR(UChar r1, UChar r2) } static const HChar * -s390_irgen_LNGFR(UChar r1, UChar r2 __attribute__((unused))) +s390_irgen_LNGFR(UChar r1, UChar r2) { IRTemp op2 = newTemp(Ity_I64); IRTemp result = newTemp(Ity_I64); - assign(op2, unop(Iop_32Sto64, get_gpr_w1(r1))); + assign(op2, unop(Iop_32Sto64, get_gpr_w1(r2))); assign(result, mkite(binop(Iop_CmpLE64S, mkexpr(op2), mkU64(0)), mkexpr(op2), binop(Iop_Sub64, mkU64(0), mkexpr(op2)))); put_gpr_dw0(r1, mkexpr(result)); |
From: Paul F. <pa...@so...> - 2025-03-22 07:16:51
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=5334917c8e0e44e6a98657050a66bc28fa638165 commit 5334917c8e0e44e6a98657050a66bc28fa638165 Author: Paul Floyd <pj...@wa...> Date: Sat Mar 22 08:15:35 2025 +0100 Bug 501850 - FreeBSD syscall arguments 7 and 8 incorrect. Diff: --- NEWS | 5 +++-- coregrind/m_syscall.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 7c0bba5774..741ea73191 100644 --- a/NEWS +++ b/NEWS @@ -59,12 +59,13 @@ are not entered into bugzilla tend to get forgotten about or ignored. 499183 FreeBSD: differences in avx-vmovq output 499212 mmap() with MAP_ALIGNED() returns unaligned pointer 501119 memcheck/tests/pointer-trace fails when run on NFS filesystem -501194 Fix ML_(check_macho_and_get_rw_loads) so that it is correct for any number of segment commands +501194 Fix ML_(check_macho_and_get_rw_loads) so that it is correct for + any number of segment commands 501348 glibc built with -march=x86-64-v3 does not work due to ld.so memcmp 501479 Illumos DRD pthread_mutex_init wrapper errors 501365 syscall userfaultfd not wrapped 501846 Add x86 Linux shm wrappers - +501850 FreeBSD syscall arguments 7 and 8 incorrect. To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syscall.c b/coregrind/m_syscall.c index 8ff9c90bdc..54c7bd8952 100644 --- a/coregrind/m_syscall.c +++ b/coregrind/m_syscall.c @@ -783,9 +783,9 @@ asm( " movq %r8, %r10\n" /* a4 */ " movq %r9, %r8\n" /* a5 */ " movq 16(%rbp), %r9\n" /* a6 last arg from stack, account for %rbp */ -" movq 24(%rbp), %r11\n" /* a7 from stack */ +" movq 32(%rbp), %r11\n" /* a7 from stack */ " pushq %r11\n" -" movq 32(%rbp), %r11\n" /* a8 from stack */ +" movq 24(%rbp), %r11\n" /* a8 from stack */ " pushq %r11\n" " subq $8,%rsp\n" /* fake return addr */ " syscall\n" |
From: Florian K. <fk...@so...> - 2025-03-21 23:10:31
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=bbebdbb2b1094b08ccbd8d09fc65f6fa0b9fecc0 commit bbebdbb2b1094b08ccbd8d09fc65f6fa0b9fecc0 Author: Florian Krohm <fl...@ei...> Date: Fri Mar 21 23:08:49 2025 +0000 s390x: Fix disassembly for vector insns This was painful because there is a lot of irregularity in the extended mnemonics. There is also a double-maintenance issue because S390_DISASM is used both in guest_s390_to_IR.c and in the 'emit' functions in host_s390_defs.c. It might be worth exploring whether the objdump disassembler can be extracted from binutils and re-used here. That way the disassembly would be correct by construction. And the double maintenance would go away. Fix a few things alongside: - In s390_format_VRI_VIM: is is a signed 16-bit value. So it needs to be sign-extended. Fixes disassembly for VLEI[BHFG] - Fix function dvb_operand. v0 is not special. - In s390_format_VRX_VRRDM pass forgotten m3 to S390_DISASM. - In s390_irgen_VCNF: remove s390_insn_assert. VCNF does not have specification exceptions. - Opcope VFLL has no mask m5. So s390_format_VRRa_VVMMM is the wrong format function. Change it to s390_format_VRRa_VVMM. In s390_irgen_VFLL: the value of m5 is not used in s390_vector_fp_convert because rounding == False. So, essentially, m5 is a don't care. - Add VRR_v3 and use it when a vector register is meant (instead of VRR_r3) - Add VRR_v4 and use it when a vector register is meant (instead of VRR_m4) - Add VRS_r3 and use it when a GPR is meant (instead of VRS_v3) - Add VRR_r2 and use it when a GPR is meant (instead of VRR_v2) - Add field-access macros for the VRV opcode format. Use them. - Add field-access macros for the VRIb opcode format. Use them. - Add field-access macros for the VRIc opcode format. Use them. - Add field-access macros for the VRSc opcode format. Use them. Part of fixing https://bugs.kde.org/show_bug.cgi?id=495817 Diff: --- VEX/priv/guest_s390_toIR.c | 673 +++++++++++++++++++++++++++------------------ VEX/priv/host_s390_defs.c | 105 +++---- VEX/priv/s390_disasm.c | 645 ++++++++++++++++++++++++++++++++++++++++--- VEX/priv/s390_disasm.h | 24 ++ 4 files changed, 1105 insertions(+), 342 deletions(-) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 67633f1c91..db8cea1e8a 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -49,7 +49,15 @@ static UInt s390_decode_and_irgen(const UChar *, UInt, DisResult *); static void s390_irgen_xonc(IROp, IRTemp, IRTemp, IRTemp); static void s390_irgen_CLC_EX(IRTemp, IRTemp, IRTemp); -static const HChar *s390_irgen_BIC(UChar r1, IRTemp op2addr); +static const HChar *s390_irgen_BIC(UChar, IRTemp); +static const HChar *s390_irgen_VPDI(UChar, UChar, UChar, UChar); +static const HChar *s390_irgen_VFLR(UChar, UChar, UChar, UChar, UChar); +static const HChar *s390_irgen_VFI(UChar, UChar, UChar, UChar, UChar); +static const HChar *s390_irgen_VFPSO(UChar, UChar, UChar, UChar, UChar); +static const HChar *s390_irgen_VCGD(UChar, UChar, UChar, UChar, UChar); +static const HChar *s390_irgen_VCDG(UChar, UChar, UChar, UChar, UChar); +static const HChar *s390_irgen_VCDLG(UChar, UChar, UChar, UChar, UChar); +static const HChar *s390_irgen_VCLGD(UChar, UChar, UChar, UChar, UChar); /*------------------------------------------------------------*/ /*--- Globals ---*/ @@ -204,9 +212,12 @@ typedef enum { #define VRX_rxb(insn) (((insn) >> 24) & 0xf) #define VRR_v1(insn) (((insn) >> 52) & 0xf) #define VRR_v2(insn) (((insn) >> 48) & 0xf) +#define VRR_r2(insn) (((insn) >> 48) & 0xf) #define VRR_r3(insn) (((insn) >> 44) & 0xf) +#define VRR_v3(insn) (((insn) >> 44) & 0xf) #define VRR_m5(insn) (((insn) >> 36) & 0xf) #define VRR_m4(insn) (((insn) >> 28) & 0xf) +#define VRR_v4(insn) (((insn) >> 28) & 0xf) #define VRR_rxb(insn) (((insn) >> 24) & 0xf) #define VRRa_v1(insn) (((insn) >> 52) & 0xf) #define VRRa_v2(insn) (((insn) >> 48) & 0xf) @@ -234,6 +245,16 @@ typedef enum { #define VRI_i2(insn) (((insn) >> 32) & 0xffff) #define VRI_m3(insn) (((insn) >> 28) & 0xf) #define VRI_rxb(insn) (((insn) >> 24) & 0xf) +#define VRIb_v1(insn) (((insn) >> 52) & 0xf) +#define VRIb_i2(insn) (((insn) >> 40) & 0xff) +#define VRIb_i3(insn) (((insn) >> 32) & 0xff) +#define VRIb_m4(insn) (((insn) >> 28) & 0xf) +#define VRIb_rxb(insn) (((insn) >> 24) & 0xf) +#define VRIc_v1(insn) (((insn) >> 52) & 0xf) +#define VRIc_v3(insn) (((insn) >> 48) & 0xf) +#define VRIc_i2(insn) (((insn) >> 32) & 0xffff) +#define VRIc_m4(insn) (((insn) >> 28) & 0xf) +#define VRIc_rxb(insn) (((insn) >> 24) & 0xf) #define VRId_v1(insn) (((insn) >> 52) & 0xf) #define VRId_v2(insn) (((insn) >> 48) & 0xf) #define VRId_v3(insn) (((insn) >> 44) & 0xf) @@ -248,10 +269,17 @@ typedef enum { #define VRIe_rxb(insn) (((insn) >> 24) & 0xf) #define VRS_v1(insn) (((insn) >> 52) & 0xf) #define VRS_v3(insn) (((insn) >> 48) & 0xf) +#define VRS_r3(insn) (((insn) >> 48) & 0xf) #define VRS_b2(insn) (((insn) >> 44) & 0xf) #define VRS_d2(insn) (((insn) >> 32) & 0xfff) #define VRS_m4(insn) (((insn) >> 28) & 0xf) #define VRS_rxb(insn) (((insn) >> 24) & 0xf) +#define VRSc_r1(insn) (((insn) >> 52) & 0xf) +#define VRSc_v3(insn) (((insn) >> 48) & 0xf) +#define VRSc_b2(insn) (((insn) >> 44) & 0xf) +#define VRSc_d2(insn) (((insn) >> 32) & 0xfff) +#define VRSc_m4(insn) (((insn) >> 28) & 0xf) +#define VRSc_rxb(insn) (((insn) >> 24) & 0xf) #define VRSd_v1(insn) (((insn) >> 28) & 0xf) #define VRSd_r3(insn) (((insn) >> 48) & 0xf) #define VSI_i3(insn) (((insn) >> 48) & 0xff) @@ -259,6 +287,12 @@ typedef enum { #define VSI_d2(insn) (((insn) >> 32) & 0xfff) #define VSI_v1(insn) (((insn) >> 28) & 0xf) #define VSI_rxb(insn) (((insn) >> 24) & 0xf) +#define VRV_v1(insn) (((insn) >> 52) & 0xf) +#define VRV_x2(insn) (((insn) >> 48) & 0xf) +#define VRV_b2(insn) (((insn) >> 44) & 0xf) +#define VRV_d2(insn) (((insn) >> 32) & 0xfff) +#define VRV_m3(insn) (((insn) >> 28) & 0xf) +#define VRV_rxb(insn) (((insn) >> 24) & 0xf) /*------------------------------------------------------------*/ @@ -3674,7 +3708,7 @@ s390_format_SIL_RDU(const HChar *(*irgen)(UShort i2, IRTemp op1addr), static void s390_format_VRX_VRRD(const HChar *(*irgen)(UChar v1, IRTemp op2addr), - UChar v1, UChar x2, UChar b2, UShort d2, UChar rxb) + UChar v1, UChar x2, UChar b2, UShort d2, UChar m3, UChar rxb) { const HChar *mnm; IRTemp op2addr = newTemp(Ity_I64); @@ -3692,13 +3726,14 @@ s390_format_VRX_VRRD(const HChar *(*irgen)(UChar v1, IRTemp op2addr), mnm = irgen(v1, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), UDXB(d2, x2, b2)); + S390_DISASM(XMNM(mnm, mask0_disasm), VR(v1), UDXB(d2, x2, b2), MASK(m3)); } static void s390_format_VRX_VRRDM(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar m3), - UChar v1, UChar x2, UChar b2, UShort d2, UChar m3, UChar rxb) + UChar v1, UChar x2, UChar b2, UShort d2, UChar m3, UChar rxb, + HChar *(*handler)(const s390_opnd *, HChar *)) { const HChar *mnm; IRTemp op2addr = newTemp(Ity_I64); @@ -3715,8 +3750,12 @@ s390_format_VRX_VRRDM(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar m3), v1 = s390_vr_getVRindex(v1, 1, rxb); mnm = irgen(v1, op2addr, m3); - if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), UDXB(d2, x2, b2)); + if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) { + if (handler) + S390_DISASM(XMNM(mnm, handler), VR(v1), UDXB(d2, x2, b2), MASK(m3)); + else + S390_DISASM(MNM(mnm), VR(v1), UDXB(d2, x2, b2), UINT(m3)); + } } @@ -3761,8 +3800,6 @@ s390_format_VRR_VVV(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3), } -// FIXME: VPDI uses this format but does not have extended mnemonics -// FIXME: all other opcodes have extended mnms static void s390_format_VRR_VVVM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, UChar m4), UChar v1, UChar v2, UChar v3, UChar m4, UChar rxb) @@ -3779,14 +3816,19 @@ s390_format_VRR_VVVM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, UChar m v3 = s390_vr_getVRindex(v3, 3, rxb); mnm = irgen(v1, v2, v3, m4); - if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(m4)); + if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) { + if (irgen == s390_irgen_VPDI) + S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(m4)); + else + S390_DISASM(XMNM(mnm, va_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4)); + } } static void s390_format_VRR_VVVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5), - UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, UChar rxb) + UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, UChar rxb, + HChar *(*handler)(const s390_opnd *, HChar *)) { const HChar *mnm; @@ -3801,7 +3843,7 @@ s390_format_VRR_VVVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, UChar mnm = irgen(v1, v2, v3, m4, m5); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(m4), UINT(m5)); + S390_DISASM(XMNM(mnm, handler), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(m5)); } @@ -3862,7 +3904,66 @@ s390_format_VRR_VVM(const HChar *(*irgen)(UChar v1, UChar v2, UChar m3), mnm = irgen(v1, v2, m3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), VR(v2), UINT(m3)); + S390_DISASM(XMNM(mnm, va_like_disasm), VR(v1), VR(v2), MASK(m3)); +} + + +static void +s390_format_VRI_V0U(const HChar *(*irgen)(UChar v1, UShort i2), + UChar v1, UShort i2, UChar rxb, + HChar *(*handler)(const s390_opnd *, HChar *)) +{ + const HChar *mnm; + + if (! s390_host_has_vx) { + emulation_failure(EmFail_S390X_vx); + return; + } + + v1 = s390_vr_getVRindex(v1, 1, rxb); + mnm = irgen(v1, i2); + + if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) + S390_DISASM(XMNM(mnm, handler), VR(v1), UINT(i2)); +} + + +static void +s390_format_VRI_V0UUU(const HChar *(*irgen)(UChar v1, UChar i2, UChar i3, + UChar m4), + UChar v1, UChar i2, UChar i3, UChar m4, UChar rxb) +{ + const HChar *mnm; + + if (! s390_host_has_vx) { + emulation_failure(EmFail_S390X_vx); + return; + } + + v1 = s390_vr_getVRindex(v1, 1, rxb); + mnm = irgen(v1, i2, i3, m4); + + if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) + S390_DISASM(XMNM(mnm, va_like_disasm), VR(v1), UINT(i2), UINT(i3), MASK(m4)); +} + + +static void +s390_format_VRI_V0IU(const HChar *(*irgen)(UChar v1, UShort i2, UChar m3), + UChar v1, UShort i2, UChar m3, UChar rxb) +{ + const HChar *mnm; + + if (! s390_host_has_vx) { + emulation_failure(EmFail_S390X_vx); + return; + } + + v1 = s390_vr_getVRindex(v1, 1, rxb); + mnm = irgen(v1, i2, m3); + + if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) + S390_DISASM(XMNM(mnm, va_like_disasm), VR(v1), INT((Short)i2), MASK(m3)); } @@ -3881,7 +3982,7 @@ s390_format_VRI_VIM(const HChar *(*irgen)(UChar v1, UShort i2, UChar m3), mnm = irgen(v1, i2, m3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), UINT(i2), UINT(m3)); + S390_DISASM(MNM(mnm), VR(v1), INT((Short)i2), UINT(m3)); } @@ -3901,7 +4002,7 @@ s390_format_VRI_VVIM(const HChar *(*irgen)(UChar v1, UChar v3, UShort i2, UChar mnm = irgen(v1, v3, i2, m4); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), VR(v3), UINT(i2), UINT(m4)); + S390_DISASM(XMNM(mnm, va_like_disasm), VR(v1), VR(v3), UINT(i2), MASK(m4)); } static void @@ -3922,7 +4023,7 @@ s390_format_VRI_VVIMM(const HChar *(*irgen)(UChar v1, UChar v2, UShort i3, mnm = irgen(v1, v2, i3, m4, m5); if (vex_traceflags & VEX_TRACE_FE) - S390_DISASM(MNM(mnm), VR(v1), VR(v2), UINT(i3), UINT(m4), UINT(m5)); + S390_DISASM(XMNM(mnm, vfmix_like_disasm), VR(v1), VR(v2), UINT(i3), MASK(m4), MASK(m5)); } static void @@ -3945,7 +4046,7 @@ s390_format_VRS_RRDVM(const HChar *(*irgen)(UChar r1, IRTemp op2addr, UChar v3, mnm = irgen(r1, op2addr, v3, m4); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), GPR(r1), UDXB(d2, 0, b2), VR(v3), UINT(m4)); + S390_DISASM(XMNM(mnm, va_like_disasm), GPR(r1), VR(v3), UDXB(d2, 0, b2), MASK(m4)); } static void @@ -3992,13 +4093,13 @@ s390_format_VRS_VRDVM(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar v3, mnm = irgen(v1, op2addr, v3, m4); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), UDXB(d2, 0, b2), VR(v3), UINT(m4)); + S390_DISASM(XMNM(mnm, va_like_disasm), VR(v1), VR(v3), UDXB(d2, 0, b2), MASK(m4)); } static void s390_format_VRS_VRDV(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar v3), - UChar v1, UChar b2, UShort d2, UChar v3, UChar rxb) + UChar v1, UChar b2, UShort d2, UChar v3, UChar m4, UChar rxb) { const HChar *mnm; IRTemp op2addr = newTemp(Ity_I64); @@ -4016,7 +4117,7 @@ s390_format_VRS_VRDV(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar v3), mnm = irgen(v1, op2addr, v3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), UDXB(d2, 0, b2), VR(v3)); + S390_DISASM(XMNM(mnm, mask0_disasm), VR(v1), VR(v3), UDXB(d2, 0, b2), MASK(m4)); } @@ -4040,7 +4141,7 @@ s390_format_VRS_VRRDM(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar r3, mnm = irgen(v1, op2addr, r3, m4); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), GPR(r3), UDXB(d2, 0, b2), UINT(m4)); + S390_DISASM(XMNM(mnm, va_like_disasm), VR(v1), GPR(r3), UDXB(d2, 0, b2), MASK(m4)); } @@ -4103,9 +4204,10 @@ s390_format_VRV_VVRDMT(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar m3) static void s390_format_VRR_VVVVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, - UChar v4, UChar m5, UChar m6), - UChar v1, UChar v2, UChar v3, UChar v4, UChar m5, - UChar m6, UChar rxb) + UChar v4, UChar m5, UChar m6), + UChar v1, UChar v2, UChar v3, UChar v4, UChar m5, + UChar m6, UChar rxb, + HChar *(*handler)(const s390_opnd *, HChar *)) { const HChar *mnm; @@ -4121,7 +4223,7 @@ s390_format_VRR_VVVVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, mnm = irgen(v1, v2, v3, v4, m5, m6); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), VR(v4), UINT(m5), UINT(m6)); + S390_DISASM(XMNM(mnm, handler), VR(v1), VR(v2), VR(v3), VR(v4), MASK(m5), MASK(m6)); } @@ -4142,7 +4244,7 @@ s390_format_VRR_VVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar m3, mnm = irgen(v1, v2, m3, m5); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), VR(v2), UINT(m3), UINT(m5)); + S390_DISASM(XMNM(mnm, vch_like_disasm), VR(v1), VR(v2), MASK(m3), MASK(m5)); } @@ -4165,7 +4267,7 @@ s390_format_VRId_VVVIM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, mnm = irgen(v1, v2, v3, i4, m5); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(i4), UINT(m5)); + S390_DISASM(XMNM(mnm, va_like_disasm), VR(v1), VR(v2), VR(v3), UINT(i4), MASK(m5)); } @@ -4211,7 +4313,7 @@ s390_format_VRRd_VVVVM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, mnm = irgen(v1, v2, v3, v4, m5); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), VR(v4), UINT(m5)); + S390_DISASM(XMNM(mnm, va_like_disasm), VR(v1), VR(v2), VR(v3), VR(v4), MASK(m5)); } @@ -4232,15 +4334,31 @@ s390_format_VRRa_VVMMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar m3, v2 = s390_vr_getVRindex(v2, 2, rxb); mnm = irgen(v1, v2, m3, m4, m5); - if (vex_traceflags & VEX_TRACE_FE) - S390_DISASM(MNM(mnm), VR(v1), VR(v2), UINT(m3), UINT(m4), UINT(m5)); + if (vex_traceflags & VEX_TRACE_FE) { + if (irgen == s390_irgen_VFLR) + S390_DISASM(XMNM(mnm, vflr_disasm), VR(v1), VR(v2), MASK(m3), MASK(m4), UINT(m5)); + else if (irgen == s390_irgen_VFI) + S390_DISASM(XMNM(mnm, vfi_disasm), VR(v1), VR(v2), MASK(m3), MASK(m4), UINT(m5)); + else if (irgen == s390_irgen_VFPSO) + S390_DISASM(XMNM(mnm, vfpso_disasm), VR(v1), VR(v2), MASK(m3), MASK(m4), MASK(m5)); + else if (irgen == s390_irgen_VCGD) + S390_DISASM(XMNM(mnm, vcgd_disasm), VR(v1), VR(v2), MASK(m3), MASK(m4), MASK(m5)); + else if (irgen == s390_irgen_VCDG) + S390_DISASM(XMNM(mnm, vcdg_disasm), VR(v1), VR(v2), MASK(m3), MASK(m4), MASK(m5)); + else if (irgen == s390_irgen_VCLGD) + S390_DISASM(XMNM(mnm, vclgd_disasm), VR(v1), VR(v2), MASK(m3), MASK(m4), MASK(m5)); + else if (irgen == s390_irgen_VCDLG) + S390_DISASM(XMNM(mnm, vcgld_disasm), VR(v1), VR(v2), MASK(m3), MASK(m4), MASK(m5)); + else + S390_DISASM(MNM(mnm), VR(v1), VR(v2), UINT(m3), UINT(m4), UINT(m5)); + } } static void s390_format_VRRa_VVVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5), UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, - UChar rxb) + UChar rxb, HChar *(*handler)(const s390_opnd *, HChar *)) { const HChar *mnm; @@ -4254,14 +4372,19 @@ s390_format_VRRa_VVVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, v3 = s390_vr_getVRindex(v3, 3, rxb); mnm = irgen(v1, v2, v3, m4, m5); - if (vex_traceflags & VEX_TRACE_FE) - S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(m4), UINT(m5)); + if (vex_traceflags & VEX_TRACE_FE) { + if (handler) + S390_DISASM(XMNM(mnm, handler), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(m5)); + else + S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(m4), UINT(m5)); + } } static void s390_format_VRRa_VVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar m3, UChar m4), - UChar v1, UChar v2, UChar m3, UChar m4, UChar rxb) + UChar v1, UChar v2, UChar m3, UChar m4, UChar rxb, + HChar *(*handler)(const s390_opnd *, HChar *)) { const HChar *mnm; @@ -4274,8 +4397,12 @@ s390_format_VRRa_VVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar m3, v2 = s390_vr_getVRindex(v2, 2, rxb); mnm = irgen(v1, v2, m3, m4); - if (vex_traceflags & VEX_TRACE_FE) - S390_DISASM(MNM(mnm), VR(v1), VR(v2), UINT(m3), UINT(m4)); + if (vex_traceflags & VEX_TRACE_FE) { + if (handler) + S390_DISASM(XMNM(mnm, handler), VR(v1), VR(v2), MASK(m3), MASK(m4)); + else + S390_DISASM(MNM(mnm), VR(v1), VR(v2), UINT(m3), UINT(m4)); + } } static void @@ -4297,7 +4424,30 @@ s390_format_VRRa_VVVMMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, mnm = irgen(v1, v2, v3, m4, m5, m6); if (vex_traceflags & VEX_TRACE_FE) - S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(m4), UINT(m5), UINT(m6)); + S390_DISASM(XMNM(mnm, vfce_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(m5), MASK(m6)); +} + + +static void +s390_format_VRRa_VVVMMM2(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, + UChar m4, UChar m5, UChar m6), + UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, + UChar m6, UChar rxb) +{ + const HChar *mnm; + + if (!s390_host_has_vx) { + emulation_failure(EmFail_S390X_vx); + return; + } + + v1 = s390_vr_getVRindex(v1, 1, rxb); + v2 = s390_vr_getVRindex(v2, 2, rxb); + v3 = s390_vr_getVRindex(v3, 3, rxb); + mnm = irgen(v1, v2, v3, m4, m5, m6); + + if (vex_traceflags & VEX_TRACE_FE) + S390_DISASM(XMNM(mnm, vfmix_like_disasm), VR(v1), VR(v2), VR(v3), MASK(m4), MASK(m5), UINT(m6)); } static void @@ -16438,7 +16588,7 @@ s390_irgen_VLGV(UChar r1, IRTemp op2addr, UChar v3, UChar m4) } static const HChar * -s390_irgen_VGBM(UChar v1, UShort i2, UChar m3 __attribute__((unused))) +s390_irgen_VGBM(UChar v1, UShort i2) { put_vr_qw(v1, mkV128(i2)); @@ -16446,13 +16596,13 @@ s390_irgen_VGBM(UChar v1, UShort i2, UChar m3 __attribute__((unused))) } static const HChar * -s390_irgen_VGM(UChar v1, UShort i2, UChar m3) +s390_irgen_VGM(UChar v1, UChar i2, UChar i3, UChar m4) { - s390_insn_assert("vgm", m3 <= 3); + s390_insn_assert("vgm", m4 <= 3); - UChar max_idx = (8 << m3) - 1; - UChar from = max_idx & (i2 >> 8); - UChar to = max_idx & i2; + UChar max_idx = (8 << m4) - 1; + UChar from = max_idx & i2; + UChar to = max_idx & i3; ULong all_one = (1ULL << max_idx << 1) - 1; ULong value = (all_one >> from) ^ (all_one >> to >> 1); @@ -16464,7 +16614,7 @@ s390_irgen_VGM(UChar v1, UShort i2, UChar m3) value ^= all_one; IRExpr* fillValue; - switch (m3) { + switch (m4) { case 0: fillValue = mkU8(value); break; @@ -19043,17 +19193,17 @@ s390_irgen_VFI(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) } static const HChar * -s390_irgen_VFLL(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) +s390_irgen_VFLL(UChar v1, UChar v2, UChar m3, UChar m4) { s390_insn_assert("vfll", m3 == 2 || (s390_host_has_vxe && m3 == 3)); s390_insn_assert("vfll", (m4 & 0x7) == 0); if (m3 == 2) s390_vector_fp_convert(Iop_F32toF64, Ity_F32, Ity_F64, False, - v1, v2, m3, m4, m5); + v1, v2, m3, m4, /* don't care */ 0); else s390_vector_fp_convert(Iop_F64toF128, Ity_F64, Ity_F128, False, - v1, v2, m3, m4, m5); + v1, v2, m3, m4, /* don't care */ 0); return "vfll"; } @@ -19911,9 +20061,6 @@ s390_irgen_VCxx(const HChar *mnem, s390x_vec_op_details_t details, static const HChar * s390_irgen_VCNF(UChar v1, UChar v2, UChar m3, UChar m4) { - s390_insn_assert("vcnf", m3 == 0); - s390_insn_assert("vcnf", m4 < 2); - s390x_vec_op_details_t details = { .serialized = 0ULL }; details.op = S390_VEC_OP_VCNF; details.v1 = v1; @@ -21794,56 +21941,56 @@ s390_decode_6byte_and_irgen(const UChar *bytes) case 0xe60000000001ULL: s390_format_VRX_VRRDM(s390_irgen_VLEBRH, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe60000000002ULL: s390_format_VRX_VRRDM(s390_irgen_VLEBRG, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe60000000003ULL: s390_format_VRX_VRRDM(s390_irgen_VLEBRF, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe60000000004ULL: s390_format_VRX_VRRDM(s390_irgen_VLLEBRZ, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), vllebrz_disasm); goto ok; case 0xe60000000005ULL: s390_format_VRX_VRRDM(s390_irgen_VLBRREP, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), va_like_disasm); goto ok; case 0xe60000000006ULL: s390_format_VRX_VRRDM(s390_irgen_VLBR, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), va_like_disasm); goto ok; case 0xe60000000007ULL: s390_format_VRX_VRRDM(s390_irgen_VLER, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), va_like_disasm); goto ok; case 0xe60000000009ULL: s390_format_VRX_VRRDM(s390_irgen_VSTEBRH, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe6000000000aULL: s390_format_VRX_VRRDM(s390_irgen_VSTEBRG, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), vstebrg_disasm); goto ok; case 0xe6000000000bULL: s390_format_VRX_VRRDM(s390_irgen_VSTEBRF, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), vstebrf_disasm); goto ok; case 0xe6000000000eULL: s390_format_VRX_VRRDM(s390_irgen_VSTBR, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), va_like_disasm); goto ok; case 0xe6000000000fULL: s390_format_VRX_VRRDM(s390_irgen_VSTER, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), va_like_disasm); goto ok; case 0xe60000000034ULL: /* VPKZ */ goto unimplemented; case 0xe60000000035ULL: s390_format_VSI_URDV(s390_irgen_VLRL, VSI_v1(ovl), VSI_b2(ovl), VSI_d2(ovl), @@ -21872,19 +22019,19 @@ s390_decode_6byte_and_irgen(const UChar *bytes) case 0xe60000000055ULL: s390_format_VRRa_VVMM(s390_irgen_VCNF, VRRa_v1(ovl), VRRa_v2(ovl), VRRa_m3(ovl), VRRa_m4(ovl), - VRRa_rxb(ovl)); goto ok; + VRRa_rxb(ovl), NULL); goto ok; case 0xe60000000056ULL: s390_format_VRRa_VVMM(s390_irgen_VCLFNH, VRRa_v1(ovl), VRRa_v2(ovl), VRRa_m3(ovl), VRRa_m4(ovl), - VRRa_rxb(ovl)); goto ok; + VRRa_rxb(ovl), NULL); goto ok; case 0xe6000000005dULL: s390_format_VRRa_VVMM(s390_irgen_VCFN, VRRa_v1(ovl), VRRa_v2(ovl), VRRa_m3(ovl), VRRa_m4(ovl), - VRRa_rxb(ovl)); goto ok; + VRRa_rxb(ovl), NULL); goto ok; case 0xe6000000005eULL: s390_format_VRRa_VVMM(s390_irgen_VCLFNL, VRRa_v1(ovl), VRRa_v2(ovl), VRRa_m3(ovl), VRRa_m4(ovl), - VRRa_rxb(ovl)); goto ok; + VRRa_rxb(ovl), NULL); goto ok; case 0xe60000000058ULL: /* VCVD */ goto unimplemented; case 0xe60000000059ULL: /* VSRP */ goto unimplemented; case 0xe6000000005aULL: /* VCVDG */ goto unimplemented; @@ -21899,7 +22046,7 @@ s390_decode_6byte_and_irgen(const UChar *bytes) VRRa_v1(ovl), VRRa_v2(ovl), VRRa_v3(ovl), VRRa_m3(ovl), VRRa_m4(ovl), - VRRa_rxb(ovl)); goto ok; + VRRa_rxb(ovl), NULL); goto ok; case 0xe60000000077ULL: /* VCP */ goto unimplemented; case 0xe60000000078ULL: /* VMP */ goto unimplemented; case 0xe60000000079ULL: /* VMSP */ goto unimplemented; @@ -21913,72 +22060,74 @@ s390_decode_6byte_and_irgen(const UChar *bytes) case 0xe70000000000ULL: s390_format_VRX_VRRDM(s390_irgen_VLEB, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe70000000001ULL: s390_format_VRX_VRRDM(s390_irgen_VLEH, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe70000000002ULL: s390_format_VRX_VRRDM(s390_irgen_VLEG, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe70000000003ULL: s390_format_VRX_VRRDM(s390_irgen_VLEF, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe70000000004ULL: s390_format_VRX_VRRDM(s390_irgen_VLLEZ, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), vllez_disasm); goto ok; case 0xe70000000005ULL: s390_format_VRX_VRRDM(s390_irgen_VLREP, VRX_v1(ovl), + VRX_x2(ovl), VRX_b2(ovl), + VRX_d2(ovl), VRX_m3(ovl), + VRX_rxb(ovl), va_like_disasm); goto ok; + case 0xe70000000006ULL: s390_format_VRX_VRRD(s390_irgen_VL, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), VRX_rxb(ovl)); goto ok; - case 0xe70000000006ULL: s390_format_VRX_VRRD(s390_irgen_VL, VRX_v1(ovl), - VRX_x2(ovl), VRX_b2(ovl), - VRX_d2(ovl), VRX_rxb(ovl)); goto ok; case 0xe70000000007ULL: s390_format_VRX_VRRDM(s390_irgen_VLBB, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe70000000008ULL: s390_format_VRX_VRRDM(s390_irgen_VSTEB, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe70000000009ULL: s390_format_VRX_VRRDM(s390_irgen_VSTEH, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe7000000000aULL: s390_format_VRX_VRRDM(s390_irgen_VSTEG, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe7000000000bULL: s390_format_VRX_VRRDM(s390_irgen_VSTEF, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl)); goto ok; + VRX_rxb(ovl), NULL); goto ok; case 0xe7000000000eULL: s390_format_VRX_VRRD(s390_irgen_VST, VRX_v1(ovl), VRX_x2(ovl), VRX_b2(ovl), - VRX_d2(ovl), VRX_rxb(ovl)); goto ok; - case 0xe70000000012ULL: s390_format_VRV_VVRDMT(s390_irgen_VGEG, VRX_v1(ovl), - VRX_x2(ovl), VRX_b2(ovl), - VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl), Ity_I64); goto ok; - case 0xe70000000013ULL: s390_format_VRV_VVRDMT(s390_irgen_VGEF, VRX_v1(ovl), - VRX_x2(ovl), VRX_b2(ovl), - VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl), Ity_I32); goto ok; - case 0xe7000000001aULL: s390_format_VRV_VVRDMT(s390_irgen_VSCEG, VRX_v1(ovl), - VRX_x2(ovl), VRX_b2(ovl), - VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl), Ity_I64); goto ok; - case 0xe7000000001bULL: s390_format_VRV_VVRDMT(s390_irgen_VSCEF, VRX_v1(ovl), - VRX_x2(ovl), VRX_b2(ovl), - VRX_d2(ovl), VRX_m3(ovl), - VRX_rxb(ovl), Ity_I32); goto ok; - case 0xe70000000021ULL: s390_format_VRS_RRDVM(s390_irgen_VLGV, VRS_v1(ovl), - VRS_b2(ovl), VRS_d2(ovl), VRS_v3(ovl), - VRS_m4(ovl), VRS_rxb(ovl)); goto ok; + VRX_d2(ovl), VRX_m3(ovl), + VRX_rxb(ovl)); goto ok; + case 0xe70000000012ULL: s390_format_VRV_VVRDMT(s390_irgen_VGEG, VRV_v1(ovl), + VRV_x2(ovl), VRV_b2(ovl), + VRV_d2(ovl), VRV_m3(ovl), + VRV_rxb(ovl), Ity_I64); goto ok; + case 0xe70000000013ULL: s390_format_VRV_VVRDMT(s390_irgen_VGEF, VRV_v1(ovl), + VRV_x2(ovl), VRV_b2(ovl), + VRV_d2(ovl), VRV_m3(ovl), + VRV_rxb(ovl), Ity_I32); goto ok; + case 0xe7000000001aULL: s390_format_VRV_VVRDMT(s390_irgen_VSCEG, VRV_v1(ovl), + VRV_x2(ovl), VRV_b2(ovl), + VRV_d2(ovl), VRV_m3(ovl), + VRV_rxb(ovl), Ity_I64); goto ok; + case 0xe7000000001bULL: s390_format_VRV_VVRDMT(s390_irgen_VSCEF, VRV_v1(ovl), + VRV_x2(ovl), VRV_b2(ovl), + VRV_d2(ovl), VRV_m3(ovl), + VRV_rxb(ovl), Ity_I32); goto ok; + case 0xe70000000021ULL: s390_format_VRS_RRDVM(s390_irgen_VLGV, VRSc_r1(ovl), + VRSc_b2(ovl), VRSc_d2(ovl), VRSc_v3(ovl), + VRSc_m4(ovl), VRSc_rxb(ovl)); goto ok; case 0xe70000000022ULL: s390_format_VRS_VRRDM(s390_irgen_VLVG, VRS_v1(ovl), VRS_b2(ovl), VRS_d2(ovl), VRS_v3(ovl), VRS_m4(ovl), VRS_rxb(ovl)); goto ok; @@ -21995,9 +22144,9 @@ s390_decode_6byte_and_irgen(const UChar *bytes) VRS_rxb(ovl)); goto ok; case 0xe70000000036ULL: s390_format_VRS_VRDV(s390_irgen_VLM, VRS_v1(ovl), VRS_b2(ovl), VRS_d2(ovl), VRS_v3(ovl), - VRS_rxb(ovl)); goto ok; + VRS_m4(ovl), VRS_rxb(ovl)); goto ok; case 0xe70000000037ULL: s390_format_VRS_VRRD(s390_irgen_VLL, VRS_v1(ovl), - VRS_b2(ovl), VRS_d2(ovl), VRS_v3(ovl), + VRS_b2(ovl), VRS_d2(ovl), VRS_r3(ovl), VRS_rxb(ovl)); goto ok; case 0xe70000000038ULL: s390_format_VRS_VRDVM(s390_irgen_VESRL, VRS_v1(ovl), VRS_b2(ovl), VRS_d2(ovl), @@ -22009,9 +22158,9 @@ s390_decode_6byte_and_irgen(const UChar *bytes) VRS_rxb(ovl)); goto ok; case 0xe7000000003eULL: s390_format_VRS_VRDV(s390_irgen_VSTM, VRS_v1(ovl), VRS_b2(ovl), VRS_d2(ovl), VRS_v3(ovl), - VRS_rxb(ovl)); goto ok; + VRS_m4(ovl), VRS_rxb(ovl)); goto ok; case 0xe7000000003fULL: s390_format_VRS_VRRD(s390_irgen_VSTL, VRS_v1(ovl), - VRS_b2(ovl), VRS_d2(ovl), VRS_v3(ovl), + VRS_b2(ovl), VRS_d2(ovl), VRS_r3(ovl), VRS_rxb(ovl)); goto ok; case 0xe70000000040ULL: s390_format_VRI_VIM(s390_irgen_VLEIB, VRI_v1(ovl), VRI_i2(ovl), VRI_m3(ovl), @@ -22025,139 +22174,139 @@ s390_decode_6byte_and_irgen(const UChar *bytes) case 0xe70000000043ULL: s390_format_VRI_VIM(s390_irgen_VLEIF, VRI_v1(ovl), VRI_i2(ovl), VRI_m3(ovl), VRI_rxb(ovl)); goto ok;break; - case 0xe70000000044ULL: s390_format_VRI_VIM(s390_irgen_VGBM, VRI_v1(ovl), - VRI_i2(ovl), VRI_m3(ovl), - VRI_rxb(ovl)); goto ok; - case 0xe70000000045ULL: s390_format_VRI_VIM(s390_irgen_VREPI, VRI_v1(ovl), - VRI_i2(ovl), VRI_m3(ovl), - VRI_rxb(ovl)); goto ok; - case 0xe70000000046ULL: s390_format_VRI_VIM(s390_irgen_VGM, VRI_v1(ovl), - VRI_i2(ovl), VRI_m3(ovl), - VRI_rxb(ovl)); goto ok; + case 0xe70000000044ULL: s390_format_VRI_V0U(s390_irgen_VGBM, VRI_v1(ovl), + VRI_i2(ovl), VRI_rxb(ovl), + vgbm_disasm); goto ok; + case 0xe70000000045ULL: s390_format_VRI_V0IU(s390_irgen_VREPI, VRI_v1(ovl), + VRI_i2(ovl), VRI_m3(ovl), + VRI_rxb(ovl)); goto ok; + case 0xe70000000046ULL: s390_format_VRI_V0UUU(s390_irgen_VGM, VRIb_v1(ovl), + VRIb_i2(ovl), VRIb_i3(ovl), VRIb_m4(ovl), + VRIb_rxb(ovl)); goto ok; case 0xe7000000004aULL: s390_format_VRI_VVIMM(s390_irgen_VFTCI, VRIe_v1(ovl), VRIe_v2(ovl), VRIe_i3(ovl), VRIe_m4(ovl), VRIe_m5(ovl), VRIe_rxb(ovl)); goto ok; - case 0xe7000000004dULL: s390_format_VRI_VVIM(s390_irgen_VREP, VRI_v1(ovl), - VRI_v3(ovl), VRI_i2(ovl), - VRI_m3(ovl), VRI_rxb(ovl)); goto ok; - case 0xe70000000050ULL: s390_format_VRR_VVM(s390_irgen_VPOPCT, VRR_v1(ovl), - VRR_v2(ovl), VRR_m4(ovl), - VRR_rxb(ovl)); goto ok; - case 0xe70000000052ULL: s390_format_VRR_VVM(s390_irgen_VCTZ, VRR_v1(ovl), - VRR_v2(ovl), VRR_m4(ovl), - VRR_rxb(ovl)); goto ok; - case 0xe70000000053ULL: s390_format_VRR_VVM(s390_irgen_VCLZ, VRR_v1(ovl), - VRR_v2(ovl), VRR_m4(ovl), + case 0xe7000000004dULL: s390_format_VRI_VVIM(s390_irgen_VREP, VRIc_v1(ovl), + VRIc_v3(ovl), VRIc_i2(ovl), + VRIc_m4(ovl), VRIc_rxb(ovl)); goto ok; + case 0xe70000000050ULL: s390_format_VRR_VVM(s390_irgen_VPOPCT, VRRa_v1(ovl), + VRRa_v2(ovl), VRRa_m3(ovl), VRR_rxb(ovl)); goto ok; + case 0xe70000000052ULL: s390_format_VRR_VVM(s390_irgen_VCTZ, VRRa_v1(ovl), + VRRa_v2(ovl), VRRa_m3(ovl), + VRRa_rxb(ovl)); goto ok; + case 0xe70000000053ULL: s390_format_VRR_VVM(s390_irgen_VCLZ, VRRa_v1(ovl), + VRRa_v2(ovl), VRRa_m3(ovl), + VRRa_rxb(ovl)); goto ok; case 0xe70000000054ULL: /* VGEM */ goto unimplemented; case 0xe70000000056ULL: s390_format_VRR_VV(s390_irgen_VLR, VRR_v1(ovl), VRR_v2(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000005cULL: s390_format_VRR_VVMM(s390_irgen_VISTR, VRR_v1(ovl), VRR_v2(ovl), VRR_m4(ovl), VRR_m5(ovl), VRR_rxb(ovl)); goto ok; - case 0xe7000000005fULL: s390_format_VRR_VVM(s390_irgen_VSEG, VRR_v1(ovl), - VRR_v2(ovl), VRR_m4(ovl), - VRR_rxb(ovl)); goto ok; + case 0xe7000000005fULL: s390_format_VRR_VVM(s390_irgen_VSEG, VRRa_v1(ovl), + VRRa_v2(ovl), VRRa_m3(ovl), + VRRa_rxb(ovl)); goto ok; case 0xe70000000060ULL: s390_format_VRR_VVVM(s390_irgen_VMRL, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), - VRR_m4(ovl), VRR_rxb(ovl)); goto ok; + VRR_v2(ovl), VRR_v3(ovl), + VRR_m4(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000061ULL: s390_format_VRR_VVVM(s390_irgen_VMRH, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), - VRR_m4(ovl), VRR_rxb(ovl)); goto ok; + VRR_v2(ovl), VRR_v3(ovl), + VRR_m4(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000062ULL: s390_format_VRR_VRR(s390_irgen_VLVGP, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_r2(ovl), VRR_r3(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000064ULL: s390_format_VRR_VVVM(s390_irgen_VSUM, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_m4(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000065ULL: s390_format_VRR_VVVM(s390_irgen_VSUMG, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_m4(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000066ULL: s390_format_VRR_VVV(s390_irgen_VCKSM, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000067ULL: s390_format_VRR_VVVM(s390_irgen_VSUMQ, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_m4(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000068ULL: s390_format_VRR_VVV(s390_irgen_VN, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000069ULL: s390_format_VRR_VVV(s390_irgen_VNC, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000006aULL: s390_format_VRR_VVV(s390_irgen_VO, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000006bULL: s390_format_VRR_VVV(s390_irgen_VNO, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000006cULL: s390_format_VRR_VVV(s390_irgen_VNX, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000006dULL: s390_format_VRR_VVV(s390_irgen_VX, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000006eULL: s390_format_VRR_VVV(s390_irgen_VNN, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000006fULL: s390_format_VRR_VVV(s390_irgen_VOC, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000070ULL: s390_format_VRR_VVVM(s390_irgen_VESLV, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_m4(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000072ULL: s390_format_VRId_VVVIM(s390_irgen_VERIM, VRId_v1(ovl), VRId_v2(ovl), VRId_v3(ovl), VRId_i4(ovl), VRId_m5(ovl), VRId_rxb(ovl)); goto ok; case 0xe70000000073ULL: s390_format_VRR_VVVM(s390_irgen_VERLLV, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_m4(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000074ULL: s390_format_VRR_VVV(s390_irgen_VSL, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000075ULL: s390_format_VRR_VVV(s390_irgen_VSLB, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000077ULL: s390_format_VRId_VVVI(s390_irgen_VSLDB, VRId_v1(ovl), VRId_v2(ovl), VRId_v3(ovl), VRId_i4(ovl), VRId_rxb(ovl)); goto ok; case 0xe70000000078ULL: s390_format_VRR_VVVM(s390_irgen_VESRLV, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_m4(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000007aULL: s390_format_VRR_VVVM(s390_irgen_VESRAV, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_m4(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000007cULL: s390_format_VRR_VVV(s390_irgen_VSRL, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000007dULL: s390_format_VRR_VVV(s390_irgen_VSRLB, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000007eULL: s390_format_VRR_VVV(s390_irgen_VSRA, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000007fULL: s390_format_VRR_VVV(s390_irgen_VSRAB, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000080ULL: s390_format_VRR_VVVMM(s390_irgen_VFEE, VRR_v1(ovl), VRR_v2(ovl), VRR_r3(ovl), - VRR_m4(ovl), VRR_m5(ovl), - VRR_rxb(ovl)); goto ok; + VRR_m4(ovl), VRR_m5(ovl), VRR_rxb(ovl), + vfae_like_disasm); goto ok; case 0xe70000000081ULL: s390_format_VRR_VVVMM(s390_irgen_VFENE, VRR_v1(ovl), VRR_v2(ovl), VRR_r3(ovl), - VRR_m4(ovl), VRR_m5(ovl), - VRR_rxb(ovl)); goto ok; + VRR_m4(ovl), VRR_m5(ovl), VRR_rxb(ovl), + vfae_like_disasm); goto ok; case 0xe70000000082ULL: s390_format_VRR_VVVMM(s390_irgen_VFAE, VRR_v1(ovl), VRR_v2(ovl), VRR_r3(ovl), - VRR_m4(ovl), VRR_m5(ovl), - VRR_rxb(ovl)); goto ok; + VRR_m4(ovl), VRR_m5(ovl), VRR_rxb(ovl), + vfae_like_disasm); goto ok; case 0xe70000000084ULL: s390_format_VRR_VVVM(s390_irgen_VPDI, VRR_v1(ovl), VRR_v2(ovl), VRR_r3(ovl), VRR_m4(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000085ULL: s390_format_VRR_VVV(s390_irgen_VBPERM, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), + VRR_v2(ovl), VRR_v3(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000086ULL: s390_format_VRId_VVVI(s390_irgen_VSLD, VRId_v1(ovl), VRId_v2(ovl), VRId_v3(ovl), @@ -22172,68 +22321,70 @@ s390_decode_6byte_and_irgen(const UChar *bytes) case 0xe7000000008aULL: s390_format_VRR_VVVVMM(s390_irgen_VSTRC, VRRd_v1(ovl), VRRd_v2(ovl), VRRd_v3(ovl), VRRd_v4(ovl), VRRd_m5(ovl), - VRRd_m6(ovl), - VRRd_rxb(ovl)); goto ok; + VRRd_m6(ovl), VRRd_rxb(ovl), + vstrc_disasm); goto ok; case 0xe7000000008bULL: s390_format_VRR_VVVVMM(s390_irgen_VSTRS, VRRd_v1(ovl), VRRd_v2(ovl), VRRd_v3(ovl), VRRd_v4(ovl), VRRd_m5(ovl), - VRRd_m6(ovl), - VRRd_rxb(ovl)); goto ok; + VRRd_m6(ovl), VRRd_rxb(ovl), + vfae_like_disasm); goto ok; case 0xe7000000008cULL: s390_format_VRR_VVVV(s390_irgen_VPERM, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), - VRR_m4(ovl), VRR_rxb(ovl)); goto ok; + VRR_v2(ovl), VRR_v3(ovl), + VRR_v4(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000008dULL: s390_format_VRR_VVVV(s390_irgen_VSEL, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), - VRR_m4(ovl), VRR_rxb(ovl)); goto ok; + VRR_v2(ovl), VRR_v3(ovl), + VRR_v4(ovl), VRR_rxb(ovl)); goto ok; case 0xe7000000008eULL: s390_format_VRR_VVVVMM(s390_irgen_VFMS, VRRe_v1(ovl), VRRe_v2(ovl), VRRe_v3(ovl), VRRe_v4(ovl), VRRe_m5(ovl), - VRRe_m6(ovl), - VRRe_rxb(ovl)); goto ok; + VRRe_m6(ovl), VRRe_rxb(ovl), + vfms_like_disasm); goto ok; case 0xe7000000008fULL: s390_format_VRR_VVVVMM(s390_irgen_VFMA, VRRe_v1(ovl), VRRe_v2(ovl), VRRe_v3(ovl), VRRe_v4(ovl), VRRe_m5(ovl), - VRRe_m6(ovl), - VRRe_rxb(ovl)); goto ok; + VRRe_m6(ovl), VRRe_rxb(ovl), + vfms_like_disasm); goto ok; case 0xe70000000094ULL: s390_format_VRR_VVVM(s390_irgen_VPK, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), - VRR_m4(ovl), VRR_rxb(ovl)); goto ok; + VRR_v2(ovl), VRR_v3(ovl), + VRR_m4(ovl), VRR_rxb(ovl)); goto ok; case 0xe70000000095ULL: s390_format_VRR_VVVMM(s390_irgen_VPKLS, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), - VRR_m4(ovl), VRR_m5(ovl), VRR_rxb(ovl)); goto ok; + VRR_v2(ovl), VRR_v3(ovl), + VRR_m4(ovl), VRR_m5(ovl), VRR_rxb(ovl), + vch_like_disasm); goto ok; case 0xe70000000097ULL: s390_format_VRR_VVVMM(s390_irgen_VPKS, VRR_v1(ovl), - VRR_v2(ovl), VRR_r3(ovl), - VRR_m4(ovl), VRR_m5(ovl), VRR_rxb(ovl)); goto ok; + VRR_v2(ovl), VRR_v3(ovl), + VRR_m4(ovl), VRR_m5(ovl), VRR_rxb(ovl), + vch_like_disasm); got... [truncated message content] |
From: Paul F. <pa...@so...> - 2025-03-21 20:43:00
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=afea9317a1c958cdac72c9f55a27c9ecd1253eb8 commit afea9317a1c958cdac72c9f55a27c9ecd1253eb8 Author: Paul Floyd <pj...@wa...> Date: Fri Mar 21 21:41:55 2025 +0100 Bug 501846 - Add x86 Linux shm wrappers Diff: --- .gitignore | 1 + NEWS | 1 + coregrind/m_syswrap/syswrap-x86-linux.c | 5 +++ memcheck/tests/x86-linux/Makefile.am | 7 ++-- memcheck/tests/x86-linux/shm.c | 37 +++++++++++++++++++++ memcheck/tests/x86-linux/shm.stderr.exp | 58 +++++++++++++++++++++++++++++++++ memcheck/tests/x86-linux/shm.vgtest | 2 ++ 7 files changed, 109 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c394d27175..45290719a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1384,6 +1384,7 @@ /memcheck/tests/x86-linux/scalar_fork /memcheck/tests/x86-linux/scalar_supp /memcheck/tests/x86-linux/scalar_vfork +/memcheck/tests/x86-linux/shm # /memcheck/tests/x86-solaris/ /memcheck/tests/x86-solaris/*.stderr.diff diff --git a/NEWS b/NEWS index 7ea84cdc73..7c0bba5774 100644 --- a/NEWS +++ b/NEWS @@ -63,6 +63,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 501348 glibc built with -march=x86-64-v3 does not work due to ld.so memcmp 501479 Illumos DRD pthread_mutex_init wrapper errors 501365 syscall userfaultfd not wrapped +501846 Add x86 Linux shm wrappers To see details of a given bug, visit diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 13c9a33865..c4b00bd3f4 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1622,6 +1622,11 @@ static SyscallTableEntry syscall_table[] = { GENX_(__NR_rseq, sys_ni_syscall), // 386 + LINX_(__NR_shmget, sys_shmget), // 395 + LINX_(__NR_shmctl, sys_shmctl), // 396 + LINX_(__NR_shmat, sys_shmat), // 397 + LINX_(__NR_shmdt, sys_shmdt), // 398 + LINXY(__NR_clock_gettime64, sys_clock_gettime64), // 403 LINX_(__NR_clock_settime64, sys_clock_settime64), // 404 diff --git a/memcheck/tests/x86-linux/Makefile.am b/memcheck/tests/x86-linux/Makefile.am index 7e91aaf8b4..e8de590b3e 100644 --- a/memcheck/tests/x86-linux/Makefile.am +++ b/memcheck/tests/x86-linux/Makefile.am @@ -17,12 +17,14 @@ EXTRA_DIST = \ scalar_supp.stderr.exp \ scalar_supp.vgtest scalar_supp.supp \ scalar_vfork.stderr.exp scalar_vfork.vgtest \ - scalar_openat2.vgtest scalar_openat2.stderr.exp + scalar_openat2.vgtest scalar_openat2.stderr.exp \ + shm.vgtest shm.stderr.exp check_PROGRAMS = \ bug133694 \ int3-x86 \ - scalar scalar_exit_group scalar_fork scalar_supp scalar_vfork + scalar scalar_exit_group scalar_fork scalar_supp scalar_vfork \ + shm if HAVE_OPENAT2 check_PROGRAMS += scalar_openat2 @@ -38,3 +40,4 @@ if HAVE_OPENAT2 scalar_openat2_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ endif scalar_supp_CFLAGS = $(AM_CFLAGS) @FLAG_W_NO_UNINITIALIZED@ +shm_CFLAGS = ${AM_CFLAGS} @FLAG_W_NO_UNINITIALIZED@ diff --git a/memcheck/tests/x86-linux/shm.c b/memcheck/tests/x86-linux/shm.c new file mode 100644 index 0000000000..fcc9a7856e --- /dev/null +++ b/memcheck/tests/x86-linux/shm.c @@ -0,0 +1,37 @@ +#define _GNU_SOURCE +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> +#include <sys/ipc.h> +#include <sys/shm.h> +#include <sys/stat.h> +#include <sys/mman.h> +#include "../../memcheck.h" +#include "scalar.h" + +int main(void) +{ + // uninitialised, but we know px[0] is 0x0 + long* px = malloc(sizeof(long)); + long x0 = px[0]; + long res; + + GO(__NR_shmget, "3s 0m"); + SY(__NR_shmget, x0+IPC_PRIVATE, x0+1024, x0 | IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR); SUCC; + + long id = res; + + GO(__NR_shmat, "3s 0m"); + SY(__NR_shmat, x0+id, x0, x0); SUCC; + + void* mem = (void*)res; + struct shmid_ds buf; + VALGRIND_MAKE_MEM_NOACCESS(&buf, sizeof(buf)); + GO(__NR_shmctl, "3s 0m"); + SY(__NR_shmctl, x0+id, x0 | IPC_INFO, x0+&buf); SUCC; + + GO(__NR_shmdt, "1s 0m"); + SY(__NR_shmdt, x0+mem); SUCC; + + SY(__NR_shmctl, id, IPC_RMID, NULL); +} diff --git a/memcheck/tests/x86-linux/shm.stderr.exp b/memcheck/tests/x86-linux/shm.stderr.exp new file mode 100644 index 0000000000..58e8a24176 --- /dev/null +++ b/memcheck/tests/x86-linux/shm.stderr.exp @@ -0,0 +1,58 @@ +----------------------------------------------------- +395: __NR_shmget 3s 0m +----------------------------------------------------- +Syscall param shmget(key) contains uninitialised byte(s) + ... + by 0x........: main (shm.c:20) + +Syscall param shmget(size) contains uninitialised byte(s) + ... + by 0x........: main (shm.c:20) + +Syscall param shmget(shmflg) contains uninitialised byte(s) + ... + by 0x........: main (shm.c:20) + +----------------------------------------------------- +397: __NR_shmat 3s 0m +----------------------------------------------------- +Syscall param shmat(shmid) contains uninitialised byte(s) + ... + by 0x........: main (shm.c:25) + +Syscall param shmat(shmaddr) contains uninitialised byte(s) + ... + by 0x........: main (shm.c:25) + +Syscall param shmat(shmflg) contains uninitialised byte(s) + ... + by 0x........: main (shm.c:25) + +----------------------------------------------------- +396: __NR_shmctl 3s 0m +----------------------------------------------------- +Syscall param shmctl(shmid) contains uninitialised byte(s) + ... + by 0x........: main (shm.c:31) + +Syscall param shmctl(cmd) contains uninitialised byte(s) + ... + by 0x........: main (shm.c:31) + +Syscall param shmctl(buf) contains uninitialised byte(s) + ... + by 0x........: main (shm.c:31) + +Syscall param shmctl(IPC_INFO, buf) points to unaddressable byte(s) + ... + by 0x........: main (shm.c:31) + Address 0x........ is on thread 1's stack + in frame #1, created by main (shm.c:13) + +----------------------------------------------------- +398: __NR_shmdt 1s 0m +----------------------------------------------------- +Syscall param shmdt(shmaddr) contains uninitialised byte(s) + ... + by 0x........: main (shm.c:34) + diff --git a/memcheck/tests/x86-linux/shm.vgtest b/memcheck/tests/x86-linux/shm.vgtest new file mode 100644 index 0000000000..19ba6e1a00 --- /dev/null +++ b/memcheck/tests/x86-linux/shm.vgtest @@ -0,0 +1,2 @@ +prog: shm +vgopts: -q |
From: Mark W. <ma...@kl...> - 2025-03-21 13:25:29
|
Hi Florian, On Fri, 2025-03-21 at 14:14 +0100, Florian Weimer wrote: > * Mark Wielaard: > > On Fri, 2025-03-21 at 13:26 +0100, Florian Weimer wrote: > > > One more thing: If I understand things correctly, valgrind absolutely > > > needs to see the original system-calling function on the stack for the > > > suppressions to work. > > > > It is not absolutely necessary, but it would be a nice optimization. > > valgrind knows when it is handling a syscall so if it has to provide a > > backtrace during that processing it can easily skip the first (two) > > frames. > > So is this just cosmestic about error reporting? I thought you'd need > the function name matching for the suppressions to work? Both. (User) suppressions work on the backtrace at the point of issue reported. So in general they need the top of the stack symbol name be the same to work (you can have regexp in the suppression, but normally you wouldn't use them for top of stack). So what valgrind (core) would do is filter out the top (two) extra *syscall_cancel* frames so the top of stack would be the "normal" glibc function as if that called the syscall directly. > With a tail call here, there is no function name to match: > > #0 0x00007ffff789f784 in __internal_syscall_cancel (a1=<optimized out>, > a2=<optimized out>, a3=<optimized out>, a4=<optimized out>, > a5=<optimized out>, a6=<optimized out>, nr=<optimized out>) > at cancellation.c:64 > #1 0x00007ffff789f820 in __syscall_cancel (a1=<optimized out>, > a2=<optimized out>, a3=<optimized out>, a4=<optimized out>, > a5=<optimized out>, a6=<optimized out>, nr=<optimized out>) > at cancellation.c:75 > #2 0x00007ffff7d8175c in ?? () from /lib64/libtcl8.6.so > > With the patch I just posted, we have: > > #0 0x00007ffff789f784 in __internal_syscall_cancel (a1=<optimized out>, > a2=<optimized out>, a3=<optimized out>, a4=a4@entry=0, a5=a5@entry=0, > a6=a6@entry=0, nr=nr@entry=3) at cancellation.c:64 > #1 0x00007ffff789f820 in __syscall_cancel (a1=<optimized out>, > a2=<optimized out>, a3=<optimized out>, a4=a4@entry=0, a5=a5@entry=0, > a6=a6@entry=0, nr=nr@entry=3) at cancellation.c:75 > #2 0x00007ffff7932b50 in __GI___libc_read (fd=<optimized out>, > buf=<optimized out>, nbytes=<optimized out>) > at ../sysdeps/unix/sysv/linux/read.c:26 > #3 0x00007ffff7d8175c in ?? () from /lib64/libtcl8.6.so > > I hope that clarifies my concern. Aha, yes. In both cases my proposal would be to filter out the top two call frames and make #2 the top of stack (the new #0). So the second would indeed be preferred. Thanks, Mark |
From: Florian W. <fw...@re...> - 2025-03-21 13:14:52
|
* Mark Wielaard: > Hi, > > On Fri, 2025-03-21 at 13:26 +0100, Florian Weimer wrote: >> * Florian Weimer: >> >> > Does it matter for valgrind's purposes that those aren't dynamic >> > symbols? In Fedora, we try to accommodate valgrind and similar tools >> > and preserve the static symbol table, but not all distributions do this. > > Do you mean, should they appear in .symtab and should .symtab be > preserved (not stripped out)? Yes, that is how I imagine we lookup the > relevant function code ranges. We rely on finding symbtab symbols for a > couple of things in valgrind. If the symtab isn't available we would > simply not be able to strip out the top two frames (or name them). Right. The question is if we need to make this symbols dynamic (undera GLIBC_PRIVATE version). >> One more thing: If I understand things correctly, valgrind absolutely >> needs to see the original system-calling function on the stack for the >> suppressions to work. > > It is not absolutely necessary, but it would be a nice optimization. > valgrind knows when it is handling a syscall so if it has to provide a > backtrace during that processing it can easily skip the first (two) > frames. So is this just cosmestic about error reporting? I thought you'd need the function name matching for the suppressions to work? With a tail call here, there is no function name to match: #0 0x00007ffff789f784 in __internal_syscall_cancel (a1=<optimized out>, a2=<optimized out>, a3=<optimized out>, a4=<optimized out>, a5=<optimized out>, a6=<optimized out>, nr=<optimized out>) at cancellation.c:64 #1 0x00007ffff789f820 in __syscall_cancel (a1=<optimized out>, a2=<optimized out>, a3=<optimized out>, a4=<optimized out>, a5=<optimized out>, a6=<optimized out>, nr=<optimized out>) at cancellation.c:75 #2 0x00007ffff7d8175c in ?? () from /lib64/libtcl8.6.so With the patch I just posted, we have: #0 0x00007ffff789f784 in __internal_syscall_cancel (a1=<optimized out>, a2=<optimized out>, a3=<optimized out>, a4=a4@entry=0, a5=a5@entry=0, a6=a6@entry=0, nr=nr@entry=3) at cancellation.c:64 #1 0x00007ffff789f820 in __syscall_cancel (a1=<optimized out>, a2=<optimized out>, a3=<optimized out>, a4=a4@entry=0, a5=a5@entry=0, a6=a6@entry=0, nr=nr@entry=3) at cancellation.c:75 #2 0x00007ffff7932b50 in __GI___libc_read (fd=<optimized out>, buf=<optimized out>, nbytes=<optimized out>) at ../sysdeps/unix/sysv/linux/read.c:26 #3 0x00007ffff7d8175c in ?? () from /lib64/libtcl8.6.so I hope that clarifies my concern. Thanks, Florian |
From: Mark W. <ma...@kl...> - 2025-03-21 12:53:16
|
Hi, On Fri, 2025-03-21 at 13:26 +0100, Florian Weimer wrote: > * Florian Weimer: > > > Does it matter for valgrind's purposes that those aren't dynamic > > symbols? In Fedora, we try to accommodate valgrind and similar tools > > and preserve the static symbol table, but not all distributions do this. Do you mean, should they appear in .symtab and should .symtab be preserved (not stripped out)? Yes, that is how I imagine we lookup the relevant function code ranges. We rely on finding symbtab symbols for a couple of things in valgrind. If the symtab isn't available we would simply not be able to strip out the top two frames (or name them). > One more thing: If I understand things correctly, valgrind absolutely > needs to see the original system-calling function on the stack for the > suppressions to work. It is not absolutely necessary, but it would be a nice optimization. valgrind knows when it is handling a syscall so if it has to provide a backtrace during that processing it can easily skip the first (two) frames. But doing the check for whether the top frames are inside the __syscall_cancel symbol code ranges shouldn't be too expensive to do always. We would lookup the code ranges when loading glibc once and doing the address comparison should be cheap (we do something similar for the frames "below main"). Cheers, Mark |
From: Adhemerval Z. N. <adh...@li...> - 2025-03-21 12:50:53
|
On 21/03/25 08:54, Florian Weimer wrote: > * Adhemerval Zanella Netto: > >> On 20/03/25 19:10, Florian Weimer wrote: >>> * Mark Wielaard: >>> >>>>> I think __internal_syscall_cancel should get inlined into >>>>> __syscall_cancel. >>>> >>>> It isn't, I double checked with gdb and there are always two extra >>>> frames on top of the call stack. >>> >>> Oh, right, it's not static. >> >> And we need __always_inline to proper inline it. I will send a patch >> to change it. > > I think there are expected to be external callers from the rest of > glibc, so we can't inline it. We can add a common implementation and implement __syscall_cancel and __internal_syscall_cancel on top of it. |
From: Adhemerval Z. N. <adh...@li...> - 2025-03-21 12:40:55
|
On 21/03/25 09:26, Florian Weimer wrote: > * Florian Weimer: > >> Does it matter for valgrind's purposes that those aren't dynamic >> symbols? In Fedora, we try to accommodate valgrind and similar tools >> and preserve the static symbol table, but not all distributions do this. > > One more thing: If I understand things correctly, valgrind absolutely > needs to see the original system-calling function on the stack for the > suppressions to work. We get lucky on x86-64 due to the parameter > passing on the stack: > > 0000000000000000 <__GI___libc_write>: > 0: f3 0f 1e fa endbr64 > 4: 48 83 ec 10 sub $0x10,%rsp > 8: 48 63 ff movslq %edi,%rdi > b: 45 31 c9 xor %r9d,%r9d > e: 45 31 c0 xor %r8d,%r8d > 11: 6a 01 push $0x1 > 13: 31 c9 xor %ecx,%ecx > 15: e8 00 00 00 00 call 1a <__GI___libc_write+0x1a> > 16: R_X86_64_PLT32 __syscall_cancel-0x4 > 1a: 48 83 c4 18 add $0x18,%rsp > 1e: c3 ret > > But on POWER10, we have: > > 0000000000000000 <__GI___libc_write>: > 0: 04 00 20 39 li r9,4 > 4: 00 00 00 39 li r8,0 > 8: 00 00 e0 38 li r7,0 > c: 00 00 c0 38 li r6,0 > 10: 00 00 00 48 b 10 <__GI___libc_write+0x10> > 10: R_PPC64_REL24_NOTOC __syscall_cancel > > So I think the interceptors will remain broken there even with call > frame filtering. > > Should we inhibit the tail call on the glibc side? The tail-call is a nice optimization, is this really necessary to avoid it? Another possibility is to make inline internal_syscall_cancel on each cancellation entrypoint. It will increase the code size a bit, but it should be doable. |
From: Florian W. <fw...@re...> - 2025-03-21 12:26:34
|
* Florian Weimer: > Does it matter for valgrind's purposes that those aren't dynamic > symbols? In Fedora, we try to accommodate valgrind and similar tools > and preserve the static symbol table, but not all distributions do this. One more thing: If I understand things correctly, valgrind absolutely needs to see the original system-calling function on the stack for the suppressions to work. We get lucky on x86-64 due to the parameter passing on the stack: 0000000000000000 <__GI___libc_write>: 0: f3 0f 1e fa endbr64 4: 48 83 ec 10 sub $0x10,%rsp 8: 48 63 ff movslq %edi,%rdi b: 45 31 c9 xor %r9d,%r9d e: 45 31 c0 xor %r8d,%r8d 11: 6a 01 push $0x1 13: 31 c9 xor %ecx,%ecx 15: e8 00 00 00 00 call 1a <__GI___libc_write+0x1a> 16: R_X86_64_PLT32 __syscall_cancel-0x4 1a: 48 83 c4 18 add $0x18,%rsp 1e: c3 ret But on POWER10, we have: 0000000000000000 <__GI___libc_write>: 0: 04 00 20 39 li r9,4 4: 00 00 00 39 li r8,0 8: 00 00 e0 38 li r7,0 c: 00 00 c0 38 li r6,0 10: 00 00 00 48 b 10 <__GI___libc_write+0x10> 10: R_PPC64_REL24_NOTOC __syscall_cancel So I think the interceptors will remain broken there even with call frame filtering. Should we inhibit the tail call on the glibc side? Thanks, Florian |
From: Adhemerval Z. N. <adh...@li...> - 2025-03-21 12:15:25
|
On 20/03/25 19:10, Florian Weimer wrote: > * Mark Wielaard: > >>> I think __internal_syscall_cancel should get inlined into >>> __syscall_cancel. >> >> It isn't, I double checked with gdb and there are always two extra >> frames on top of the call stack. > > Oh, right, it's not static. And we need __always_inline to proper inline it. I will send a patch to change it. > >>> And this commit fixed it: >>> >>> commit 89b53077d2a58f00e7debdfe58afabe953dac60d >>> Author: Adhemerval Zanella <adh...@li...> >>> Date: Tue Jun 25 16:17:44 2024 -0300 >>> >>> nptl: Fix Race conditions in pthread cancellation [BZ#12683] >> >> Interesting, so this is actually in 2.41? I should try the fedora 42 >> beta then. Do you happen to know whether people/distros have >> backported this to earlier releases? > > We're probably going to backport it all the way to Fedora 40/RHEL 10, > but perhaps not before Fedora 40 goes out of support. > >> I think these extra __*syscall*cancel* frames are somewhat confusing >> to the user and messes up existing suppressions. They also cause >> trouble for the valgrind regtests. >> >> I think the solution for valgrind is to just skip the top (two) frames >> if they match the __*syscall*cancel* symbol address ranges. And we >> only need to do that when we are creating a backtrace from a valgrind >> syscall wrapper. >> >> Looking at the glibc symtab I see four function symbol matching that >> pattern: >> >> 2140: 0000000000079840 51 FUNC LOCAL DEFAULT 4 __syscall_cancel_arch >> 3561: 000000000006daf0 64 FUNC LOCAL DEFAULT 4 __syscall_cancel >> 3700: 000000000006da60 140 FUNC LOCAL DEFAULT 4 __internal_syscall_cancel >> 4566: 000000000006da00 87 FUNC LOCAL DEFAULT 4 __syscall_do_cancel >> >> Can we rely on those names (and assume there are only 4) or is it >> better to be flexible and just create a dynamic array for any glibc >> local function that matches the __*syscall*cancel* pattern? > > I don't think __syscall_do_cancel will need suppressions? It just > starts unwinding. > > The names should remain fairly stable. We should add comments to the > sources mentioning the valgrind dependency. Adhemerval, what do you > think? It should be reasonable, I will add then on the path as well. Although the names are an implementation details, it should be ok add this constraint. > > Does it matter for valgrind's purposes that those aren't dynamic > symbols? In Fedora, we try to accommodate valgrind and similar tools > and preserve the static symbol table, but not all distributions do this. > > Thanks, > Florian > |
From: Paul F. <pj...@wa...> - 2025-03-21 12:10:17
|
On 3/20/25 22:21, Mark Wielaard wrote: > Hi Florian, > > (Adding valgrind-developers to CC to see if someone else has some > smart ideas how to deal with this.) What callstack do you see with gdb? If gdb doesn't hide anything (and I doubt that it does) then I would just leave it alone. For regtest, adding a few filters to delete lines containing __*syscal_cancel should be enough. A+ Paul |
From: Florian W. <fw...@re...> - 2025-03-21 11:55:11
|
* Adhemerval Zanella Netto: > On 20/03/25 19:10, Florian Weimer wrote: >> * Mark Wielaard: >> >>>> I think __internal_syscall_cancel should get inlined into >>>> __syscall_cancel. >>> >>> It isn't, I double checked with gdb and there are always two extra >>> frames on top of the call stack. >> >> Oh, right, it's not static. > > And we need __always_inline to proper inline it. I will send a patch > to change it. I think there are expected to be external callers from the rest of glibc, so we can't inline it. Thanks, Florian |
From: Florian W. <fw...@re...> - 2025-03-20 22:11:26
|
* Mark Wielaard: >> I think __internal_syscall_cancel should get inlined into >> __syscall_cancel. > > It isn't, I double checked with gdb and there are always two extra > frames on top of the call stack. Oh, right, it's not static. >> And this commit fixed it: >> >> commit 89b53077d2a58f00e7debdfe58afabe953dac60d >> Author: Adhemerval Zanella <adh...@li...> >> Date: Tue Jun 25 16:17:44 2024 -0300 >> >> nptl: Fix Race conditions in pthread cancellation [BZ#12683] > > Interesting, so this is actually in 2.41? I should try the fedora 42 > beta then. Do you happen to know whether people/distros have > backported this to earlier releases? We're probably going to backport it all the way to Fedora 40/RHEL 10, but perhaps not before Fedora 40 goes out of support. > I think these extra __*syscall*cancel* frames are somewhat confusing > to the user and messes up existing suppressions. They also cause > trouble for the valgrind regtests. > > I think the solution for valgrind is to just skip the top (two) frames > if they match the __*syscall*cancel* symbol address ranges. And we > only need to do that when we are creating a backtrace from a valgrind > syscall wrapper. > > Looking at the glibc symtab I see four function symbol matching that > pattern: > > 2140: 0000000000079840 51 FUNC LOCAL DEFAULT 4 __syscall_cancel_arch > 3561: 000000000006daf0 64 FUNC LOCAL DEFAULT 4 __syscall_cancel > 3700: 000000000006da60 140 FUNC LOCAL DEFAULT 4 __internal_syscall_cancel > 4566: 000000000006da00 87 FUNC LOCAL DEFAULT 4 __syscall_do_cancel > > Can we rely on those names (and assume there are only 4) or is it > better to be flexible and just create a dynamic array for any glibc > local function that matches the __*syscall*cancel* pattern? I don't think __syscall_do_cancel will need suppressions? It just starts unwinding. The names should remain fairly stable. We should add comments to the sources mentioning the valgrind dependency. Adhemerval, what do you think? Does it matter for valgrind's purposes that those aren't dynamic symbols? In Fedora, we try to accommodate valgrind and similar tools and preserve the static symbol table, but not all distributions do this. Thanks, Florian |
From: Mark W. <ma...@kl...> - 2025-03-20 21:22:01
|
Hi Florian, (Adding valgrind-developers to CC to see if someone else has some smart ideas how to deal with this.) On Thu, Mar 20, 2025 at 05:58:31PM +0100, Florian Weimer wrote: > > With latest glibc on fedora rawhide (glibc-2.40.9000-37.fc43.x86_64) I > > am seeing some extra frames in the call stack that I wonder whether to > > specially handle in valgrind. > > > > Before we would report on some bad syscall argument like: > > > > ==1929378== Syscall param sendmsg(msg) points to uninitialised byte(s) > > ==1929378== at 0x4971514: sendmsg (sendmsg.c:28) > > ==1929378== by 0x40128B: main (sendmsg.c:46) > > ==1929378== Address 0x1ffefff640 is on thread 1's stack > > ==1929378== in frame #1, created by main (sendmsg.c:13) > > > > Now it looks like: > > > > ==2670784== Syscall param sendmsg(msg) points to uninitialised byte(s) > > ==2670784== at 0x48D9AE6: __internal_syscall_cancel (cancellation.c:64) > > ==2670784== by 0x48D9B03: __syscall_cancel (cancellation.c:75) > > ==2670784== by 0x49628F0: sendmsg (sendmsg.c:28) > > ==2670784== by 0x4005CB: main (sendmsg.c:46) > > ==2670784== Address 0x1ffeffff40 is on thread 1's stack > > ==2670784== in frame #3, created by main (sendmsg.c:13) > > > > Which I think is not as helpful to the user. > > So I am wondering whether those extra frames should be handled > > specially in valgrind and filtered out. But were these extra stack > > frames added explicitly? And are they easily detected (symbol name > > starting with __ and containing syscall might be a good hearistic)? > > I think __internal_syscall_cancel should get inlined into > __syscall_cancel. It isn't, I double checked with gdb and there are always two extra frames on top of the call stack. > There is also another out-of-line system call in __syscall_cancel_arch, > which you probably don't see in your example because the process is > single-threaded. I did indeed see that in our gdb_server testsuite, I had to filter that out of the gdb output to make our vgdb tests pass. > It is necessary to concentrate all cancelable system calls in one place > for correctness reasons because we need to know if the cancelling signal > arrives within the system call or immediately after it. It's the only > way to tell whether the effect of the system call has taken place or > not. With all system calls in one place, this is a simple address > check. With the previous inlining-based approach, we would have to have > some sort of lookup table to determine whether the cancellation attempt > happened while the system call was executing or not. > > This is relevant bug: > > Race conditions in pthread cancellation > <https://sourceware.org/bugzilla/show_bug.cgi?id=12683> > > And this commit fixed it: > > commit 89b53077d2a58f00e7debdfe58afabe953dac60d > Author: Adhemerval Zanella <adh...@li...> > Date: Tue Jun 25 16:17:44 2024 -0300 > > nptl: Fix Race conditions in pthread cancellation [BZ#12683] Interesting, so this is actually in 2.41? I should try the fedora 42 beta then. Do you happen to know whether people/distros have backported this to earlier releases? I think these extra __*syscall*cancel* frames are somewhat confusing to the user and messes up existing suppressions. They also cause trouble for the valgrind regtests. I think the solution for valgrind is to just skip the top (two) frames if they match the __*syscall*cancel* symbol address ranges. And we only need to do that when we are creating a backtrace from a valgrind syscall wrapper. Looking at the glibc symtab I see four function symbol matching that pattern: 2140: 0000000000079840 51 FUNC LOCAL DEFAULT 4 __syscall_cancel_arch 3561: 000000000006daf0 64 FUNC LOCAL DEFAULT 4 __syscall_cancel 3700: 000000000006da60 140 FUNC LOCAL DEFAULT 4 __internal_syscall_cancel 4566: 000000000006da00 87 FUNC LOCAL DEFAULT 4 __syscall_do_cancel Can we rely on those names (and assume there are only 4) or is it better to be flexible and just create a dynamic array for any glibc local function that matches the __*syscall*cancel* pattern? Thanks, Mark |
From: Mark W. <ma...@so...> - 2025-03-18 17:28:21
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=f697142e15c44c2d3e3910ae436a6597e8782aea commit f697142e15c44c2d3e3910ae436a6597e8782aea Author: Martin Cermak <mc...@re...> Date: Tue Mar 18 18:17:30 2025 +0100 Wrap linux specific userfaultfd syscall userfaultfd takes a flags argument and returns a file descriptor. It shows up in the Linux Test Project syscalls tests as unhandled. Declare a sys_userfaultfd wrapper in priv_syswrap-linux.h and hook it for {amd64,arm,arm64,mips64,nanomips,ppc32,ppc64,riscv64,s390x,x86}-linux using LINXY with PRE/POST handlers in syswrap-linux.c. Define __NR_userfaultfd in vki-scnums-s390x-linux.h. It was already defined for all other arches. https://bugs.kde.org/show_bug.cgi?id=501365 Diff: --- NEWS | 1 + coregrind/m_syswrap/priv_syswrap-linux.h | 3 +++ coregrind/m_syswrap/syswrap-amd64-linux.c | 1 + coregrind/m_syswrap/syswrap-arm-linux.c | 1 + coregrind/m_syswrap/syswrap-arm64-linux.c | 2 +- coregrind/m_syswrap/syswrap-linux.c | 20 ++++++++++++++++++++ coregrind/m_syswrap/syswrap-mips64-linux.c | 1 + coregrind/m_syswrap/syswrap-nanomips-linux.c | 2 +- coregrind/m_syswrap/syswrap-ppc32-linux.c | 1 + coregrind/m_syswrap/syswrap-ppc64-linux.c | 1 + coregrind/m_syswrap/syswrap-riscv64-linux.c | 1 + coregrind/m_syswrap/syswrap-s390x-linux.c | 1 + coregrind/m_syswrap/syswrap-x86-linux.c | 1 + include/vki/vki-scnums-s390x-linux.h | 1 + 14 files changed, 35 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 5ba2236a09..7ea84cdc73 100644 --- a/NEWS +++ b/NEWS @@ -62,6 +62,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 501194 Fix ML_(check_macho_and_get_rw_loads) so that it is correct for any number of segment commands 501348 glibc built with -march=x86-64-v3 does not work due to ld.so memcmp 501479 Illumos DRD pthread_mutex_init wrapper errors +501365 syscall userfaultfd not wrapped To see details of a given bug, visit diff --git a/coregrind/m_syswrap/priv_syswrap-linux.h b/coregrind/m_syswrap/priv_syswrap-linux.h index 6e6356608f..21bd966dcb 100644 --- a/coregrind/m_syswrap/priv_syswrap-linux.h +++ b/coregrind/m_syswrap/priv_syswrap-linux.h @@ -309,6 +309,9 @@ DECL_TEMPLATE(linux, sys_execveat); // Linux-specific (new in Linux 4.11) DECL_TEMPLATE(linux, sys_statx); +// Linux-specific (new in Linux 4.3) +DECL_TEMPLATE(linux, sys_userfaultfd); + // Linux-specific memory protection key syscalls (since Linux 4.9) DECL_TEMPLATE(linux, sys_pkey_alloc); DECL_TEMPLATE(linux, sys_pkey_free); diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index bdba41826a..4189241109 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -856,6 +856,7 @@ static SyscallTableEntry syscall_table[] = { // LIN__(__NR_kexec_file_load, sys_ni_syscall), // 320 LINXY(__NR_bpf, sys_bpf), // 321 LINX_(__NR_execveat, sys_execveat), // 322 + LINXY(__NR_userfaultfd, sys_userfaultfd), // 323 GENX_(__NR_mlock2, sys_mlock2), // 325 diff --git a/coregrind/m_syswrap/syswrap-arm-linux.c b/coregrind/m_syswrap/syswrap-arm-linux.c index bbe3e81e7c..a12053dd07 100644 --- a/coregrind/m_syswrap/syswrap-arm-linux.c +++ b/coregrind/m_syswrap/syswrap-arm-linux.c @@ -1019,6 +1019,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_(__NR_execveat, sys_execveat), // 387 + LINXY(__NR_userfaultfd, sys_userfaultfd), // 388 LINX_(__NR_membarrier, sys_membarrier), // 389 GENX_(__NR_mlock2, sys_mlock2), // 390 LINX_(__NR_copy_file_range, sys_copy_file_range), // 391 diff --git a/coregrind/m_syswrap/syswrap-arm64-linux.c b/coregrind/m_syswrap/syswrap-arm64-linux.c index 23b0b6b51c..28d36764b5 100644 --- a/coregrind/m_syswrap/syswrap-arm64-linux.c +++ b/coregrind/m_syswrap/syswrap-arm64-linux.c @@ -814,7 +814,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_memfd_create, sys_memfd_create), // 279 LINXY(__NR_bpf, sys_bpf), // 280 LINX_(__NR_execveat, sys_execveat), // 281 - // (__NR_userfaultfd, sys_ni_syscall), // 282 + LINXY(__NR_userfaultfd, sys_userfaultfd), // 282 LINX_(__NR_membarrier, sys_membarrier), // 283 GENX_(__NR_mlock2, sys_mlock2), // 284 LINX_(__NR_copy_file_range, sys_copy_file_range), // 285 diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index d2259bdd8c..8c166844cc 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -14019,6 +14019,26 @@ POST(sys_fspick) } } +/* int syscall(SYS_userfaultfd, int flags); */ + +PRE(sys_userfaultfd) +{ + PRINT("sys_userfaultfd ( %ld )", SARG1); + PRE_REG_READ1(long, "userfaultfd", int, size); +} + +POST(sys_userfaultfd) +{ + vg_assert(SUCCESS); + if (!ML_(fd_allowed)(RES, "userfaultfd", tid, True)) { + VG_(close)(RES); + SET_STATUS_Failure( VKI_EMFILE ); + } else { + if (VG_(clo_track_fds)) + ML_(record_fd_open_nameless)(tid, RES); + } +} + #undef PRE #undef POST diff --git a/coregrind/m_syswrap/syswrap-mips64-linux.c b/coregrind/m_syswrap/syswrap-mips64-linux.c index d603924c55..5736291c21 100644 --- a/coregrind/m_syswrap/syswrap-mips64-linux.c +++ b/coregrind/m_syswrap/syswrap-mips64-linux.c @@ -835,6 +835,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_ (__NR_landlock_add_rule, sys_landlock_add_rule), LINX_ (__NR_landlock_restrict_self, sys_landlock_restrict_self), LINX_ (__NR_fchmodat2, sys_fchmodat2), + LINXY (__NR_userfaultfd, sys_userfaultfd), }; SyscallTableEntry * ML_(get_linux_syscall_entry) ( UInt sysno ) diff --git a/coregrind/m_syswrap/syswrap-nanomips-linux.c b/coregrind/m_syswrap/syswrap-nanomips-linux.c index 853495e981..728607317c 100644 --- a/coregrind/m_syswrap/syswrap-nanomips-linux.c +++ b/coregrind/m_syswrap/syswrap-nanomips-linux.c @@ -812,7 +812,7 @@ static SyscallTableEntry syscall_main_table[] = { LINX_ (__NR_setns, sys_setns), // (__NR_bpf, sys_ni_syscall), LINX_ (__NR_execveat, sys_execveat), - // (__NR_userfaultfd, sys_ni_syscall), + LINXY (__NR_userfaultfd, sys_userfaultfd), LINX_ (__NR_membarrier, sys_membarrier), GENX_ (__NR_mlock2, sys_mlock2), // (__NR_copy_file_range, sys_ni_syscall), diff --git a/coregrind/m_syswrap/syswrap-ppc32-linux.c b/coregrind/m_syswrap/syswrap-ppc32-linux.c index 24d8eb2131..089a9a59b0 100644 --- a/coregrind/m_syswrap/syswrap-ppc32-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc32-linux.c @@ -1025,6 +1025,7 @@ static SyscallTableEntry syscall_table[] = { LINX_ (__NR_execveat, sys_execveat), // 362 + LINXY(__NR_userfaultfd, sys_userfaultfd), // 364 GENX_(__NR_mlock2, sys_mlock2), // 378 LINX_(__NR_copy_file_range, sys_copy_file_range), // 379 LINX_(__NR_preadv2, sys_preadv2), // 380 diff --git a/coregrind/m_syswrap/syswrap-ppc64-linux.c b/coregrind/m_syswrap/syswrap-ppc64-linux.c index 2a3ed8b924..7a79c6dee3 100644 --- a/coregrind/m_syswrap/syswrap-ppc64-linux.c +++ b/coregrind/m_syswrap/syswrap-ppc64-linux.c @@ -1011,6 +1011,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_execveat, sys_execveat), // 362 + LINXY(__NR_userfaultfd, sys_userfaultfd), // 364 LINX_(__NR_membarrier, sys_membarrier), // 365 GENX_(__NR_mlock2, sys_mlock2), // 378 diff --git a/coregrind/m_syswrap/syswrap-riscv64-linux.c b/coregrind/m_syswrap/syswrap-riscv64-linux.c index 14310b2b2e..f5e2f30dea 100644 --- a/coregrind/m_syswrap/syswrap-riscv64-linux.c +++ b/coregrind/m_syswrap/syswrap-riscv64-linux.c @@ -567,6 +567,7 @@ static SyscallTableEntry syscall_main_table[] = { LINXY(__NR_memfd_create, sys_memfd_create), /* 279 */ LINXY(__NR_bpf, sys_bpf), /* 280 */ LINX_(__NR_execveat, sys_execveat), /* 281 */ + LINXY(__NR_userfaultfd, sys_userfaultfd), /* 282 */ LINX_(__NR_membarrier, sys_membarrier), /* 283 */ GENX_(__NR_mlock2, sys_mlock2), /* 284 */ LINX_(__NR_copy_file_range, sys_copy_file_range), /* 285 */ diff --git a/coregrind/m_syswrap/syswrap-s390x-linux.c b/coregrind/m_syswrap/syswrap-s390x-linux.c index 893306bbda..a3d74aef9b 100644 --- a/coregrind/m_syswrap/syswrap-s390x-linux.c +++ b/coregrind/m_syswrap/syswrap-s390x-linux.c @@ -835,6 +835,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_execveat, sys_execveat), // 354 + LINXY(__NR_userfaultfd, sys_userfaultfd), // 355 LINX_(__NR_membarrier, sys_membarrier), // 356 LINXY(__NR_recvmmsg, sys_recvmmsg), // 357 LINXY(__NR_sendmmsg, sys_sendmmsg), // 358 diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index 50384817db..13c9a33865 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -1606,6 +1606,7 @@ static SyscallTableEntry syscall_table[] = { LINX_(__NR_shutdown, sys_shutdown), // 373 LINX_(__NR_membarrier, sys_membarrier), // 375 + LINXY(__NR_userfaultfd, sys_userfaultfd), // 374 GENX_(__NR_mlock2, sys_mlock2), // 376 LINX_(__NR_copy_file_range, sys_copy_file_range), // 377 LINXY(__NR_preadv2, sys_preadv2), // 378 diff --git a/include/vki/vki-scnums-s390x-linux.h b/include/vki/vki-scnums-s390x-linux.h index 869c045847..efb36b9917 100644 --- a/include/vki/vki-scnums-s390x-linux.h +++ b/include/vki/vki-scnums-s390x-linux.h @@ -317,6 +317,7 @@ #define __NR_execveat 354 +#define __NR_userfaultfd 355 #define __NR_membarrier 356 #define __NR_recvmmsg 357 #define __NR_sendmmsg 358 |
From: Paul F. <pa...@so...> - 2025-03-16 17:47:55
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=39e2b99adc7a8cba40aa353a53df8b53ae9eabae commit 39e2b99adc7a8cba40aa353a53df8b53ae9eabae Author: Paul Floyd <pj...@wa...> Date: Sun Mar 16 18:46:27 2025 +0100 Illumos regtest: add an expected for memcheck/tests/vcpu_fnfns Minor numerical diffs, 'inf' vs 'infinity' (why isn't that standardised?). Diff: --- memcheck/tests/Makefile.am | 1 + memcheck/tests/vcpu_fnfns.stdout.exp-illumos | 786 +++++++++++++++++++++++++++ 2 files changed, 787 insertions(+) diff --git a/memcheck/tests/Makefile.am b/memcheck/tests/Makefile.am index a4ca2853fb..8a5e0e1f72 100644 --- a/memcheck/tests/Makefile.am +++ b/memcheck/tests/Makefile.am @@ -446,6 +446,7 @@ EXTRA_DIST = \ vcpu_fbench.stdout.exp vcpu_fbench.stderr.exp vcpu_fbench.vgtest \ vcpu_fnfns.stdout.exp vcpu_fnfns.stdout.exp-glibc28-amd64 \ vcpu_fnfns.stdout.exp-darwin vcpu_fnfns.stdout.exp-solaris \ + vcpu_fnfns.stdout.exp-illumos \ vcpu_fnfns.stderr.exp vcpu_fnfns.vgtest \ wcpncpy.stderr.exp wcpncpy.vgtest \ wcs.vgtest wcs.stderr.exp wcs.stdout.exp \ diff --git a/memcheck/tests/vcpu_fnfns.stdout.exp-illumos b/memcheck/tests/vcpu_fnfns.stdout.exp-illumos new file mode 100644 index 0000000000..06fad51ccb --- /dev/null +++ b/memcheck/tests/vcpu_fnfns.stdout.exp-illumos @@ -0,0 +1,786 @@ +floorD(-2.0000000000000e+00) = -2.0000000000000e+00 +floorD(-1.9000000001000e+00) = -2.0000000000000e+00 +floorD(-1.8000000002000e+00) = -2.0000000000000e+00 +floorD(-1.7000000003000e+00) = -2.0000000000000e+00 +floorD(-1.6000000004000e+00) = -2.0000000000000e+00 +floorD(-1.5000000005000e+00) = -2.0000000000000e+00 +floorD(-1.4000000006000e+00) = -2.0000000000000e+00 +floorD(-1.3000000007000e+00) = -2.0000000000000e+00 +floorD(-1.2000000008000e+00) = -2.0000000000000e+00 +floorD(-1.1000000009000e+00) = -2.0000000000000e+00 +floorD(-1.0000000010000e+00) = -2.0000000000000e+00 +floorD(-9.0000000110000e-01) = -1.0000000000000e+00 +floorD(-8.0000000120000e-01) = -1.0000000000000e+00 +floorD(-7.0000000130000e-01) = -1.0000000000000e+00 +floorD(-6.0000000140000e-01) = -1.0000000000000e+00 +floorD(-5.0000000150000e-01) = -1.0000000000000e+00 +floorD(-4.0000000160000e-01) = -1.0000000000000e+00 +floorD(-3.0000000170000e-01) = -1.0000000000000e+00 +floorD(-2.0000000180000e-01) = -1.0000000000000e+00 +floorD(-1.0000000190000e-01) = -1.0000000000000e+00 +floorD(-1.9999992495467e-09) = -1.0000000000000e+00 +floorD(+9.9999997900001e-02) = +0.0000000000000e+00 +floorD(+1.9999999780000e-01) = +0.0000000000000e+00 +floorD(+2.9999999770000e-01) = +0.0000000000000e+00 +floorD(+3.9999999760000e-01) = +0.0000000000000e+00 +floorD(+4.9999999750000e-01) = +0.0000000000000e+00 +floorD(+5.9999999740000e-01) = +0.0000000000000e+00 +floorD(+6.9999999730000e-01) = +0.0000000000000e+00 +floorD(+7.9999999720000e-01) = +0.0000000000000e+00 +floorD(+8.9999999710000e-01) = +0.0000000000000e+00 +floorD(+9.9999999700000e-01) = +0.0000000000000e+00 +floorD(+1.0999999969000e+00) = +1.0000000000000e+00 +floorD(+1.1999999968000e+00) = +1.0000000000000e+00 +floorD(+1.2999999967000e+00) = +1.0000000000000e+00 +floorD(+1.3999999966000e+00) = +1.0000000000000e+00 +floorD(+1.4999999965000e+00) = +1.0000000000000e+00 +floorD(+1.5999999964000e+00) = +1.0000000000000e+00 +floorD(+1.6999999963000e+00) = +1.0000000000000e+00 +floorD(+1.7999999962000e+00) = +1.0000000000000e+00 +floorD(+1.8999999961000e+00) = +1.0000000000000e+00 +floorD(+1.9999999960000e+00) = +1.0000000000000e+00 +floorF( -2.0000e+00) = -2.0000e+00 +floorF( -1.9001e+00) = -2.0000e+00 +floorF( -1.8002e+00) = -2.0000e+00 +floorF( -1.7003e+00) = -2.0000e+00 +floorF( -1.6004e+00) = -2.0000e+00 +floorF( -1.5005e+00) = -2.0000e+00 +floorF( -1.4006e+00) = -2.0000e+00 +floorF( -1.3007e+00) = -2.0000e+00 +floorF( -1.2008e+00) = -2.0000e+00 +floorF( -1.1009e+00) = -2.0000e+00 +floorF( -1.0010e+00) = -2.0000e+00 +floorF( -9.0110e-01) = -1.0000e+00 +floorF( -8.0120e-01) = -1.0000e+00 +floorF( -7.0130e-01) = -1.0000e+00 +floorF( -6.0140e-01) = -1.0000e+00 +floorF( -5.0150e-01) = -1.0000e+00 +floorF( -4.0160e-01) = -1.0000e+00 +floorF( -3.0170e-01) = -1.0000e+00 +floorF( -2.0180e-01) = -1.0000e+00 +floorF( -1.0190e-01) = -1.0000e+00 +floorF( -1.9999e-03) = -1.0000e+00 +floorF( +9.7900e-02) = +0.0000e+00 +floorF( +1.9780e-01) = +0.0000e+00 +floorF( +2.9770e-01) = +0.0000e+00 +floorF( +3.9760e-01) = +0.0000e+00 +floorF( +4.9750e-01) = +0.0000e+00 +floorF( +5.9740e-01) = +0.0000e+00 +floorF( +6.9730e-01) = +0.0000e+00 +floorF( +7.9720e-01) = +0.0000e+00 +floorF( +8.9710e-01) = +0.0000e+00 +floorF( +9.9700e-01) = +0.0000e+00 +floorF( +1.0969e+00) = +1.0000e+00 +floorF( +1.1968e+00) = +1.0000e+00 +floorF( +1.2967e+00) = +1.0000e+00 +floorF( +1.3966e+00) = +1.0000e+00 +floorF( +1.4965e+00) = +1.0000e+00 +floorF( +1.5964e+00) = +1.0000e+00 +floorF( +1.6963e+00) = +1.0000e+00 +floorF( +1.7962e+00) = +1.0000e+00 +floorF( +1.8961e+00) = +1.0000e+00 +floorF( +1.9960e+00) = +1.0000e+00 + ceilD(-2.0000000000000e+00) = -2.0000000000000e+00 + ceilD(-1.9000000001000e+00) = -1.0000000000000e+00 + ceilD(-1.8000000002000e+00) = -1.0000000000000e+00 + ceilD(-1.7000000003000e+00) = -1.0000000000000e+00 + ceilD(-1.6000000004000e+00) = -1.0000000000000e+00 + ceilD(-1.5000000005000e+00) = -1.0000000000000e+00 + ceilD(-1.4000000006000e+00) = -1.0000000000000e+00 + ceilD(-1.3000000007000e+00) = -1.0000000000000e+00 + ceilD(-1.2000000008000e+00) = -1.0000000000000e+00 + ceilD(-1.1000000009000e+00) = -1.0000000000000e+00 + ceilD(-1.0000000010000e+00) = -1.0000000000000e+00 + ceilD(-9.0000000110000e-01) = -0.0000000000000e+00 + ceilD(-8.0000000120000e-01) = -0.0000000000000e+00 + ceilD(-7.0000000130000e-01) = -0.0000000000000e+00 + ceilD(-6.0000000140000e-01) = -0.0000000000000e+00 + ceilD(-5.0000000150000e-01) = -0.0000000000000e+00 + ceilD(-4.0000000160000e-01) = -0.0000000000000e+00 + ceilD(-3.0000000170000e-01) = -0.0000000000000e+00 + ceilD(-2.0000000180000e-01) = -0.0000000000000e+00 + ceilD(-1.0000000190000e-01) = -0.0000000000000e+00 + ceilD(-1.9999992495467e-09) = -0.0000000000000e+00 + ceilD(+9.9999997900001e-02) = +1.0000000000000e+00 + ceilD(+1.9999999780000e-01) = +1.0000000000000e+00 + ceilD(+2.9999999770000e-01) = +1.0000000000000e+00 + ceilD(+3.9999999760000e-01) = +1.0000000000000e+00 + ceilD(+4.9999999750000e-01) = +1.0000000000000e+00 + ceilD(+5.9999999740000e-01) = +1.0000000000000e+00 + ceilD(+6.9999999730000e-01) = +1.0000000000000e+00 + ceilD(+7.9999999720000e-01) = +1.0000000000000e+00 + ceilD(+8.9999999710000e-01) = +1.0000000000000e+00 + ceilD(+9.9999999700000e-01) = +1.0000000000000e+00 + ceilD(+1.0999999969000e+00) = +2.0000000000000e+00 + ceilD(+1.1999999968000e+00) = +2.0000000000000e+00 + ceilD(+1.2999999967000e+00) = +2.0000000000000e+00 + ceilD(+1.3999999966000e+00) = +2.0000000000000e+00 + ceilD(+1.4999999965000e+00) = +2.0000000000000e+00 + ceilD(+1.5999999964000e+00) = +2.0000000000000e+00 + ceilD(+1.6999999963000e+00) = +2.0000000000000e+00 + ceilD(+1.7999999962000e+00) = +2.0000000000000e+00 + ceilD(+1.8999999961000e+00) = +2.0000000000000e+00 + ceilD(+1.9999999960000e+00) = +2.0000000000000e+00 + ceilF( -2.0000e+00) = -2.0000e+00 + ceilF( -1.9001e+00) = -1.0000e+00 + ceilF( -1.8002e+00) = -1.0000e+00 + ceilF( -1.7003e+00) = -1.0000e+00 + ceilF( -1.6004e+00) = -1.0000e+00 + ceilF( -1.5005e+00) = -1.0000e+00 + ceilF( -1.4006e+00) = -1.0000e+00 + ceilF( -1.3007e+00) = -1.0000e+00 + ceilF( -1.2008e+00) = -1.0000e+00 + ceilF( -1.1009e+00) = -1.0000e+00 + ceilF( -1.0010e+00) = -1.0000e+00 + ceilF( -9.0110e-01) = -0.0000e+00 + ceilF( -8.0120e-01) = -0.0000e+00 + ceilF( -7.0130e-01) = -0.0000e+00 + ceilF( -6.0140e-01) = -0.0000e+00 + ceilF( -5.0150e-01) = -0.0000e+00 + ceilF( -4.0160e-01) = -0.0000e+00 + ceilF( -3.0170e-01) = -0.0000e+00 + ceilF( -2.0180e-01) = -0.0000e+00 + ceilF( -1.0190e-01) = -0.0000e+00 + ceilF( -1.9999e-03) = -0.0000e+00 + ceilF( +9.7900e-02) = +1.0000e+00 + ceilF( +1.9780e-01) = +1.0000e+00 + ceilF( +2.9770e-01) = +1.0000e+00 + ceilF( +3.9760e-01) = +1.0000e+00 + ceilF( +4.9750e-01) = +1.0000e+00 + ceilF( +5.9740e-01) = +1.0000e+00 + ceilF( +6.9730e-01) = +1.0000e+00 + ceilF( +7.9720e-01) = +1.0000e+00 + ceilF( +8.9710e-01) = +1.0000e+00 + ceilF( +9.9700e-01) = +1.0000e+00 + ceilF( +1.0969e+00) = +2.0000e+00 + ceilF( +1.1968e+00) = +2.0000e+00 + ceilF( +1.2967e+00) = +2.0000e+00 + ceilF( +1.3966e+00) = +2.0000e+00 + ceilF( +1.4965e+00) = +2.0000e+00 + ceilF( +1.5964e+00) = +2.0000e+00 + ceilF( +1.6963e+00) = +2.0000e+00 + ceilF( +1.7962e+00) = +2.0000e+00 + ceilF( +1.8961e+00) = +2.0000e+00 + ceilF( +1.9960e+00) = +2.0000e+00 + sinD(-2.0000000000000e+00) = -9.0929742682568e-01 + sinD(-1.9000000001000e+00) = -9.4630008765509e-01 + sinD(-1.8000000002000e+00) = -9.7384763083275e-01 + sinD(-1.7000000003000e+00) = -9.9166481041382e-01 + sinD(-1.6000000004000e+00) = -9.9957360302983e-01 + sinD(-1.5000000005000e+00) = -9.9749498663942e-01 + sinD(-1.4000000006000e+00) = -9.8544973009044e-01 + sinD(-1.3000000007000e+00) = -9.6355818560444e-01 + sinD(-1.2000000008000e+00) = -9.3203908625711e-01 + sinD(-1.1000000009000e+00) = -8.9120736046967e-01 + sinD(-1.0000000010000e+00) = -8.4147098534820e-01 + sinD(-9.0000000110000e-01) = -7.8332691031125e-01 + sinD(-8.0000000120000e-01) = -7.1735609173557e-01 + sinD(-7.0000000130000e-01) = -6.4421768823199e-01 + sinD(-6.0000000140000e-01) = -5.6464247455050e-01 + sinD(-5.0000000150000e-01) = -4.7942553992058e-01 + sinD(-4.0000000160000e-01) = -3.8941834378235e-01 + sinD(-3.0000000170000e-01) = -2.9552020828541e-01 + sinD(-2.0000000180000e-01) = -1.9866933255918e-01 + sinD(-1.0000000190000e-01) = -9.9833418537335e-02 + sinD(-1.9999992495467e-09) = -1.9999992495467e-09 + sinD(+9.9999997900001e-02) = +9.9833414557320e-02 + sinD(+1.9999999780000e-01) = +1.9866932863892e-01 + sinD(+2.9999999770000e-01) = +2.9552020446407e-01 + sinD(+3.9999999760000e-01) = +3.8941834009810e-01 + sinD(+4.9999999750000e-01) = +4.7942553641025e-01 + sinD(+5.9999999740000e-01) = +5.6464247124916e-01 + sinD(+6.9999999730000e-01) = +6.4421768517262e-01 + sinD(+7.9999999720000e-01) = +7.1735608894874e-01 + sinD(+8.9999999710000e-01) = +7.8332690782482e-01 + sinD(+9.9999999700000e-01) = +8.4147098318699e-01 + sinD(+1.0999999969000e+00) = +8.9120735865529e-01 + sinD(+1.1999999968000e+00) = +9.3203908480768e-01 + sinD(+1.2999999967000e+00) = +9.6355818453445e-01 + sinD(+1.3999999966000e+00) = +9.8544972941057e-01 + sinD(+1.4999999965000e+00) = +9.9749498635647e-01 + sinD(+1.5999999964000e+00) = +9.9957360314662e-01 + sinD(+1.6999999963000e+00) = +9.9166481092919e-01 + sinD(+1.7999999962000e+00) = +9.7384763174156e-01 + sinD(+1.8999999961000e+00) = +9.4630008894824e-01 + sinD(+1.9999999960000e+00) = +9.0929742849027e-01 + sinF( -2.0000e+00) = -9.0930e-01 + sinF( -1.9001e+00) = -9.4627e-01 + sinF( -1.8002e+00) = -9.7380e-01 + sinF( -1.7003e+00) = -9.9163e-01 + sinF( -1.6004e+00) = -9.9956e-01 + sinF( -1.5005e+00) = -9.9753e-01 + sinF( -1.4006e+00) = -9.8555e-01 + sinF( -1.3007e+00) = -9.6375e-01 + sinF( -1.2008e+00) = -9.3233e-01 + sinF( -1.1009e+00) = -8.9162e-01 + sinF( -1.0010e+00) = -8.4201e-01 + sinF( -9.0110e-01) = -7.8401e-01 + sinF( -8.0120e-01) = -7.1819e-01 + sinF( -7.0130e-01) = -6.4521e-01 + sinF( -6.0140e-01) = -5.6580e-01 + sinF( -5.0150e-01) = -4.8074e-01 + sinF( -4.0160e-01) = -3.9089e-01 + sinF( -3.0170e-01) = -2.9714e-01 + sinF( -2.0180e-01) = -2.0043e-01 + sinF( -1.0190e-01) = -1.0172e-01 + sinF( -1.9999e-03) = -1.9999e-03 + sinF( +9.7900e-02) = +9.7744e-02 + sinF( +1.9780e-01) = +1.9651e-01 + sinF( +2.9770e-01) = +2.9332e-01 + sinF( +3.9760e-01) = +3.8721e-01 + sinF( +4.9750e-01) = +4.7723e-01 + sinF( +5.9740e-01) = +5.6249e-01 + sinF( +6.9730e-01) = +6.4215e-01 + sinF( +7.9720e-01) = +7.1540e-01 + sinF( +8.9710e-01) = +7.8152e-01 + sinF( +9.9700e-01) = +8.3985e-01 + sinF( +1.0969e+00) = +8.8980e-01 + sinF( +1.1968e+00) = +9.3087e-01 + sinF( +1.2967e+00) = +9.6267e-01 + sinF( +1.3966e+00) = +9.8487e-01 + sinF( +1.4965e+00) = +9.9724e-01 + sinF( +1.5964e+00) = +9.9967e-01 + sinF( +1.6963e+00) = +9.9213e-01 + sinF( +1.7962e+00) = +9.7470e-01 + sinF( +1.8961e+00) = +9.4755e-01 + sinF( +1.9960e+00) = +9.1095e-01 + cosD(-2.0000000000000e+00) = -4.1614683654714e-01 + cosD(-1.9000000001000e+00) = -3.2328956695813e-01 + cosD(-1.8000000002000e+00) = -2.2720209488786e-01 + cosD(-1.7000000003000e+00) = -1.2884449459302e-01 + cosD(-1.6000000004000e+00) = -2.9199522701118e-02 + cosD(-1.5000000005000e+00) = +7.0737201168956e-02 + cosD(-1.4000000006000e+00) = +1.6996714230897e-01 + cosD(-1.3000000007000e+00) = +2.6749882795010e-01 + cosD(-1.2000000008000e+00) = +3.6235775373104e-01 + cosD(-1.1000000009000e+00) = +4.5359612062349e-01 + cosD(-1.0000000010000e+00) = +5.4030230502667e-01 + cosD(-9.0000000110000e-01) = +6.2160996740901e-01 + cosD(-8.0000000120000e-01) = +6.9670670848634e-01 + cosD(-7.0000000130000e-01) = +7.6484218644701e-01 + cosD(-6.0000000140000e-01) = +8.2533561411918e-01 + cosD(-5.0000000150000e-01) = +8.7758256117123e-01 + cosD(-4.0000000160000e-01) = +9.2106099337982e-01 + cosD(-3.0000000170000e-01) = +9.5533648862322e-01 + cosD(-2.0000000180000e-01) = +9.8006657748364e-01 + cosD(-1.0000000190000e-01) = +9.9500416508834e-01 + cosD(-1.9999992495467e-09) = +1.0000000000000e+00 + cosD(+9.9999997900001e-02) = +9.9500416548768e-01 + cosD(+1.9999999780000e-01) = +9.8006657827831e-01 + cosD(+2.9999999770000e-01) = +9.5533648980530e-01 + cosD(+3.9999999760000e-01) = +9.2106099493749e-01 + cosD(+4.9999999750000e-01) = +8.7758256308894e-01 + cosD(+5.9999999740000e-01) = +8.2533561637775e-01 + cosD(+6.9999999730000e-01) = +7.6484218902388e-01 + cosD(+7.9999999720000e-01) = +6.9670671135576e-01 + cosD(+8.9999999710000e-01) = +6.2160997054231e-01 + cosD(+9.9999999700000e-01) = +5.4030230839255e-01 + cosD(+1.0999999969000e+00) = +4.5359612418832e-01 + cosD(+1.1999999968000e+00) = +3.6235775745920e-01 + cosD(+1.2999999967000e+00) = +2.6749883180433e-01 + cosD(+1.3999999966000e+00) = +1.6996714625077e-01 + cosD(+1.4999999965000e+00) = +7.0737205158934e-02 + cosD(+1.5999999964000e+00) = -2.9199518702825e-02 + cosD(+1.6999999963000e+00) = -1.2884449062637e-01 + cosD(+1.7999999962000e+00) = -2.2720209099247e-01 + cosD(+1.8999999961000e+00) = -3.2328956317293e-01 + cosD(+1.9999999960000e+00) = -4.1614683290995e-01 + cosF( -2.0000e+00) = -4.1615e-01 + cosF( -1.9001e+00) = -3.2338e-01 + cosF( -1.8002e+00) = -2.2740e-01 + cosF( -1.7003e+00) = -1.2914e-01 + cosF( -1.6004e+00) = -2.9599e-02 + cosF( -1.5005e+00) = +7.0238e-02 + cosF( -1.4006e+00) = +1.6938e-01 + cosF( -1.3007e+00) = +2.6682e-01 + cosF( -1.2008e+00) = +3.6161e-01 + cosF( -1.1009e+00) = +4.5279e-01 + cosF( -1.0010e+00) = +5.3946e-01 + cosF( -9.0110e-01) = +6.2075e-01 + cosF( -8.0120e-01) = +6.9585e-01 + cosF( -7.0130e-01) = +7.6400e-01 + cosF( -6.0140e-01) = +8.2454e-01 + cosF( -5.0150e-01) = +8.7686e-01 + cosF( -4.0160e-01) = +9.2044e-01 + cosF( -3.0170e-01) = +9.5483e-01 + cosF( -2.0180e-01) = +9.7971e-01 + cosF( -1.0190e-01) = +9.9481e-01 + cosF( -1.9999e-03) = +1.0000e+00 + cosF( +9.7900e-02) = +9.9521e-01 + cosF( +1.9780e-01) = +9.8050e-01 + cosF( +2.9770e-01) = +9.5601e-01 + cosF( +3.9760e-01) = +9.2199e-01 + cosF( +4.9750e-01) = +8.7878e-01 + cosF( +5.9740e-01) = +8.2680e-01 + cosF( +6.9730e-01) = +7.6658e-01 + cosF( +7.9720e-01) = +6.9871e-01 + cosF( +8.9710e-01) = +6.2388e-01 + cosF( +9.9700e-01) = +5.4282e-01 + cosF( +1.0969e+00) = +4.5636e-01 + cosF( +1.1968e+00) = +3.6534e-01 + cosF( +1.2967e+00) = +2.7068e-01 + cosF( +1.3966e+00) = +1.7332e-01 + cosF( +1.4965e+00) = +7.4228e-02 + cosF( +1.5964e+00) = -2.5601e-02 + cosF( +1.6963e+00) = -1.2517e-01 + cosF( +1.7962e+00) = -2.2350e-01 + cosF( +1.8961e+00) = -3.1960e-01 + cosF( +1.9960e+00) = -4.1251e-01 + tanD(-2.0000000000000e+00) = +2.1850398632615e+00 + tanD(-1.9000000001000e+00) = +2.9270975137210e+00 + tanD(-1.8000000002000e+00) = +4.2862616707537e+00 + tanD(-1.7000000003000e+00) = +7.6966021213879e+00 + tanD(-1.6000000004000e+00) = +3.4232532266411e+01 + tanD(-1.5000000005000e+00) = -1.4101420047097e+01 + tanD(-1.4000000006000e+00) = -5.7978837362521e+00 + tanD(-1.3000000007000e+00) = -3.6021024577506e+00 + tanD(-1.2000000008000e+00) = -2.5721516282191e+00 + tanD(-1.1000000009000e+00) = -1.9647596616229e+00 + tanD(-1.0000000010000e+00) = -1.5574077280804e+00 + tanD(-9.0000000110000e-01) = -1.2601582203971e+00 + tanD(-8.0000000120000e-01) = -1.0296385595225e+00 + tanD(-7.0000000130000e-01) = -8.4228838268536e-01 + tanD(-6.0000000140000e-01) = -6.8413681039695e-01 + tanD(-5.0000000150000e-01) = -5.4630249179146e-01 + tanD(-4.0000000160000e-01) = -4.2279322062417e-01 + tanD(-3.0000000170000e-01) = -3.0933625147229e-01 + tanD(-2.0000000180000e-01) = -2.0271003738264e-01 + tanD(-1.0000000190000e-01) = -1.0033467400458e-01 + tanD(-1.9999992495467e-09) = -1.9999992495467e-09 + tanD(+9.9999997900001e-02) = +1.0033466996431e-01 + tanD(+1.9999999780000e-01) = +2.0271003321827e-01 + tanD(+2.9999999770000e-01) = +3.0933624708954e-01 + tanD(+3.9999999760000e-01) = +4.2279321590915e-01 + tanD(+4.9999999750000e-01) = +5.4630248659768e-01 + tanD(+5.9999999740000e-01) = +6.8413680452478e-01 + tanD(+6.9999999730000e-01) = +8.4228837584757e-01 + tanD(+7.9999999720000e-01) = +1.0296385512819e+00 + tanD(+8.9999999710000e-01) = +1.2601582100451e+00 + tanD(+9.9999999700000e-01) = +1.5574077143783e+00 + tanD(+1.0999999969000e+00) = +1.9647596421818e+00 + tanD(+1.1999999968000e+00) = +2.5721515977552e+00 + tanD(+1.2999999967000e+00) = +3.6021024018500e+00 + tanD(+1.3999999966000e+00) = +5.7978835977904e+00 + tanD(+1.4999999965000e+00) = +1.4101419247697e+01 + tanD(+1.5999999964000e+00) = -3.4232536957875e+01 + tanD(+1.6999999963000e+00) = -7.6966023623385e+00 + tanD(+1.7999999962000e+00) = -4.2862617482418e+00 + tanD(+1.8999999961000e+00) = -2.9270975519926e+00 + tanD(+1.9999999960000e+00) = -2.1850398863591e+00 + tanF( -2.0000e+00) = +2.1850e+00 + tanF( -1.9001e+00) = +2.9261e+00 + tanF( -1.8002e+00) = +4.2824e+00 + tanF( -1.7003e+00) = +7.6786e+00 + tanF( -1.6004e+00) = +3.3770e+01 + tanF( -1.5005e+00) = -1.4202e+01 + tanF( -1.4006e+00) = -5.8187e+00 + tanF( -1.3007e+00) = -3.6119e+00 + tanF( -1.2008e+00) = -2.5783e+00 + tanF( -1.1009e+00) = -1.9691e+00 + tanF( -1.0010e+00) = -1.5608e+00 + tanF( -9.0110e-01) = -1.2630e+00 + tanF( -8.0120e-01) = -1.0321e+00 + tanF( -7.0130e-01) = -8.4451e-01 + tanF( -6.0140e-01) = -6.8619e-01 + tanF( -5.0150e-01) = -5.4825e-01 + tanF( -4.0160e-01) = -4.2468e-01 + tanF( -3.0170e-01) = -3.1120e-01 + tanF( -2.0180e-01) = -2.0458e-01 + tanF( -1.0190e-01) = -1.0225e-01 + tanF( -1.9999e-03) = -1.9999e-03 + tanF( +9.7900e-02) = +9.8214e-02 + tanF( +1.9780e-01) = +2.0042e-01 + tanF( +2.9770e-01) = +3.0682e-01 + tanF( +3.9760e-01) = +4.1997e-01 + tanF( +4.9750e-01) = +5.4306e-01 + tanF( +5.9740e-01) = +6.8033e-01 + tanF( +6.9730e-01) = +8.3768e-01 + tanF( +7.9720e-01) = +1.0239e+00 + tanF( +8.9710e-01) = +1.2527e+00 + tanF( +9.9700e-01) = +1.5472e+00 + tanF( +1.0969e+00) = +1.9498e+00 + tanF( +1.1968e+00) = +2.5480e+00 + tanF( +1.2967e+00) = +3.5565e+00 + tanF( +1.3966e+00) = +5.6825e+00 + tanF( +1.4965e+00) = +1.3435e+01 + tanF( +1.5964e+00) = -3.9048e+01 + tanF( +1.6963e+00) = -7.9260e+00 + tanF( +1.7962e+00) = -4.3611e+00 + tanF( +1.8961e+00) = -2.9648e+00 + tanF( +1.9960e+00) = -2.2083e+00 + expD(-2.0000000000000e+00) = +1.3533528323661e-01 + expD(-1.9000000001000e+00) = +1.4956861920768e-01 + expD(-1.8000000002000e+00) = +1.6529888818853e-01 + expD(-1.7000000003000e+00) = +1.8268352399793e-01 + expD(-1.6000000004000e+00) = +2.0189651791390e-01 + expD(-1.5000000005000e+00) = +2.2313016003686e-01 + expD(-1.4000000006000e+00) = +2.4659696379365e-01 + expD(-1.3000000007000e+00) = +2.7253179284324e-01 + expD(-1.2000000008000e+00) = +3.0119421167125e-01 + expD(-1.1000000009000e+00) = +3.3287108339850e-01 + expD(-1.0000000010000e+00) = +3.6787944080356e-01 + expD(-9.0000000110000e-01) = +4.0656965929337e-01 + expD(-8.0000000120000e-01) = +4.4932896357803e-01 + expD(-7.0000000130000e-01) = +4.9658530314585e-01 + expD(-6.0000000140000e-01) = +5.4881163532569e-01 + expD(-5.0000000150000e-01) = +6.0653065880284e-01 + expD(-4.0000000160000e-01) = +6.7032004496313e-01 + expD(-3.0000000170000e-01) = +7.4081821942233e-01 + expD(-2.0000000180000e-01) = +8.1873075160427e-01 + expD(-1.0000000190000e-01) = +9.0483741631677e-01 + expD(-1.9999992495467e-09) = +9.9999999800000e-01 + expD(+9.9999997900001e-02) = +1.1051709157548e+00 + expD(+1.9999999780000e-01) = +1.2214027554731e+00 + expD(+2.9999999770000e-01) = +1.3498588044713e+00 + expD(+3.9999999760000e-01) = +1.4918246940609e+00 + expD(+4.9999999750000e-01) = +1.6487212665783e+00 + expD(+5.9999999740000e-01) = +1.8221187956530e+00 + expD(+6.9999999730000e-01) = +2.0137527020333e+00 + expD(+7.9999999720000e-01) = +2.2255409222610e+00 + expD(+8.9999999710000e-01) = +2.4596031040241e+00 + expD(+9.9999999700000e-01) = +2.7182818203042e+00 + expD(+1.0999999969000e+00) = +3.0041660146335e+00 + expD(+1.1999999968000e+00) = +3.3201169121122e+00 + expD(+1.2999999967000e+00) = +3.6692966555106e+00 + expD(+1.3999999966000e+00) = +4.0551999530570e+00 + expD(+1.4999999965000e+00) = +4.4816890546522e+00 + expD(+1.5999999964000e+00) = +4.9530324065642e+00 + expD(+1.6999999963000e+00) = +5.4739473714736e+00 + expD(+1.7999999962000e+00) = +6.0496474414243e+00 + expD(+1.8999999961000e+00) = +6.6858944162043e+00 + expD(+1.9999999960000e+00) = +7.3890560693744e+00 + expF( -2.0000e+00) = +1.3534e-01 + expF( -1.9001e+00) = +1.4955e-01 + expF( -1.8002e+00) = +1.6527e-01 + expF( -1.7003e+00) = +1.8263e-01 + expF( -1.6004e+00) = +2.0182e-01 + expF( -1.5005e+00) = +2.2302e-01 + expF( -1.4006e+00) = +2.4645e-01 + expF( -1.3007e+00) = +2.7234e-01 + expF( -1.2008e+00) = +3.0095e-01 + expF( -1.1009e+00) = +3.3257e-01 + expF( -1.0010e+00) = +3.6751e-01 + expF( -9.0110e-01) = +4.0612e-01 + expF( -8.0120e-01) = +4.4879e-01 + expF( -7.0130e-01) = +4.9594e-01 + expF( -6.0140e-01) = +5.4804e-01 + expF( -5.0150e-01) = +6.0562e-01 + expF( -4.0160e-01) = +6.6925e-01 + expF( -3.0170e-01) = +7.3956e-01 + expF( -2.0180e-01) = +8.1726e-01 + expF( -1.0190e-01) = +9.0312e-01 + expF( -1.9999e-03) = +9.9800e-01 + expF( +9.7900e-02) = +1.1029e+00 + expF( +1.9780e-01) = +1.2187e+00 + expF( +2.9770e-01) = +1.3468e+00 + expF( +3.9760e-01) = +1.4882e+00 + expF( +4.9750e-01) = +1.6446e+00 + expF( +5.9740e-01) = +1.8174e+00 + expF( +6.9730e-01) = +2.0083e+00 + expF( +7.9720e-01) = +2.2193e+00 + expF( +8.9710e-01) = +2.4525e+00 + expF( +9.9700e-01) = +2.7101e+00 + expF( +1.0969e+00) = +2.9949e+00 + expF( +1.1968e+00) = +3.3095e+00 + expF( +1.2967e+00) = +3.6572e+00 + expF( +1.3966e+00) = +4.0414e+00 + expF( +1.4965e+00) = +4.4660e+00 + expF( +1.5964e+00) = +4.9352e+00 + expF( +1.6963e+00) = +5.4537e+00 + expF( +1.7962e+00) = +6.0267e+00 + expF( +1.8961e+00) = +6.6599e+00 + expF( +1.9960e+00) = +7.3596e+00 + sqrtD(+0.0000000000000e+00) = +0.0000000000000e+00 + sqrtD(+9.9999999900000e-02) = +3.1622776585872e-01 + sqrtD(+1.9999999980000e-01) = +4.4721359527635e-01 + sqrtD(+2.9999999970000e-01) = +5.4772255723130e-01 + sqrtD(+3.9999999960000e-01) = +6.3245553171745e-01 + sqrtD(+4.9999999950000e-01) = +7.0710678083299e-01 + sqrtD(+5.9999999940000e-01) = +7.7459666885419e-01 + sqrtD(+6.9999999930000e-01) = +8.3666002611575e-01 + sqrtD(+7.9999999920000e-01) = +8.9442719055270e-01 + sqrtD(+8.9999999910000e-01) = +9.4868329757617e-01 + sqrtD(+9.9999999900000e-01) = +9.9999999950000e-01 + sqrtD(+1.0999999989000e+00) = +1.0488088476457e+00 + sqrtD(+1.1999999988000e+00) = +1.0954451144626e+00 + sqrtD(+1.2999999987000e+00) = +1.1401754245291e+00 + sqrtD(+1.3999999986000e+00) = +1.1832159560283e+00 + sqrtD(+1.4999999985000e+00) = +1.2247448707792e+00 + sqrtD(+1.5999999984000e+00) = +1.2649110634349e+00 + sqrtD(+1.6999999983000e+00) = +1.3038404803886e+00 + sqrtD(+1.7999999982000e+00) = +1.3416407858291e+00 + sqrtD(+1.8999999981000e+00) = +1.3784048745198e+00 + sqrtD(+1.9999999980000e+00) = +1.4142135616660e+00 + sqrtF( +0.0000e+00) = +0.0000e+00 + sqrtF( +9.9900e-02) = +3.1607e-01 + sqrtF( +1.9980e-01) = +4.4699e-01 + sqrtF( +2.9970e-01) = +5.4745e-01 + sqrtF( +3.9960e-01) = +6.3214e-01 + sqrtF( +4.9950e-01) = +7.0675e-01 + sqrtF( +5.9940e-01) = +7.7421e-01 + sqrtF( +6.9930e-01) = +8.3624e-01 + sqrtF( +7.9920e-01) = +8.9398e-01 + sqrtF( +8.9910e-01) = +9.4821e-01 + sqrtF( +9.9900e-01) = +9.9950e-01 + sqrtF( +1.0989e+00) = +1.0483e+00 + sqrtF( +1.1988e+00) = +1.0949e+00 + sqrtF( +1.2987e+00) = +1.1396e+00 + sqrtF( +1.3986e+00) = +1.1826e+00 + sqrtF( +1.4985e+00) = +1.2241e+00 + sqrtF( +1.5984e+00) = +1.2643e+00 + sqrtF( +1.6983e+00) = +1.3032e+00 + sqrtF( +1.7982e+00) = +1.3410e+00 + sqrtF( +1.8981e+00) = +1.3777e+00 + sqrtF( +1.9980e+00) = +1.4135e+00 + logD(+0.0000000000000e+00) = -infinity + logD(+9.9999999900000e-02) = -2.3025850939940e+00 + logD(+1.9999999980000e-01) = -1.6094379134341e+00 + logD(+2.9999999970000e-01) = -1.2039728053259e+00 + logD(+3.9999999960000e-01) = -9.1629073287416e-01 + logD(+4.9999999950000e-01) = -6.9314718155995e-01 + logD(+5.9999999940000e-01) = -5.1082562476599e-01 + logD(+6.9999999930000e-01) = -3.5667494493873e-01 + logD(+7.9999999920000e-01) = -2.2314355231421e-01 + logD(+8.9999999910000e-01) = -1.0536051665783e-01 + logD(+9.9999999900000e-01) = -1.0000000832404e-09 + logD(+1.0999999989000e+00) = +9.5310178804325e-02 + logD(+1.1999999988000e+00) = +1.8232155579395e-01 + logD(+1.2999999987000e+00) = +2.6236426346749e-01 + logD(+1.3999999986000e+00) = +3.3647223562121e-01 + logD(+1.4999999985000e+00) = +4.0546510710816e-01 + logD(+1.5999999984000e+00) = +4.7000362824574e-01 + logD(+1.6999999983000e+00) = +5.3062825006217e-01 + logD(+1.7999999982000e+00) = +5.8778666390212e-01 + logD(+1.8999999981000e+00) = +6.4185388517240e-01 + logD(+1.9999999980000e+00) = +6.9314717955995e-01 + logF( +0.0000e+00) = -inf + logF( +9.9900e-02) = -2.3036e+00 + logF( +1.9980e-01) = -1.6104e+00 + logF( +2.9970e-01) = -1.2050e+00 + logF( +3.9960e-01) = -9.1729e-01 + logF( +4.9950e-01) = -6.9415e-01 + logF( +5.9940e-01) = -5.1183e-01 + logF( +6.9930e-01) = -3.5768e-01 + logF( +7.9920e-01) = -2.2414e-01 + logF( +8.9910e-01) = -1.0636e-01 + logF( +9.9900e-01) = -1.0005e-03 + logF( +1.0989e+00) = +9.4310e-02 + logF( +1.1988e+00) = +1.8132e-01 + logF( +1.2987e+00) = +2.6136e-01 + logF( +1.3986e+00) = +3.3547e-01 + logF( +1.4985e+00) = +4.0446e-01 + logF( +1.5984e+00) = +4.6900e-01 + logF( +1.6983e+00) = +5.2963e-01 + logF( +1.7982e+00) = +5.8679e-01 + logF( +1.8981e+00) = +6.4085e-01 + logF( +1.9980e+00) = +6.9215e-01 +log10D(+0.0000000000000e+00) = -infinity +log10D(+9.9999999900000e-02) = -1.0000000004343e+00 +log10D(+1.9999999980000e-01) = -6.9897000477031e-01 +log10D(+2.9999999970000e-01) = -5.2287874571463e-01 +log10D(+3.9999999960000e-01) = -3.9794000910633e-01 +log10D(+4.9999999950000e-01) = -3.0102999609828e-01 +log10D(+5.9999999940000e-01) = -2.2184875005065e-01 +log10D(+6.9999999930000e-01) = -1.5490196042004e-01 +log10D(+7.9999999920000e-01) = -9.6910013442351e-02 +log10D(+8.9999999910000e-01) = -4.5757490994970e-02 +log10D(+9.9999999900000e-01) = -4.3429451805409e-10 +log10D(+1.0999999989000e+00) = +4.1392684723931e-02 +log10D(+1.1999999988000e+00) = +7.9181245613330e-02 +log10D(+1.2999999987000e+00) = +1.1394335187254e-01 +log10D(+1.3999999986000e+00) = +1.4612803524394e-01 +log10D(+1.4999999985000e+00) = +1.7609125862139e-01 +log10D(+1.5999999984000e+00) = +2.0411998222163e-01 +log10D(+1.6999999983000e+00) = +2.3044892094398e-01 +log10D(+1.7999999982000e+00) = +2.5527250466901e-01 +log10D(+1.8999999981000e+00) = +2.7875360051853e-01 +log10D(+1.9999999980000e+00) = +3.0102999522969e-01 +log10F( +0.0000e+00) = -inf +log10F( +9.9900e-02) = -1.0004e+00 +log10F( +1.9980e-01) = -6.9940e-01 +log10F( +2.9970e-01) = -5.2331e-01 +log10F( +3.9960e-01) = -3.9837e-01 +log10F( +4.9950e-01) = -3.0146e-01 +log10F( +5.9940e-01) = -2.2228e-01 +log10F( +6.9930e-01) = -1.5534e-01 +log10F( +7.9920e-01) = -9.7345e-02 +log10F( +8.9910e-01) = -4.6192e-02 +log10F( +9.9900e-01) = -4.3451e-04 +log10F( +1.0989e+00) = +4.0958e-02 +log10F( +1.1988e+00) = +7.8747e-02 +log10F( +1.2987e+00) = +1.1351e-01 +log10F( +1.3986e+00) = +1.4569e-01 +log10F( +1.4985e+00) = +1.7566e-01 +log10F( +1.5984e+00) = +2.0369e-01 +log10F( +1.6983e+00) = +2.3001e-01 +log10F( +1.7982e+00) = +2.5484e-01 +log10F( +1.8981e+00) = +2.7832e-01 +log10F( +1.9980e+00) = +3.0060e-01 + asinD(-1.0000000000000e+00) = -1.5707963267949e+00 + asinD(-9.0000000010000e-01) = -1.1197695152280e+00 + asinD(-8.0000000020000e-01) = -9.2729521833495e-01 + asinD(-7.0000000030000e-01) = -7.7539749703084e-01 + asinD(-6.0000000040000e-01) = -6.4350110929328e-01 + asinD(-5.0000000050000e-01) = -5.2359877617565e-01 + asinD(-4.0000000060000e-01) = -4.1151684672214e-01 + asinD(-3.0000000070000e-01) = -3.0469265474920e-01 + asinD(-2.0000000080000e-01) = -2.0135792160683e-01 + asinD(-1.0000000090000e-01) = -1.0016742206609e-01 + asinD(-1.0000000549848e-09) = -1.0000000549848e-09 + asinD(+9.9999998900000e-02) = +1.0016742005602e-01 + asinD(+1.9999999880000e-01) = +2.0135791956559e-01 + asinD(+2.9999999870000e-01) = +3.0469265265263e-01 + asinD(+3.9999999860000e-01) = +4.1151684453996e-01 + asinD(+4.9999999850000e-01) = +5.2359877386625e-01 + asinD(+5.9999999840000e-01) = +6.4350110679328e-01 + asinD(+6.9999999830000e-01) = +7.7539749423028e-01 + asinD(+7.9999999820000e-01) = +9.2729521500161e-01 + asinD(+8.9999999810000e-01) = +1.1197695106397e+00 + asinD(+9.9999999800000e-01) = +1.5707330812408e+00 + asinF( -1.0000e+00) = -1.5708e+00 + asinF( -9.0010e-01) = -1.1200e+00 + asinF( -8.0020e-01) = -9.2763e-01 + asinF( -7.0030e-01) = -7.7582e-01 + asinF( -6.0040e-01) = -6.4400e-01 + asinF( -5.0050e-01) = -5.2418e-01 + asinF( -4.0060e-01) = -4.1217e-01 + asinF( -3.0070e-01) = -3.0543e-01 + asinF( -2.0080e-01) = -2.0217e-01 + asinF( -1.0090e-01) = -1.0107e-01 + asinF( -9.9994e-04) = -9.9994e-04 + asinF( +9.8900e-02) = +9.9062e-02 + asinF( +1.9880e-01) = +2.0013e-01 + asinF( +2.9870e-01) = +3.0333e-01 + asinF( +3.9860e-01) = +4.0999e-01 + asinF( +4.9850e-01) = +5.2187e-01 + asinF( +5.9840e-01) = +6.4150e-01 + asinF( +6.9830e-01) = +7.7302e-01 + asinF( +7.9820e-01) = +9.2430e-01 + asinF( +8.9810e-01) = +1.1154e+00 + asinF( +9.9800e-01) = +1.5075e+00 + acosD(-1.0000000000000e+00) = +3.1415926536e+00 + acosD(-9.0000010000000e-01) = +2.6905660712e+00 + acosD(-8.0000020000000e-01) = +2.4980918781e+00 + acosD(-7.0000030000000e-01) = +2.3461942435e+00 + acosD(-6.0000040000000e-01) = +2.2142979356e+00 + acosD(-5.0000050000000e-01) = +2.0943956797e+00 + acosD(-4.0000060000000e-01) = +1.9823138275e+00 + acosD(-3.0000070000000e-01) = +1.8754897146e+00 + acosD(-2.0000080000000e-01) = +1.7721550641e+00 + acosD(-1.0000090000000e-01) = +1.6709646525e+00 + acosD(-9.9999999977896e-07) = +1.5707973268e+00 + acosD(+9.9998900000000e-02) = +1.4706300112e+00 + acosD(+1.9999880000000e-01) = +1.3694396307e+00 + acosD(+2.9999870000000e-01) = +1.2661050355e+00 + acosD(+3.9999860000000e-01) = +1.1592810083e+00 + acosD(+4.9999850000000e-01) = +1.0471992832e+00 + acosD(+5.9999840000000e-01) = +9.2729721800e-01 + acosD(+6.9999830000000e-01) = +7.9540121066e-01 + acosD(+7.9999820000000e-01) = +6.4350410879e-01 + acosD(+8.9999810000000e-01) = +4.5103117068e-01 + acosD(+9.9999800000000e-01) = +2.0000003331e-03 + acosF( -1.0000e+00) = +3.1416e+00 + acosF( -9.0010e-01) = +2.6908e+00 + acosF( -8.0020e-01) = +2.4984e+00 + acosF( -7.0030e-01) = +2.3466e+00 + acosF( -6.0040e-01) = +2.2148e+00 + acosF( -5.0050e-01) = +2.0950e+00 + acosF( -4.0060e-01) = +1.9830e+00 + acosF( -3.0070e-01) = +1.8762e+00 + acosF( -2.0080e-01) = +1.7730e+00 + acosF( -1.0090e-01) = +1.6719e+00 + acosF( -9.9994e-04) = +1.5718e+00 + acosF( +9.8900e-02) = +1.4717e+00 + acosF( +1.9880e-01) = +1.3707e+00 + acosF( +2.9870e-01) = +1.2675e+00 + acosF( +3.9860e-01) = +1.1608e+00 + acosF( +4.9850e-01) = +1.0489e+00 + acosF( +5.9840e-01) = +9.2929e-01 + acosF( +6.9830e-01) = +7.9778e-01 + acosF( +7.9820e-01) = +6.4650e-01 + acosF( +8.9810e-01) = +4.5537e-01 + acosF( +9.9800e-01) = +6.3255e-02 + atanD(-1.0000000000000e+00) = -7.8539816339745e-01 + atanD(-9.0000000010000e-01) = -7.3281510184176e-01 + atanD(-8.0000000020000e-01) = -6.7474094234550e-01 + atanD(-7.0000000030000e-01) = -6.1072596459055e-01 + atanD(-6.0000000040000e-01) = -5.4041950056470e-01 + atanD(-5.0000000050000e-01) = -4.6364760940081e-01 + atanD(-4.0000000060000e-01) = -3.8050637762961e-01 + atanD(-3.0000000070000e-01) = -2.9145679512007e-01 + atanD(-2.0000000080000e-01) = -1.9739556061911e-01 + atanD(-1.0000000090000e-01) = -9.9668653382251e-02 + atanD(-1.0000000549848e-09) = -1.0000000549848e-09 + atanD(+9.9999998900000e-02) = +9.9668651402053e-02 + atanD(+1.9999999880000e-01) = +1.9739555869603e-01 + atanD(+2.9999999870000e-01) = +2.9145679328521e-01 + atanD(+3.9999999860000e-01) = +3.8050637590547e-01 + atanD(+4.9999999850000e-01) = +4.6364760780081e-01 + atanD(+5.9999999840000e-01) = +5.4041949909411e-01 + atanD(+6.9999999830000e-01) = +6.1072596324827e-01 + atanD(+7.9999999820000e-01) = +6.7474094112599e-01 + atanD(+8.9999999810000e-01) = +7.3281510073678e-01 + atanD(+9.9999999800000e-01) = +7.8539816239745e-01 + atanF( -1.0000e+00) = -7.8540e-01 + atanF( -9.0010e-01) = -7.3287e-01 + atanF( -8.0020e-01) = -6.7486e-01 + atanF( -7.0030e-01) = -6.1093e-01 + atanF( -6.0040e-01) = -5.4071e-01 + atanF( -5.0050e-01) = -4.6405e-01 + atanF( -4.0060e-01) = -3.8102e-01 + atanF( -3.0070e-01) = -2.9210e-01 + atanF( -2.0080e-01) = -1.9816e-01 + atanF( -1.0090e-01) = -1.0056e-01 + atanF( -9.9994e-04) = -9.9994e-04 + atanF( +9.8900e-02) = +9.8579e-02 + atanF( +1.9880e-01) = +1.9624e-01 + atanF( +2.9870e-01) = +2.9026e-01 + atanF( +3.9860e-01) = +3.7930e-01 + atanF( +4.9850e-01) = +4.6245e-01 + atanF( +5.9840e-01) = +5.3924e-01 + atanF( +6.9830e-01) = +6.0958e-01 + atanF( +7.9820e-01) = +6.7364e-01 + atanF( +8.9810e-01) = +7.3176e-01 + atanF( +9.9800e-01) = +7.8440e-01 +atan2D(-1.0000000000000e+00) = -7.8539816339745e-01 +atan2D(-9.0000000010000e-01) = -7.3281510184176e-01 +atan2D(-8.0000000020000e-01) = -6.7474094234550e-01 +atan2D(-7.0000000030000e-01) = -6.1072596459055e-01 +atan2D(-6.0000000040000e-01) = -5.4041950056470e-01 +atan2D(-5.0000000050000e-01) = -4.6364760940081e-01 +atan2D(-4.0000000060000e-01) = -3.8050637762961e-01 +atan2D(-3.0000000070000e-01) = -2.9145679512007e-01 +atan2D(-2.0000000080000e-01) = -1.9739556061911e-01 +atan2D(-1.0000000090000e-01) = -9.9668653382251e-02 +atan2D(-1.0000000549848e-09) = -1.0000000549848e-09 +atan2D(+9.9999998900000e-02) = +9.9668651402053e-02 +atan2D(+1.9999999880000e-01) = +1.9739555869603e-01 +atan2D(+2.9999999870000e-01) = +2.9145679328521e-01 +atan2D(+3.9999999860000e-01) = +3.8050637590547e-01 +atan2D(+4.9999999850000e-01) = +4.6364760780081e-01 +atan2D(+5.9999999840000e-01) = +5.4041949909411e-01 +atan2D(+6.9999999830000e-01) = +6.1072596324827e-01 +atan2D(+7.9999999820000e-01) = +6.7474094112599e-01 +atan2D(+8.9999999810000e-01) = +7.3281510073678e-01 +atan2D(+9.9999999800000e-01) = +7.8539816239745e-01 +atan2F( -1.0000e+00) = -7.8540e-01 +atan2F( -9.0010e-01) = -7.3287e-01 +atan2F( -8.0020e-01) = -6.7486e-01 +atan2F( -7.0030e-01) = -6.1093e-01 +atan2F( -6.0040e-01) = -5.4071e-01 +atan2F( -5.0050e-01) = -4.6405e-01 +atan2F( -4.0060e-01) = -3.8102e-01 +atan2F( -3.0070e-01) = -2.9210e-01 +atan2F( -2.0080e-01) = -1.9816e-01 +atan2F( -1.0090e-01) = -1.0056e-01 +atan2F( -9.9994e-04) = -9.9994e-04 +atan2F( +9.8900e-02) = +9.8579e-02 +atan2F( +1.9880e-01) = +1.9624e-01 +atan2F( +2.9870e-01) = +2.9026e-01 +atan2F( +3.9860e-01) = +3.7930e-01 +atan2F( +4.9850e-01) = +4.6245e-01 +atan2F( +5.9840e-01) = +5.3924e-01 +atan2F( +6.9830e-01) = +6.0958e-01 +atan2F( +7.9820e-01) = +6.7364e-01 +atan2F( +8.9810e-01) = +7.3176e-01 +atan2F( +9.9800e-01) = +7.8440e-01 |
From: Florian K. <fk...@so...> - 2025-03-15 23:20:38
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=c3049684e26ee4300c797a11c9b88708223771f3 commit c3049684e26ee4300c797a11c9b88708223771f3 Author: Florian Krohm <fl...@ei...> Date: Sat Mar 15 23:18:59 2025 +0000 s390x: Rework s390_disasm interface (BZ 498942) The way extended mnemonics were communicated to s390_disasm was a bit messy and, more importantly, error prone. The primary reason is that extended mnemonics were added late in the game (at the time) and sort of force-fitted on top of the existing scheme. Here are a few examples showing the new way of doing things: old: s390_disasm(ENC3(MNM, GPR, UINT), mnm, r1, i2); new: S390_DISASM(MNM(mnm), GPR(r1), UINT(i2)); old: s390_disasm(ENC3(MNM, FPR, UDXB), mnm, r1, d2, x2, b2); new: S390_DISASM(MNM(mnm), FPR(r1), UDXB(d2, x2, b2)); The arguments to S390_DISASM are essentially constructors for the various opcode fields. They appear in the same order as written in Principles of Ops. old: s390_disasm(ENC4(XMNM, GPR, INT, CABM), S390_XMNM_CAB, mnm, m3, r1, i2, m3); new: S390_DISASM(XMNM(mnm, cabt_disasm), GPR(r1), INT(i2), MASK(m3)); The 2nd argument to XMNM() is a function that constructs the extended mnemonic and writes the disassembed insn as appropriate. Fixes https://bugs.kde.org/show_bug.cgi?id=498942 Diff: --- NEWS | 1 + VEX/priv/guest_s390_toIR.c | 294 ++++++++-------- VEX/priv/host_s390_defs.c | 849 ++++++++++++++++++++++----------------------- VEX/priv/s390_disasm.c | 522 ++++++++++++++-------------- VEX/priv/s390_disasm.h | 126 ++++--- 5 files changed, 904 insertions(+), 888 deletions(-) diff --git a/NEWS b/NEWS index 4d4c7eec46..5ba2236a09 100644 --- a/NEWS +++ b/NEWS @@ -55,6 +55,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. even though it's generated by --gen-suppressions=yes 498422 s390x: Fix VLRL and VSTRL insns 498492 none/tests/amd64/lzcnt64 crashes on FreeBSD compiled with clang +498942 s390x: Rework s390_disasm interface 499183 FreeBSD: differences in avx-vmovq output 499212 mmap() with MAP_ALIGNED() returns unaligned pointer 501119 memcheck/tests/pointer-trace fails when run on NFS filesystem diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index b5816dd1f8..67633f1c91 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -2702,7 +2702,7 @@ s390_format_I(const HChar *(*irgen)(UChar i), const HChar *mnm = irgen(i); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC2(MNM, UINT), mnm, i); + S390_DISASM(MNM(mnm), UINT(i)); } static void @@ -2711,7 +2711,7 @@ s390_format_E(const HChar *(*irgen)(void)) const HChar *mnm = irgen(); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC1(MNM), mnm); + S390_DISASM(MNM(mnm)); } static void @@ -2728,7 +2728,7 @@ s390_format_RI_RU(const HChar *(*irgen)(UChar r1, UShort i2), const HChar *mnm = irgen(r1, i2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, UINT), mnm, r1, i2); + S390_DISASM(MNM(mnm), GPR(r1), UINT(i2)); } static void @@ -2738,7 +2738,7 @@ s390_format_RI_RI(const HChar *(*irgen)(UChar r1, UShort i2), const HChar *mnm = irgen(r1, i2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, INT), mnm, r1, (Int)(Short)i2); + S390_DISASM(MNM(mnm), GPR(r1), INT((Int)(Short)i2)); } static void @@ -2748,7 +2748,7 @@ s390_format_RI_RP(const HChar *(*irgen)(UChar r1, UShort i2), const HChar *mnm = irgen(r1, i2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, PCREL), mnm, r1, (Int)(Short)i2); + S390_DISASM(MNM(mnm), GPR(r1), PCREL((Int)(Short)i2)); } static void @@ -2758,7 +2758,7 @@ s390_format_RIE_RRP(const HChar *(*irgen)(UChar r1, UChar r3, UShort i2), const HChar *mnm = irgen(r1, r3, i2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, GPR, GPR, PCREL), mnm, r1, r3, (Int)(Short)i2); + S390_DISASM(MNM(mnm), GPR(r1), GPR(r3), PCREL((Int)(Short)i2)); } static void @@ -2768,7 +2768,7 @@ s390_format_RIE_RRI0(const HChar *(*irgen)(UChar r1, UChar r3, UShort i2), const HChar *mnm = irgen(r1, r3, i2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, GPR, GPR, INT), mnm, r1, r3, (Int)(Short)i2); + S390_DISASM(MNM(mnm), GPR(r1), GPR(r3), INT((Int)(Short)i2)); } static void @@ -2779,8 +2779,7 @@ s390_format_RIE_RRUUU(const HChar *(*irgen)(UChar r1, UChar r2, UChar i3, const HChar *mnm = irgen(r1, r2, i3, i4, i5); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC6(MNM, GPR, GPR, UINT, UINT, UINT), mnm, r1, r2, i3, i4, - i5); + S390_DISASM(MNM(mnm), GPR(r1), GPR(r2), UINT(i3), UINT(i4), UINT(i5)); } static void @@ -2790,8 +2789,7 @@ s390_format_R0UU(const HChar *(*irgen)(UChar r1, UShort i2, UChar m3), const HChar *mnm = irgen(r1, i2, m3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(XMNM, GPR, INT, CABM), S390_XMNM_CAB, mnm, m3, r1, - i2, m3); + S390_DISASM(XMNM(mnm, cabt_disasm), GPR(r1), INT(i2), MASK(m3)); } static void @@ -2801,8 +2799,7 @@ s390_format_R0IU(const HChar *(*irgen)(UChar r1, UShort i2, UChar m3), const HChar *mnm = irgen(r1, i2, m3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(XMNM, GPR, INT, CABM), S390_XMNM_CAB, mnm, m3, r1, - (Int)(Short)i2, m3); + S390_DISASM(XMNM(mnm, cabt_disasm), GPR(r1), INT((Int)(Short)i2), MASK(m3)); } static void @@ -2813,8 +2810,7 @@ s390_format_RIE_RRPU(const HChar *(*irgen)(UChar r1, UChar r2, UShort i4, const HChar *mnm = irgen(r1, r2, i4, m3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(XMNM, GPR, GPR, CABM, PCREL), S390_XMNM_CAB, mnm, m3, r1, - r2, m3, (Int)(Short)i4); + S390_DISASM(XMNM(mnm, cabt_disasm), GPR(r1), GPR(r2), MASK(m3), PCREL((Int)(Short)i4)); } static void @@ -2825,8 +2821,7 @@ s390_format_RIE_RUPU(const HChar *(*irgen)(UChar r1, UChar m3, UShort i4, const HChar *mnm = irgen(r1, m3, i4, i2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(XMNM, GPR, UINT, CABM, PCREL), S390_XMNM_CAB, mnm, m3, - r1, i2, m3, (Int)(Short)i4); + S390_DISASM(XMNM(mnm, cabt_disasm), GPR(r1), UINT(i2), MASK(m3), PCREL((Int)(Short)i4)); } static void @@ -2837,8 +2832,7 @@ s390_format_RIE_RUPI(const HChar *(*irgen)(UChar r1, UChar m3, UShort i4, const HChar *mnm = irgen(r1, m3, i4, i2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(XMNM, GPR, INT, CABM, PCREL), S390_XMNM_CAB, mnm, m3, r1, - (Int)(Char)i2, m3, (Int)(Short)i4); + S390_DISASM(XMNM(mnm, cabt_disasm), GPR(r1), INT((Int)(Char)i2), MASK(m3), PCREL((Int)(Short)i4)); } static void @@ -2848,8 +2842,7 @@ s390_format_RIE_RUPIX(const HChar *(*irgen)(UChar r1, UChar m3, UShort i2), const HChar *mnm = irgen(r1, m3, i2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(XMNM, GPR, INT), S390_XMNM_CLS, mnm, m3, r1, - (Int)(Short)i2); + S390_DISASM(XMNM(mnm, cls_disasm), GPR(r1), INT((Int)(Short)i2), MASK(m3)); } static void @@ -2866,7 +2859,7 @@ s390_format_RIL_RU(const HChar *(*irgen)(UChar r1, UInt i2), const HChar *mnm = irgen(r1, i2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, UINT), mnm, r1, i2); + S390_DISASM(MNM(mnm), GPR(r1), UINT(i2)); } static void @@ -2876,7 +2869,7 @@ s390_format_RIL_RI(const HChar *(*irgen)(UChar r1, UInt i2), const HChar *mnm = irgen(r1, i2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, INT), mnm, r1, i2); + S390_DISASM(MNM(mnm), GPR(r1), INT(i2)); } static void @@ -2886,7 +2879,7 @@ s390_format_RIL_RP(const HChar *(*irgen)(UChar r1, UInt i2), const HChar *mnm = irgen(r1, i2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, PCREL), mnm, r1, i2); + S390_DISASM(MNM(mnm), GPR(r1), PCREL(i2)); } static void @@ -2896,7 +2889,7 @@ s390_format_RIL_UP(const HChar *(*irgen)(void), const HChar *mnm = irgen(); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, UINT, PCREL), mnm, r1, i2); + S390_DISASM(MNM(mnm), UINT(r1), PCREL(i2)); } static void @@ -2913,8 +2906,7 @@ s390_format_RIS_RURDI(const HChar *(*irgen)(UChar r1, UChar m3, UChar i2, mnm = irgen(r1, m3, i2, op4addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(XMNM, GPR, INT, CABM, UDXB), S390_XMNM_CAB, mnm, m3, r1, - (Int)(Char)i2, m3, d4, 0, b4); + S390_DISASM(XMNM(mnm, cabt_disasm), GPR(r1), INT((Int)(Char)i2), MASK(m3), UDXB(d4, 0, b4)); } static void @@ -2931,8 +2923,7 @@ s390_format_RIS_RURDU(const HChar *(*irgen)(UChar r1, UChar m3, UChar i2, mnm = irgen(r1, m3, i2, op4addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(XMNM, GPR, UINT, CABM, UDXB), S390_XMNM_CAB, mnm, m3, r1, - i2, m3, d4, 0, b4); + S390_DISASM(XMNM(mnm, cabt_disasm), GPR(r1), UINT(i2), MASK(m3), UDXB(d4, 0, b4)); } static void @@ -2949,7 +2940,7 @@ s390_format_RR_RR(const HChar *(*irgen)(UChar r1, UChar r2), const HChar *mnm = irgen(r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, GPR), mnm, r1, r2); + S390_DISASM(MNM(mnm), GPR(r1), GPR(r2)); } static void @@ -2959,7 +2950,7 @@ s390_format_RR_FF(const HChar *(*irgen)(UChar r1, UChar r2), const HChar *mnm = irgen(r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, FPR, FPR), mnm, r1, r2); + S390_DISASM(MNM(mnm), FPR(r1), FPR(r2)); } static void @@ -2976,7 +2967,7 @@ s390_format_RRE_RR(const HChar *(*irgen)(UChar r1, UChar r2), const HChar *mnm = irgen(r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, GPR), mnm, r1, r2); + S390_DISASM(MNM(mnm), GPR(r1), GPR(r2)); } static void @@ -2986,7 +2977,7 @@ s390_format_RRE_FF(const HChar *(*irgen)(UChar r1, UChar r2), const HChar *mnm = irgen(r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, FPR, FPR), mnm, r1, r2); + S390_DISASM(MNM(mnm), FPR(r1), FPR(r2)); } static void @@ -2996,7 +2987,7 @@ s390_format_RRE_RF(const HChar *(*irgen)(UChar, UChar), const HChar *mnm = irgen(r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, FPR), mnm, r1, r2); + S390_DISASM(MNM(mnm), GPR(r1), FPR(r2)); } static void @@ -3006,7 +2997,7 @@ s390_format_RRE_FR(const HChar *(*irgen)(UChar r1, UChar r2), const HChar *mnm = irgen(r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, FPR, GPR), mnm, r1, r2); + S390_DISASM(MNM(mnm), FPR(r1), GPR(r2)); } static void @@ -3016,7 +3007,7 @@ s390_format_RRE_R0(const HChar *(*irgen)(UChar r1), const HChar *mnm = irgen(r1); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC2(MNM, GPR), mnm, r1); + S390_DISASM(MNM(mnm), GPR(r1)); } static void @@ -3026,7 +3017,7 @@ s390_format_RRE_F0(const HChar *(*irgen)(UChar r1), const HChar *mnm = irgen(r1); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC2(MNM, FPR), mnm, r1); + S390_DISASM(MNM(mnm), FPR(r1)); } static void @@ -3036,7 +3027,7 @@ s390_format_RRF_M0RERE(const HChar *(*irgen)(UChar m3, UChar r1, UChar r2), const HChar *mnm = irgen(m3, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, GPR, GPR, UINT), mnm, r1, r2, m3); + S390_DISASM(MNM(mnm), GPR(r1), GPR(r2), UINT(m3)); } static void @@ -3046,7 +3037,7 @@ s390_format_RRF_F0FF(const HChar *(*irgen)(UChar, UChar, UChar), const HChar *mnm = irgen(r1, r3, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, FPR, FPR, FPR), mnm, r1, r3, r2); + S390_DISASM(MNM(mnm), FPR(r1), FPR(r3), FPR(r2)); } static void @@ -3056,7 +3047,7 @@ s390_format_RRF_F0FR(const HChar *(*irgen)(UChar, UChar, UChar), const HChar *mnm = irgen(r3, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, FPR, FPR, GPR), mnm, r1, r3, r2); + S390_DISASM(MNM(mnm), FPR(r1), FPR(r3), GPR(r2)); } static void @@ -3067,7 +3058,7 @@ s390_format_RRF_UUFF(const HChar *(*irgen)(UChar m3, UChar m4, UChar r1, const HChar *mnm = irgen(m3, m4, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, FPR, UINT, FPR, UINT), mnm, r1, m3, r2, m4); + S390_DISASM(MNM(mnm), FPR(r1), UINT(m3), FPR(r2), UINT(m4)); } static void @@ -3077,7 +3068,7 @@ s390_format_RRF_0UFF(const HChar *(*irgen)(UChar m4, UChar r1, UChar r2), const HChar *mnm = irgen(m4, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, FPR, FPR, UINT), mnm, r1, r2, m4); + S390_DISASM(MNM(mnm), FPR(r1), FPR(r2), UINT(m4)); } static void @@ -3088,7 +3079,7 @@ s390_format_RRF_UUFR(const HChar *(*irgen)(UChar m3, UChar m4, UChar r1, const HChar *mnm = irgen(m3, m4, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, FPR, UINT, GPR, UINT), mnm, r1, m3, r2, m4); + S390_DISASM(MNM(mnm), FPR(r1), UINT(m3), GPR(r2), UINT(m4)); } static void @@ -3099,18 +3090,18 @@ s390_format_RRF_UURF(const HChar *(*irgen)(UChar m3, UChar m4, UChar r1, const HChar *mnm = irgen(m3, m4, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, GPR, UINT, FPR, UINT), mnm, r1, m3, r2, m4); + S390_DISASM(MNM(mnm), GPR(r1), UINT(m3), FPR(r2), UINT(m4)); } static void s390_format_RRF_U0RR(const HChar *(*irgen)(UChar m3, UChar r1, UChar r2), - UChar m3, UChar r1, UChar r2, Int xmnm_kind) + UChar m3, UChar r1, UChar r2, HChar *(*handler)(const s390_opnd *, HChar *)) { const HChar *mnm = irgen(m3, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(XMNM, GPR, GPR), xmnm_kind, mnm, m3, r1, r2); + S390_DISASM(XMNM(mnm, handler), GPR(r1), GPR(r2), MASK(m3)); } static void @@ -3121,9 +3112,9 @@ s390_format_RRFa_U0RR(const HChar *(*irgen)(UChar m3, UChar r1, UChar r2), if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) { if (m3 != 0) - s390_disasm(ENC4(MNM, GPR, GPR, UINT), mnm, r1, r2, m3); + S390_DISASM(MNM(mnm), GPR(r1), GPR(r2), UINT(m3)); else - s390_disasm(ENC3(MNM, GPR, GPR), mnm, r1, r2); + S390_DISASM(MNM(mnm), GPR(r1), GPR(r2)); } } @@ -3134,7 +3125,7 @@ s390_format_RRF_F0FF2(const HChar *(*irgen)(UChar, UChar, UChar), const HChar *mnm = irgen(r3, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, FPR, FPR, FPR), mnm, r1, r3, r2); + S390_DISASM(MNM(mnm), FPR(r1), FPR(r3), FPR(r2)); } static void @@ -3144,7 +3135,7 @@ s390_format_RRF_FFRU(const HChar *(*irgen)(UChar, UChar, UChar, UChar), const HChar *mnm = irgen(r3, m4, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, FPR, FPR, GPR, UINT), mnm, r1, r3, r2, m4); + S390_DISASM(MNM(mnm), FPR(r1), FPR(r3), GPR(r2), UINT(m4)); } static void @@ -3154,7 +3145,7 @@ s390_format_RRF_FUFF(const HChar *(*irgen)(UChar, UChar, UChar, UChar), const HChar *mnm = irgen(r3, m4, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, FPR, FPR, FPR, UINT), mnm, r1, r3, r2, m4); + S390_DISASM(MNM(mnm), FPR(r1), FPR(r3), FPR(r2), UINT(m4)); } static void @@ -3164,7 +3155,7 @@ s390_format_RRF_FUFF2(const HChar *(*irgen)(UChar, UChar, UChar, UChar), const HChar *mnm = irgen(r3, m4, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, FPR, FPR, FPR, UINT), mnm, r1, r2, r3, m4); + S390_DISASM(MNM(mnm), FPR(r1), FPR(r2), FPR(r3), UINT(m4)); } static void @@ -3174,7 +3165,7 @@ s390_format_RRF_RURR(const HChar *(*irgen)(UChar, UChar, UChar, UChar), const HChar *mnm = irgen(r3, m4, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(XMNM, GPR, GPR, GPR), S390_XMNM_CLS, mnm, m4, r1, r2, r3); + S390_DISASM(XMNM(mnm, cls_disasm), GPR(r1), GPR(r2), GPR(r3), MASK(m4)); } static void @@ -3184,7 +3175,7 @@ s390_format_RRF_R0RR2(const HChar *(*irgen)(UChar r3, UChar r1, UChar r2), const HChar *mnm = irgen(r3, r1, r2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, GPR, GPR, GPR), mnm, r1, r2, r3); + S390_DISASM(MNM(mnm), GPR(r1), GPR(r2), GPR(r3)); } static void @@ -3201,8 +3192,7 @@ s390_format_RRS(const HChar *(*irgen)(UChar r1, UChar r2, UChar m3, mnm = irgen(r1, r2, m3, op4addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(XMNM, GPR, GPR, CABM, UDXB), S390_XMNM_CAB, mnm, m3, r1, - r2, m3, d4, 0, b4); + S390_DISASM(XMNM(mnm, cabt_disasm), GPR(r1), GPR(r2), MASK(m3), UDXB(d4, 0, b4)); } static void @@ -3218,7 +3208,7 @@ s390_format_RS_R0RD(const HChar *(*irgen)(UChar r1, IRTemp op2addr), mnm = irgen(r1, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, UDXB), mnm, r1, d2, 0, b2); + S390_DISASM(MNM(mnm), GPR(r1), UDXB(d2, 0, b2)); } static void @@ -3234,7 +3224,7 @@ s390_format_RS_RRRD(const HChar *(*irgen)(UChar r1, UChar r3, IRTemp op2addr), mnm = irgen(r1, r3, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, GPR, GPR, UDXB), mnm, r1, r3, d2, 0, b2); + S390_DISASM(MNM(mnm), GPR(r1), GPR(r3), UDXB(d2, 0, b2)); } static void @@ -3250,7 +3240,7 @@ s390_format_RS_RURD(const HChar *(*irgen)(UChar r1, UChar r3, IRTemp op2addr), mnm = irgen(r1, r3, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, GPR, UINT, UDXB), mnm, r1, r3, d2, 0, b2); + S390_DISASM(MNM(mnm), GPR(r1), UINT(r3), UDXB(d2, 0, b2)); } static void @@ -3266,7 +3256,7 @@ s390_format_RS_AARD(const HChar *(*irgen)(UChar, UChar, IRTemp), mnm = irgen(r1, r3, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, AR, AR, UDXB), mnm, r1, r3, d2, 0, b2); + S390_DISASM(MNM(mnm), AR(r1), AR(r3), UDXB(d2, 0, b2)); } static void @@ -3276,7 +3266,7 @@ s390_format_RSI_RRP(const HChar *(*irgen)(UChar r1, UChar r3, UShort i2), const HChar *mnm = irgen(r1, r3, i2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, GPR, GPR, PCREL), mnm, r1, r3, (Int)(Short)i2); + S390_DISASM(MNM(mnm), GPR(r1), GPR(r3), PCREL((Int)(Short)i2)); } static void @@ -3294,7 +3284,7 @@ s390_format_RSY_RRRD(const HChar *(*irgen)(UChar r1, UChar r3, IRTemp op2addr), mnm = irgen(r1, r3, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, GPR, GPR, SDXB), mnm, r1, r3, dh2, dl2, 0, b2); + S390_DISASM(MNM(mnm), GPR(r1), GPR(r3), SDXB(dh2, dl2, 0, b2)); } static void @@ -3312,12 +3302,12 @@ s390_format_RSY_AARD(const HChar *(*irgen)(UChar, UChar, IRTemp), mnm = irgen(r1, r3, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, AR, AR, SDXB), mnm, r1, r3, dh2, dl2, 0, b2); + S390_DISASM(MNM(mnm), AR(r1), AR(r3), SDXB(dh2, dl2, 0, b2)); } static void -s390_format_RSY_RURD(const HChar *(*irgen)(UChar r1, UChar r3, IRTemp op2addr), - UChar r1, UChar r3, UChar b2, UShort dl2, UChar dh2) +s390_format_RSY_RURD(const HChar *(*irgen)(UChar r1, UChar m3, IRTemp op2addr), + UChar r1, UChar m3, UChar b2, UShort dl2, UChar dh2) { const HChar *mnm; IRTemp op2addr = newTemp(Ity_I64); @@ -3327,10 +3317,10 @@ s390_format_RSY_RURD(const HChar *(*irgen)(UChar r1, UChar r3, IRTemp op2addr), assign(op2addr, binop(Iop_Add64, mkexpr(d2), b2 != 0 ? get_gpr_dw0(b2) : mkU64(0))); - mnm = irgen(r1, r3, op2addr); + mnm = irgen(r1, m3, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, GPR, UINT, SDXB), mnm, r1, r3, dh2, dl2, 0, b2); + S390_DISASM(MNM(mnm), GPR(r1), UINT(m3), SDXB(dh2, dl2, 0, b2)); } static void @@ -3348,8 +3338,7 @@ s390_format_RSY_R0RD(const HChar *(*irgen)(UChar r1, UChar m3, IRTemp op2addr), mnm = irgen(r1, m3, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(XMNM, GPR, CABM, SDXB), S390_XMNM_CAB, mnm, m3, r1, m3, - dh2, dl2, 0, b2); + S390_DISASM(XMNM(mnm, cabt_disasm), GPR(r1), MASK(m3), SDXB(dh2, dl2, 0, b2)); } static void @@ -3370,8 +3359,7 @@ s390_format_RSY_RDRM(const HChar *(*irgen)(UChar r1, IRTemp op2addr), vassert(dis_res->whatNext == Dis_Continue); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(XMNM, GPR, SDXB), S390_XMNM_CLS, mnm, m3, r1, - dh2, dl2, 0, b2); + S390_DISASM(XMNM(mnm, cls_disasm), GPR(r1), SDXB(dh2, dl2, 0, b2), MASK(m3)); } static void @@ -3402,7 +3390,7 @@ s390_format_RX_RRRD(const HChar *(*irgen)(UChar r1, IRTemp op2addr), mnm = irgen(r1, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, UDXB), mnm, r1, d2, x2, b2); + S390_DISASM(MNM(mnm), GPR(r1), UDXB(d2, x2, b2)); } static void @@ -3419,7 +3407,7 @@ s390_format_RX_FRRD(const HChar *(*irgen)(UChar r1, IRTemp op2addr), mnm = irgen(r1, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, FPR, UDXB), mnm, r1, d2, x2, b2); + S390_DISASM(MNM(mnm), FPR(r1), UDXB(d2, x2, b2)); } static void @@ -3436,7 +3424,7 @@ s390_format_RXE_FRRD(const HChar *(*irgen)(UChar r1, IRTemp op2addr), mnm = irgen(r1, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, FPR, UDXB), mnm, r1, d2, x2, b2); + S390_DISASM(MNM(mnm), FPR(r1), UDXB(d2, x2, b2)); } static void @@ -3453,7 +3441,7 @@ s390_format_RXE_RRRDR(const HChar *(*irgen)(UChar r1, IRTemp op2addr, UChar m3), mnm = irgen(r1, op2addr, m3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, UDXB), mnm, r1, d2, x2, b2); + S390_DISASM(MNM(mnm), GPR(r1), UDXB(d2, x2, b2)); } static void @@ -3470,7 +3458,7 @@ s390_format_RXF_FRRDF(const HChar *(*irgen)(UChar, IRTemp, UChar), mnm = irgen(r3, op2addr, r1); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, FPR, FPR, UDXB), mnm, r1, r3, d2, x2, b2); + S390_DISASM(MNM(mnm), FPR(r1), FPR(r3), UDXB(d2, x2, b2)); } static void @@ -3490,9 +3478,9 @@ s390_format_RXY_RRRD(const HChar *(*irgen)(UChar r1, IRTemp op2addr), if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) { if (irgen == s390_irgen_BIC) - s390_disasm(ENC2(XMNM, SDXB), S390_XMNM_BIC, r1, dh2, dl2, x2, b2); + S390_DISASM(XMNM(mnm, bic_disasm), MASK(r1), SDXB(dh2, dl2, x2, b2)); else - s390_disasm(ENC3(MNM, GPR, SDXB), mnm, r1, dh2, dl2, x2, b2); + S390_DISASM(MNM(mnm), GPR(r1), SDXB(dh2, dl2, x2, b2)); } } @@ -3512,7 +3500,7 @@ s390_format_RXY_FRRD(const HChar *(*irgen)(UChar r1, IRTemp op2addr), mnm = irgen(r1, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, FPR, SDXB), mnm, r1, dh2, dl2, x2, b2); + S390_DISASM(MNM(mnm), FPR(r1), SDXB(dh2, dl2, x2, b2)); } static void @@ -3531,7 +3519,7 @@ s390_format_RXY_URRD(const HChar *(*irgen)(void), mnm = irgen(); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, UINT, SDXB), mnm, r1, dh2, dl2, x2, b2); + S390_DISASM(MNM(mnm), UINT(r1), SDXB(dh2, dl2, x2, b2)); } static void @@ -3547,7 +3535,7 @@ s390_format_S_RD(const HChar *(*irgen)(IRTemp op2addr), mnm = irgen(op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC2(MNM, UDXB), mnm, d2, 0, b2); + S390_DISASM(MNM(mnm), UDXB(d2, 0, b2)); } static void @@ -3559,7 +3547,7 @@ s390_format_S_RD_raw(const HChar *(*irgen)(UChar b2, UShort d2), mnm = irgen(b2, d2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC2(MNM, UDXB), mnm, d2, 0, b2); + S390_DISASM(MNM(mnm), UDXB(d2, 0, b2)); } static void @@ -3575,7 +3563,7 @@ s390_format_SI_URD(const HChar *(*irgen)(UChar i2, IRTemp op1addr), mnm = irgen(i2, op1addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, UDXB, UINT), mnm, d1, 0, b1, i2); + S390_DISASM(MNM(mnm), UDXB(d1, 0, b1), UINT(i2)); } static void @@ -3593,7 +3581,7 @@ s390_format_SIY_URD(const HChar *(*irgen)(UChar i2, IRTemp op1addr), mnm = irgen(i2, op1addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, SDXB, UINT), mnm, dh1, dl1, 0, b1, i2); + S390_DISASM(MNM(mnm), SDXB(dh1, dl1, 0, b1), UINT(i2)); } static void @@ -3611,7 +3599,7 @@ s390_format_SIY_IRD(const HChar *(*irgen)(UChar i2, IRTemp op1addr), mnm = irgen(i2, op1addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, SDXB, INT), mnm, dh1, dl1, 0, b1, (Int)(Char)i2); + S390_DISASM(MNM(mnm), SDXB(dh1, dl1, 0, b1), INT((Int)(Char)i2)); } static void @@ -3630,7 +3618,7 @@ s390_format_SS_L0RDRD(const HChar *(*irgen)(UChar, IRTemp, IRTemp), mnm = irgen(l, op1addr, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, UDLB, UDXB), mnm, d1, l, b1, d2, 0, b2); + S390_DISASM(MNM(mnm), UDLB(d1, l, b1), UDXB(d2, 0, b2)); } static void @@ -3649,7 +3637,7 @@ s390_format_SSE_RDRD(const HChar *(*irgen)(IRTemp, IRTemp), mnm = irgen(op1addr, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC2(UDXB, UDXB), mnm, d1, 0, b1, d2, 0, b2); + S390_DISASM(MNM(mnm), UDXB(d1, 0, b1), UDXB(d2, 0, b2)); } static void @@ -3665,7 +3653,7 @@ s390_format_SIL_RDI(const HChar *(*irgen)(UShort i2, IRTemp op1addr), mnm = irgen(i2, op1addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, UDXB, INT), mnm, d1, 0, b1, (Int)(Short)i2); + S390_DISASM(MNM(mnm), UDXB(d1, 0, b1), INT((Int)(Short)i2)); } static void @@ -3681,7 +3669,7 @@ s390_format_SIL_RDU(const HChar *(*irgen)(UShort i2, IRTemp op1addr), mnm = irgen(i2, op1addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, UDXB, UINT), mnm, d1, 0, b1, i2); + S390_DISASM(MNM(mnm), UDXB(d1, 0, b1), UINT(i2)); } static void @@ -3704,7 +3692,7 @@ s390_format_VRX_VRRD(const HChar *(*irgen)(UChar v1, IRTemp op2addr), mnm = irgen(v1, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, VR, UDXB), mnm, v1, d2, x2, b2); + S390_DISASM(MNM(mnm), VR(v1), UDXB(d2, x2, b2)); } @@ -3728,7 +3716,7 @@ s390_format_VRX_VRRDM(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar m3), mnm = irgen(v1, op2addr, m3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, VR, UDXB), mnm, v1, d2, x2, b2); + S390_DISASM(MNM(mnm), VR(v1), UDXB(d2, x2, b2)); } @@ -3748,7 +3736,7 @@ s390_format_VRR_VV(const HChar *(*irgen)(UChar v1, UChar v2), mnm = irgen(v1, v2); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, VR, VR), mnm, v1, v2); + S390_DISASM(MNM(mnm), VR(v1), VR(v2)); } @@ -3769,10 +3757,12 @@ s390_format_VRR_VVV(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3), mnm = irgen(v1, v2, v3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, VR, VR, VR), mnm, v1, v2, v3); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3)); } +// FIXME: VPDI uses this format but does not have extended mnemonics +// FIXME: all other opcodes have extended mnms static void s390_format_VRR_VVVM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, UChar m4), UChar v1, UChar v2, UChar v3, UChar m4, UChar rxb) @@ -3790,7 +3780,7 @@ s390_format_VRR_VVVM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, UChar m mnm = irgen(v1, v2, v3, m4); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, VR, VR, VR, UINT), mnm, v1, v2, v3, m4); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(m4)); } @@ -3811,7 +3801,7 @@ s390_format_VRR_VVVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, UChar mnm = irgen(v1, v2, v3, m4, m5); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC6(MNM, VR, VR, VR, UINT, UINT), mnm, v1, v2, v3, m4, m5); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(m4), UINT(m5)); } @@ -3833,7 +3823,7 @@ s390_format_VRR_VVVV(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, UChar v mnm = irgen(v1, v2, v3, v4); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, VR, VR, VR, VR), mnm, v1, v2, v3, v4); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), VR(v4)); } @@ -3852,7 +3842,7 @@ s390_format_VRR_VRR(const HChar *(*irgen)(UChar v1, UChar r2, UChar r3), mnm = irgen(v1, r2, r3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, VR, GPR, GPR), mnm, v1, r2, r3); + S390_DISASM(MNM(mnm), VR(v1), GPR(r2), GPR(r3)); } @@ -3872,7 +3862,7 @@ s390_format_VRR_VVM(const HChar *(*irgen)(UChar v1, UChar v2, UChar m3), mnm = irgen(v1, v2, m3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, VR, VR, UINT), mnm, v1, v2, m3); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), UINT(m3)); } @@ -3891,7 +3881,7 @@ s390_format_VRI_VIM(const HChar *(*irgen)(UChar v1, UShort i2, UChar m3), mnm = irgen(v1, i2, m3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, VR, UINT, UINT), mnm, v1, i2, m3); + S390_DISASM(MNM(mnm), VR(v1), UINT(i2), UINT(m3)); } @@ -3911,7 +3901,7 @@ s390_format_VRI_VVIM(const HChar *(*irgen)(UChar v1, UChar v3, UShort i2, UChar mnm = irgen(v1, v3, i2, m4); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, VR, VR, UINT, UINT), mnm, v1, v3, i2, m4); + S390_DISASM(MNM(mnm), VR(v1), VR(v3), UINT(i2), UINT(m4)); } static void @@ -3932,7 +3922,7 @@ s390_format_VRI_VVIMM(const HChar *(*irgen)(UChar v1, UChar v2, UShort i3, mnm = irgen(v1, v2, i3, m4, m5); if (vex_traceflags & VEX_TRACE_FE) - s390_disasm(ENC6(MNM, VR, VR, UINT, UINT, UINT), mnm, v1, v2, i3, m4, m5); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), UINT(i3), UINT(m4), UINT(m5)); } static void @@ -3955,7 +3945,7 @@ s390_format_VRS_RRDVM(const HChar *(*irgen)(UChar r1, IRTemp op2addr, UChar v3, mnm = irgen(r1, op2addr, v3, m4); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, GPR, UDXB, VR, UINT), mnm, r1, d2, 0, b2, v3, m4); + S390_DISASM(MNM(mnm), GPR(r1), UDXB(d2, 0, b2), VR(v3), UINT(m4)); } static void @@ -3977,7 +3967,7 @@ s390_format_VRS_RRDV(const HChar *(*irgen)(UChar v1, UChar r3, IRTemp op2addr), mnm = irgen(v1, r3, op2addr); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, VR, GPR, UDXB), mnm, v1, r3, d2, 0, b2); + S390_DISASM(MNM(mnm), VR(v1), GPR(r3), UDXB(d2, 0, b2)); } @@ -4002,7 +3992,7 @@ s390_format_VRS_VRDVM(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar v3, mnm = irgen(v1, op2addr, v3, m4); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, VR, UDXB, VR, UINT), mnm, v1, d2, 0, b2, v3, m4); + S390_DISASM(MNM(mnm), VR(v1), UDXB(d2, 0, b2), VR(v3), UINT(m4)); } @@ -4026,7 +4016,7 @@ s390_format_VRS_VRDV(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar v3), mnm = irgen(v1, op2addr, v3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, VR, UDXB, VR), mnm, v1, d2, 0, b2, v3); + S390_DISASM(MNM(mnm), VR(v1), UDXB(d2, 0, b2), VR(v3)); } @@ -4050,7 +4040,7 @@ s390_format_VRS_VRRDM(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar r3, mnm = irgen(v1, op2addr, r3, m4); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, VR, GPR, UDXB, UINT), mnm, v1, r3, d2, 0, b2, m4); + S390_DISASM(MNM(mnm), VR(v1), GPR(r3), UDXB(d2, 0, b2), UINT(m4)); } @@ -4073,7 +4063,7 @@ s390_format_VRS_VRRD(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar r3), mnm = irgen(v1, op2addr, r3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, VR, GPR, UDXB), mnm, v1, r3, d2, 0, b2); + S390_DISASM(MNM(mnm), VR(v1), GPR(r3), UDXB(d2, 0, b2)); } @@ -4107,7 +4097,7 @@ s390_format_VRV_VVRDMT(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar m3) mnm = irgen(v1, op2addr, m3); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC4(MNM, VR, UDVB, UINT), mnm, v1, d2, v2, b2, m3); + S390_DISASM(MNM(mnm), VR(v1), UDVB(d2, v2, b2), UINT(m3)); } @@ -4131,8 +4121,7 @@ s390_format_VRR_VVVVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, mnm = irgen(v1, v2, v3, v4, m5, m6); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC7(MNM, VR, VR, VR, VR, UINT, UINT), - mnm, v1, v2, v3, v4, m5, m6); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), VR(v4), UINT(m5), UINT(m6)); } @@ -4153,7 +4142,7 @@ s390_format_VRR_VVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar m3, mnm = irgen(v1, v2, m3, m5); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, VR, VR, UINT, UINT), mnm, v1, v2, m3, m5); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), UINT(m3), UINT(m5)); } @@ -4176,7 +4165,7 @@ s390_format_VRId_VVVIM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, mnm = irgen(v1, v2, v3, i4, m5); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC6(MNM, VR, VR, VR, UINT, UINT), mnm, v1, v2, v3, i4, m5); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(i4), UINT(m5)); } @@ -4198,7 +4187,7 @@ s390_format_VRId_VVVI(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, mnm = irgen(v1, v2, v3, i4); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC5(MNM, VR, VR, VR, UINT), mnm, v1, v2, v3, i4); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(i4)); } @@ -4222,7 +4211,7 @@ s390_format_VRRd_VVVVM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, mnm = irgen(v1, v2, v3, v4, m5); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC6(MNM, VR, VR, VR, VR, UINT), mnm, v1, v2, v3, v4, m5); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), VR(v4), UINT(m5)); } @@ -4244,7 +4233,7 @@ s390_format_VRRa_VVMMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar m3, mnm = irgen(v1, v2, m3, m4, m5); if (vex_traceflags & VEX_TRACE_FE) - s390_disasm(ENC6(MNM, VR, VR, UINT, UINT, UINT), mnm, v1, v2, m3, m4, m5); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), UINT(m3), UINT(m4), UINT(m5)); } static void @@ -4266,7 +4255,7 @@ s390_format_VRRa_VVVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, mnm = irgen(v1, v2, v3, m4, m5); if (vex_traceflags & VEX_TRACE_FE) - s390_disasm(ENC6(MNM, VR, VR, VR, UINT, UINT), mnm, v1, v2, v3, m4, m5); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(m4), UINT(m5)); } static void @@ -4286,7 +4275,7 @@ s390_format_VRRa_VVMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar m3, mnm = irgen(v1, v2, m3, m4); if (vex_traceflags & VEX_TRACE_FE) - s390_disasm(ENC5(MNM, VR, VR, UINT, UINT), mnm, v1, v2, m3, m4); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), UINT(m3), UINT(m4)); } static void @@ -4308,8 +4297,7 @@ s390_format_VRRa_VVVMMM(const HChar *(*irgen)(UChar v1, UChar v2, UChar v3, mnm = irgen(v1, v2, v3, m4, m5, m6); if (vex_traceflags & VEX_TRACE_FE) - s390_disasm(ENC6(MNM, VR, VR, VR, UINT, UINT), - mnm, v1, v2, v3, m4, m5, m6); + S390_DISASM(MNM(mnm), VR(v1), VR(v2), VR(v3), UINT(m4), UINT(m5), UINT(m6)); } static void @@ -4332,7 +4320,7 @@ s390_format_VSI_URDV(const HChar *(*irgen)(UChar v1, IRTemp op2addr, UChar i3), mnm = irgen(v1, op2addr, i3); if (vex_traceflags & VEX_TRACE_FE) - s390_disasm(ENC4(MNM, VR, UDXB, UINT), mnm, v1, d2, 0, b2, i3); + S390_DISASM(MNM(mnm), VR(v1), UDXB(d2, 0, b2), UINT(i3)); } /*------------------------------------------------------------*/ @@ -5424,47 +5412,47 @@ s390_irgen_BAS(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_BCR(UChar r1, UChar r2) +s390_irgen_BCR(UChar m1, UChar r2) { IRTemp cond = newTemp(Ity_I32); - if (r2 == 0 && (r1 >= 14)) { /* serialization */ + if (r2 == 0 && (m1 >= 14)) { /* serialization */ stmt(IRStmt_MBE(Imbe_Fence)); } - if ((r2 == 0) || (r1 == 0)) { + if ((r2 == 0) || (m1 == 0)) { } else { - if (r1 == 15) { + if (m1 == 15) { return_from_function(get_gpr_dw0(r2)); } else { - assign(cond, s390_call_calculate_cond(r1)); + assign(cond, s390_call_calculate_cond(m1)); if_condition_goto_computed(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)), get_gpr_dw0(r2)); } } if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC2(XMNM, GPR), S390_XMNM_BCR, r1, r2); + S390_DISASM(XMNM("bcr", bcr_disasm), MASK(m1), GPR(r2)); return "bcr"; } static const HChar * -s390_irgen_BC(UChar r1, UChar x2, UChar b2, UShort d2, IRTemp op2addr) +s390_irgen_BC(UChar m1, UChar x2, UChar b2, UShort d2, IRTemp op2addr) { IRTemp cond = newTemp(Ity_I32); - if (r1 == 0) { + if (m1 == 0) { } else { - if (r1 == 15) { + if (m1 == 15) { always_goto(mkexpr(op2addr)); } else { - assign(cond, s390_call_calculate_cond(r1)); + assign(cond, s390_call_calculate_cond(m1)); if_condition_goto_computed(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)), mkexpr(op2addr)); } } if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC2(XMNM, UDXB), S390_XMNM_BC, r1, d2, x2, b2); + S390_DISASM(XMNM("bc", bc_disasm), MASK(m1), UDXB(d2, x2, b2)); return "bc"; } @@ -5602,44 +5590,44 @@ s390_irgen_BRASL(UChar r1, UInt i2) } static const HChar * -s390_irgen_BRC(UChar r1, UShort i2) +s390_irgen_BRC(UChar m1, UShort i2) { IRTemp cond = newTemp(Ity_I32); - if (r1 == 0) { + if (m1 == 0) { } else { - if (r1 == 15) { + if (m1 == 15) { always_goto_and_chase(addr_relative(i2)); } else { - assign(cond, s390_call_calculate_cond(r1)); + assign(cond, s390_call_calculate_cond(m1)); if_condition_goto(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)), addr_relative(i2)); } } if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC2(XMNM, PCREL), S390_XMNM_BRC, r1, (Int)(Short)i2); + S390_DISASM(XMNM("brc", brc_disasm), MASK(m1), PCREL((Int)(Short)i2)); return "brc"; } static const HChar * -s390_irgen_BRCL(UChar r1, UInt i2) +s390_irgen_BRCL(UChar m1, UInt i2) { IRTemp cond = newTemp(Ity_I32); - if (r1 == 0) { + if (m1 == 0) { } else { - if (r1 == 15) { + if (m1 == 15) { always_goto_and_chase(addr_rel_long(i2)); } else { - assign(cond, s390_call_calculate_cond(r1)); + assign(cond, s390_call_calculate_cond(m1)); if_condition_goto(binop(Iop_CmpNE32, mkexpr(cond), mkU32(0)), addr_rel_long(i2)); } } if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC2(XMNM, PCREL), S390_XMNM_BRCL, r1, i2); + S390_DISASM(XMNM("brcl", brcl_disasm), MASK(m1), PCREL(i2)); return "brcl"; } @@ -7170,7 +7158,7 @@ s390_irgen_CPYA(UChar r1, UChar r2) { put_ar_w0(r1, get_ar_w0(r2)); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, AR, AR), "cpya", r1, r2); + S390_DISASM(MNM("cpya"), AR(r1), AR(r2)); return "cpya"; } @@ -7356,7 +7344,7 @@ s390_irgen_EAR(UChar r1, UChar r2) { put_gpr_w1(r1, get_ar_w0(r2)); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, GPR, AR), "ear", r1, r2); + S390_DISASM(MNM("ear"), GPR(r1), AR(r2)); return "ear"; } @@ -7658,7 +7646,7 @@ s390_irgen_LARL(UChar r1, UInt i2) return "larl"; } -/* The IR representation of LAA and friends is an approximation of what +/* The IR representation of LAA and friends is an approximation of what happens natively. Essentially a loop containing a compare-and-swap is constructed which will iterate until the CAS succeeds. As a consequence, instrumenters may see more memory accesses than happen natively. See also @@ -9826,7 +9814,7 @@ s390_irgen_SAR(UChar r1, UChar r2) { put_ar_w0(r1, get_gpr_w1(r2)); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, AR, GPR), "sar", r1, r2); + S390_DISASM(MNM("sar"), AR(r1), GPR(r2)); return "sar"; } @@ -13726,7 +13714,7 @@ s390_irgen_XC_sameloc(UChar length, UChar b, UShort d) s390_cc_set_val(0); if (UNLIKELY(vex_traceflags & VEX_TRACE_FE)) - s390_disasm(ENC3(MNM, UDLB, UDXB), "xc", d, length, b, d, 0, b); + S390_DISASM(MNM("xc"), UDLB(d, length, b), UDXB(d, 0, b)); } static const HChar * @@ -20988,10 +20976,10 @@ s390_decode_4byte_and_irgen(const UChar *bytes) RRF2_r2(ovl)); goto ok; case 0xb960: s390_format_RRF_U0RR(s390_irgen_CGRT, RRF2_m3(ovl), RRF2_r1(ovl), RRF2_r2(ovl), - S390_XMNM_CAB); goto ok; + cabt_disasm); goto ok; case 0xb961: s390_format_RRF_U0RR(s390_irgen_CLGRT, RRF2_m3(ovl), RRF2_r1(ovl), RRF2_r2(ovl), - S390_XMNM_CAB); goto ok; + cabt_disasm); goto ok; case 0xb964: s390_format_RRF_R0RR2(s390_irgen_NNGRK, RRF4_r3(ovl), RRF4_r1(ovl), RRF4_r2(ovl)); goto ok; case 0xb965: s390_format_RRF_R0RR2(s390_irgen_OCGRK, RRF4_r3(ovl), @@ -21006,10 +20994,10 @@ s390_decode_4byte_and_irgen(const UChar *bytes) case 0xb96d: /* BDEPG */ goto unimplemented; case 0xb972: s390_format_RRF_U0RR(s390_irgen_CRT, RRF2_m3(ovl), RRF2_r1(ovl), RRF2_r2(ovl), - S390_XMNM_CAB); goto ok; + cabt_disasm); goto ok; case 0xb973: s390_format_RRF_U0RR(s390_irgen_CLRT, RRF2_m3(ovl), RRF2_r1(ovl), RRF2_r2(ovl), - S390_XMNM_CAB); goto ok; + cabt_disasm); goto ok; case 0xb974: s390_format_RRF_R0RR2(s390_irgen_NNRK, RRF4_r3(ovl), RRF4_r1(ovl), RRF4_r2(ovl)); goto ok; case 0xb975: s390_format_RRF_R0RR2(s390_irgen_OCRK, RRF4_r3(ovl), @@ -21124,12 +21112,12 @@ s390_decode_4byte_and_irgen(const UChar *bytes) RRE_r2(ovl)); goto ok; case 0xb9e0: s390_format_RRF_U0RR(s390_irgen_LOCFHR, RRF3_r3(ovl), RRF3_r1(ovl), RRF3_r2(ovl), - S390_XMNM_CLS); goto ok; + cls_disasm); goto ok; case 0xb9e1: s390_format_RRFa_U0RR(s390_irgen_POPCNT, RRF3_r3(ovl), RRF3_r1(ovl), RRF3_r2(ovl)); goto ok; case 0xb9e2: s390_format_RRF_U0RR(s390_irgen_LOCGR, RRF3_r3(ovl), RRF3_r1(ovl), RRF3_r2(ovl), - S390_XMNM_CLS); goto ok; + cls_disasm); goto ok; case 0xb9e3: s390_format_RRF_RURR(s390_irgen_SELGR, RRF4_r3(ovl), RRF4_m4(ovl), RRF4_r1(ovl), RRF4_r2(ovl)); goto ok; @@ -21168,7 +21156,7 @@ s390_decode_4byte_and_irgen(const UChar *bytes) RRF4_r2(ovl)); goto ok; case 0xb9f2: s390_format_RRF_U0RR(s390_irgen_LOCR, RRF3_r3(ovl), RRF3_r1(ovl), RRF3_r2(ovl), - S390_XMNM_CLS); goto ok; + cls_disasm); goto ok; case 0xb9f4: s390_format_RRF_R0RR2(s390_irgen_NRK, RRF4_r3(ovl), RRF4_r1(ovl), RRF4_r2(ovl)); goto ok; diff --git a/VEX/priv/host_s390_defs.c b/VEX/priv/host_s390_defs.c index 583f116c3c..f78abd8fea 100644 --- a/VEX/priv/host_s390_defs.c +++ b/VEX/priv/host_s390_defs.c @@ -1995,7 +1995,7 @@ static UChar * s390_emit_AR(UChar *p, UChar r1, UChar r2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, GPR), "ar", r1, r2); + S390_DISASM(MNM("ar"), GPR(r1), GPR(r2)); return emit_RR(p, 0x1a00, r1, r2); } @@ -2005,7 +2005,7 @@ static UChar * s390_emit_AGR(UChar *p, UChar r1, UChar r2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, GPR), "agr", r1, r2); + S390_DISASM(MNM("agr"), GPR(r1), GPR(r2)); return emit_RRE(p, 0xb9080000, r1, r2); } @@ -2015,7 +2015,7 @@ static UChar * s390_emit_A(UChar *p, UChar r1, UChar x2, UChar b2, UShort d2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, UDXB), "a", r1, d2, x2, b2); + S390_DISASM(MNM("a"), GPR(r1), UDXB(d2, x2, b2)); return emit_RX(p, 0x5a000000, r1, x2, b2, d2); } @@ -2025,7 +2025,7 @@ static UChar * s390_emit_AY(UChar *p, UChar r1, UChar x2, UChar b2, UShort dl2, UChar dh2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, SDXB), "ay", r1, dh2, dl2, x2, b2); + S390_DISASM(MNM("ay"), GPR(r1), SDXB(dh2, dl2, x2, b2)); return emit_RXY(p, 0xe3000000005aULL, r1, x2, b2, dl2, dh2); } @@ -2035,7 +2035,7 @@ static UChar * s390_emit_AG(UChar *p, UChar r1, UChar x2, UChar b2, UShort dl2, UChar dh2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, SDXB), "ag", r1, dh2, dl2, x2, b2); + S390_DISASM(MNM("ag"), GPR(r1), SDXB(dh2, dl2, x2, b2)); return emit_RXY(p, 0xe30000000008ULL, r1, x2, b2, dl2, dh2); } @@ -2047,7 +2047,7 @@ s390_emit_AFI(UChar *p, UChar r1, UInt i2) vassert(s390_host_has_eimm); if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, INT), "afi", r1, i2); + S390_DISASM(MNM("afi"), GPR(r1), INT(i2)); return emit_RIL(p, 0xc20900000000ULL, r1, i2); } @@ -2059,7 +2059,7 @@ s390_emit_AGFI(UChar *p, UChar r1, UInt i2) vassert(s390_host_has_eimm); if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, INT), "agfi", r1, i2); + S390_DISASM(MNM("agfi"), GPR(r1), INT(i2)); return emit_RIL(p, 0xc20800000000ULL, r1, i2); } @@ -2069,7 +2069,7 @@ static UChar * s390_emit_AH(UChar *p, UChar r1, UChar x2, UChar b2, UShort d2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, UDXB), "ah", r1, d2, x2, b2); + S390_DISASM(MNM("ah"), GPR(r1), UDXB(d2, x2, b2)); return emit_RX(p, 0x4a000000, r1, x2, b2, d2); } @@ -2079,7 +2079,7 @@ static UChar * s390_emit_AHY(UChar *p, UChar r1, UChar x2, UChar b2, UShort dl2, UChar dh2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, SDXB), "ahy", r1, dh2, dl2, x2, b2); + S390_DISASM(MNM("ahy"), GPR(r1), SDXB(dh2, dl2, x2, b2)); return emit_RXY(p, 0xe3000000007aULL, r1, x2, b2, dl2, dh2); } @@ -2089,7 +2089,7 @@ static UChar * s390_emit_AHI(UChar *p, UChar r1, UShort i2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, INT), "ahi", r1, (Int)(Short)i2); + S390_DISASM(MNM("ahi"), GPR(r1), INT((Int)(Short)i2)); return emit_RI(p, 0xa70a0000, r1, i2); } @@ -2099,7 +2099,7 @@ static UChar * s390_emit_AGHI(UChar *p, UChar r1, UShort i2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, INT), "aghi", r1, (Int)(Short)i2); + S390_DISASM(MNM("aghi"), GPR(r1), INT((Int)(Short)i2)); return emit_RI(p, 0xa70b0000, r1, i2); } @@ -2111,7 +2111,7 @@ s390_emit_AGSI(UChar *p, UChar i2, UChar b1, UShort dl1, UChar dh1) vassert(s390_host_has_gie); if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, SDXB, INT), "agsi", dh1, dl1, 0, b1, (Int)(Char)i2); + S390_DISASM(MNM("agsi"), SDXB(dh1, dl1, 0, b1), INT((Int)(Char)i2)); return emit_SIY(p, 0xeb000000007aULL, i2, b1, dl1, dh1); } @@ -2123,7 +2123,7 @@ s390_emit_ASI(UChar *p, UChar i2, UChar b1, UShort dl1, UChar dh1) vassert(s390_host_has_gie); if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, SDXB, INT), "asi", dh1, dl1, 0, b1, (Int)(Char)i2); + S390_DISASM(MNM("asi"), SDXB(dh1, dl1, 0, b1), INT((Int)(Char)i2)); return emit_SIY(p, 0xeb000000006aULL, i2, b1, dl1, dh1); } @@ -2133,7 +2133,7 @@ static UChar * s390_emit_NR(UChar *p, UChar r1, UChar r2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, GPR), "nr", r1, r2); + S390_DISASM(MNM("nr"), GPR(r1), GPR(r2)); return emit_RR(p, 0x1400, r1, r2); } @@ -2143,7 +2143,7 @@ static UChar * s390_emit_NGR(UChar *p, UChar r1, UChar r2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, GPR), "ngr", r1, r2); + S390_DISASM(MNM("ngr"), GPR(r1), GPR(r2)); return emit_RRE(p, 0xb9800000, r1, r2); } @@ -2153,7 +2153,7 @@ static UChar * s390_emit_N(UChar *p, UChar r1, UChar x2, UChar b2, UShort d2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, UDXB), "n", r1, d2, x2, b2); + S390_DISASM(MNM("n"), GPR(r1), UDXB(d2, x2, b2)); return emit_RX(p, 0x54000000, r1, x2, b2, d2); } @@ -2163,7 +2163,7 @@ static UChar * s390_emit_NY(UChar *p, UChar r1, UChar x2, UChar b2, UShort dl2, UChar dh2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, SDXB), "ny", r1, dh2, dl2, x2, b2); + S390_DISASM(MNM("ny"), GPR(r1), SDXB(dh2, dl2, x2, b2)); return emit_RXY(p, 0xe30000000054ULL, r1, x2, b2, dl2, dh2); } @@ -2173,7 +2173,7 @@ static UChar * s390_emit_NG(UChar *p, UChar r1, UChar x2, UChar b2, UShort dl2, UChar dh2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, SDXB), "ng", r1, dh2, dl2, x2, b2); + S390_DISASM(MNM("ng"), GPR(r1), SDXB(dh2, dl2, x2, b2)); return emit_RXY(p, 0xe30000000080ULL, r1, x2, b2, dl2, dh2); } @@ -2185,7 +2185,7 @@ s390_emit_NIHF(UChar *p, UChar r1, UInt i2) vassert(s390_host_has_eimm); if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, UINT), "nihf", r1, i2); + S390_DISASM(MNM("nihf"), GPR(r1), UINT(i2)); return emit_RIL(p, 0xc00a00000000ULL, r1, i2); } @@ -2197,7 +2197,7 @@ s390_emit_NILF(UChar *p, UChar r1, UInt i2) vassert(s390_host_has_eimm); if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, UINT), "nilf", r1, i2); + S390_DISASM(MNM("nilf"), GPR(r1), UINT(i2)); return emit_RIL(p, 0xc00b00000000ULL, r1, i2); } @@ -2207,7 +2207,7 @@ static UChar * s390_emit_NILL(UChar *p, UChar r1, UShort i2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, UINT), "nill", r1, i2); + S390_DISASM(MNM("nill"), GPR(r1), UINT(i2)); return emit_RI(p, 0xa5070000, r1, i2); } @@ -2217,7 +2217,7 @@ static UChar * s390_emit_TM(UChar *p, UChar i2, UChar b1, UShort d1) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, UDXB, INT), "tm", d1, 0, b1, i2); + S390_DISASM(MNM("tm"), UDXB(d1, 0, b1), UINT(i2)); return emit_SI(p, 0x91000000, i2, b1, d1); } @@ -2227,7 +2227,7 @@ static UChar * s390_emit_TMY(UChar *p, UChar i2, UChar b1, UShort dl1, UChar dh1) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, SDXB, INT), "tmy", dh1, dl1, 0, b1, (Int)(Char)i2); + S390_DISASM(MNM("tmy"), SDXB(dh1, dl1, 0, b1), UINT(i2)); return emit_SIY(p, 0xeb0000000051ULL, i2, b1, dl1, dh1); } @@ -2237,7 +2237,7 @@ static UChar * s390_emit_TMLL(UChar *p, UChar r1, UShort i2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, UINT), "tmll", r1, i2); + S390_DISASM(MNM("tmll"), GPR(r1), UINT(i2)); return emit_RI(p, 0xa7010000, r1, i2); } @@ -2247,39 +2247,39 @@ static UChar * s390_emit_BASR(UChar *p, UChar r1, UChar r2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, GPR), "basr", r1, r2); + S390_DISASM(MNM("basr"), GPR(r1), GPR(r2)); return emit_RR(p, 0x0d00, r1, r2); } static UChar * -s390_emit_BCR(UChar *p, UChar r1, UChar r2) +s390_emit_BCR(UChar *p, UChar m1, UChar r2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC2(XMNM, GPR), S390_XMNM_BCR, r1, r2); + S390_DISASM(XMNM("bcr", bcr_disasm), MASK(m1), GPR(r2)); - return emit_RR(p, 0x0700, r1, r2); + return emit_RR(p, 0x0700, m1, r2); } static UChar * -s390_emit_BRC(UChar *p, UChar r1, UShort i2) +s390_emit_BRC(UChar *p, UChar m1, UShort i2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC2(XMNM, PCREL), S390_XMNM_BRC, r1, (Int)(Short)i2); + S390_DISASM(XMNM("brc", brc_disasm), MASK(m1), PCREL((Int)(Short)i2)); - return emit_RI(p, 0xa7040000, r1, i2); + return emit_RI(p, 0xa7040000, m1, i2); } static UChar * -s390_emit_BRCL(UChar *p, UChar r1, ULong i2) +s390_emit_BRCL(UChar *p, UChar m1, ULong i2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC2(XMNM, PCREL), S390_XMNM_BRCL, r1, i2); + S390_DISASM(XMNM("brcl", brcl_disasm), MASK(m1), PCREL(i2)); - return emit_RIL(p, 0xc00400000000ULL, r1, i2); + return emit_RIL(p, 0xc00400000000ULL, m1, i2); } @@ -2287,7 +2287,7 @@ static UChar * s390_emit_CR(UChar *p, UChar r1, UChar r2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, GPR), "cr", r1, r2); + S390_DISASM(MNM("cr"), GPR(r1), GPR(r2)); return emit_RR(p, 0x1900, r1, r2); } @@ -2297,7 +2297,7 @@ static UChar * s390_emit_CGR(UChar *p, UChar r1, UChar r2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, GPR), "cgr", r1, r2); + S390_DISASM(MNM("cgr"), GPR(r1), GPR(r2)); return emit_RRE(p, 0xb9200000, r1, r2); } @@ -2307,7 +2307,7 @@ static UChar * s390_emit_C(UChar *p, UChar r1, UChar x2, UChar b2, UShort d2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, UDXB), "c", r1, d2, x2, b2); + S390_DISASM(MNM("c"), GPR(r1), UDXB(d2, x2, b2)); return emit_RX(p, 0x59000000, r1, x2, b2, d2); } @@ -2317,7 +2317,7 @@ static UChar * s390_emit_CY(UChar *p, UChar r1, UChar x2, UChar b2, UShort dl2, UChar dh2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, SDXB), "cy", r1, dh2, dl2, x2, b2); + S390_DISASM(MNM("cy"), GPR(r1), SDXB(dh2, dl2, x2, b2)); return emit_RXY(p, 0xe30000000059ULL, r1, x2, b2, dl2, dh2); } @@ -2327,7 +2327,7 @@ static UChar * s390_emit_CG(UChar *p, UChar r1, UChar x2, UChar b2, UShort dl2, UChar dh2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, SDXB), "cg", r1, dh2, dl2, x2, b2); + S390_DISASM(MNM("cg"), GPR(r1), SDXB(dh2, dl2, x2, b2)); return emit_RXY(p, 0xe30000000020ULL, r1, x2, b2, dl2, dh2); } @@ -2339,7 +2339,7 @@ s390_emit_CFI(UChar *p, UChar r1, UInt i2) vassert(s390_host_has_eimm); if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, INT), "cfi", r1, i2); + S390_DISASM(MNM("cfi"), GPR(r1), INT(i2)); return emit_RIL(p, 0xc20d00000000ULL, r1, i2); } @@ -2351,7 +2351,7 @@ s390_emit_CGFI(UChar *p, UChar r1, UInt i2) vassert(s390_host_has_eimm); if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, INT), "cgfi", r1, i2); + S390_DISASM(MNM("cgfi"), GPR(r1), INT(i2)); return emit_RIL(p, 0xc20c00000000ULL, r1, i2); } @@ -2361,7 +2361,7 @@ static UChar * s390_emit_CS(UChar *p, UChar r1, UChar r3, UChar b2, UShort d2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC4(MNM, GPR, GPR, UDXB), "cs", r1, r3, d2, 0, b2); + S390_DISASM(MNM("cs"), GPR(r1), GPR(r3), UDXB(d2, 0, b2)); return emit_RS(p, 0xba000000, r1, r3, b2, d2); } @@ -2371,7 +2371,7 @@ static UChar * s390_emit_CSY(UChar *p, UChar r1, UChar r3, UChar b2, UShort dl2, UChar dh2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC4(MNM, GPR, GPR, SDXB), "csy", r1, r3, dh2, dl2, 0, b2); + S390_DISASM(MNM("csy"), GPR(r1), GPR(r3), SDXB(dh2, dl2, 0, b2)); return emit_RSY(p, 0xeb0000000014ULL, r1, r3, b2, dl2, dh2); } @@ -2381,7 +2381,7 @@ static UChar * s390_emit_CSG(UChar *p, UChar r1, UChar r3, UChar b2, UShort dl2, UChar dh2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC4(MNM, GPR, GPR, SDXB), "csg", r1, r3, dh2, dl2, 0, b2); + S390_DISASM(MNM("csg"), GPR(r1), GPR(r3), SDXB(dh2, dl2, 0, b2)); return emit_RSY(p, 0xeb0000000030ULL, r1, r3, b2, dl2, dh2); } @@ -2391,7 +2391,7 @@ static UChar * s390_emit_CDS(UChar *p, UChar r1, UChar r3, UChar b2, UShort d2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC4(MNM, GPR, GPR, UDXB), "cds", r1, r3, d2, 0, b2); + S390_DISASM(MNM("cds"), GPR(r1), GPR(r3), UDXB(d2, 0, b2)); return emit_RS(p, 0xbb000000, r1, r3, b2, d2); } @@ -2401,7 +2401,7 @@ static UChar * s390_emit_CDSY(UChar *p, UChar r1, UChar r3, UChar b2, UShort dl2, UChar dh2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC4(MNM, GPR, GPR, SDXB), "cdsy", r1, r3, dh2, dl2, 0, b2); + S390_DISASM(MNM("cdsy"), GPR(r1), GPR(r3), SDXB(dh2, dl2, 0, b2)); return emit_RSY(p, 0xeb0000000031ULL, r1, r3, b2, dl2, dh2); } @@ -2411,7 +2411,7 @@ static UChar * s390_emit_CDSG(UChar *p, UChar r1, UChar r3, UChar b2, UShort dl2, UChar dh2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC4(MNM, GPR, GPR, SDXB), "cdsg", r1, r3, dh2, dl2, 0, b2); + S390_DISASM(MNM("cdsg"), GPR(r1), GPR(r3), SDXB(dh2, dl2, 0, b2)); return emit_RSY(p, 0xeb000000003eULL, r1, r3, b2, dl2, dh2); } @@ -2421,7 +2421,7 @@ static UChar * s390_emit_CLR(UChar *p, UChar r1, UChar r2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, GPR), "clr", r1, r2); + S390_DISASM(MNM("clr"), GPR(r1), GPR(r2)); return emit_RR(p, 0x1500, r1, r2); } @@ -2431,7 +2431,7 @@ static UChar * s390_emit_CLGR(UChar *p, UChar r1, UChar r2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, GPR), "clgr", r1, r2); + S390_DISASM(MNM("clgr"), GPR(r1), GPR(r2)); return emit_RRE(p, 0xb9210000, r1, r2); } @@ -2441,7 +2441,7 @@ static UChar * s390_emit_CL(UChar *p, UChar r1, UChar x2, UChar b2, UShort d2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, UDXB), "cl", r1, d2, x2, b2); + S390_DISASM(MNM("cl"), GPR(r1), UDXB(d2, x2, b2)); return emit_RX(p, 0x55000000, r1, x2, b2, d2); } @@ -2451,7 +2451,7 @@ static UChar * s390_emit_CLY(UChar *p, UChar r1, UChar x2, UChar b2, UShort dl2, UChar dh2) { if (UNLIKELY(vex_traceflags & VEX_TRACE_ASM)) - s390_disasm(ENC3(MNM, GPR, SDXB), "cly", r1, dh2, dl2, x2, b2); + S390_DISASM(MNM("cly"), GPR(r1), SDXB(dh2, dl2, x2,... [truncated message content] |
From: Florian K. <fk...@so...> - 2025-03-15 22:30:11
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=17ac4a379dfee9b06a7988d2268a9614ca5cd385 commit 17ac4a379dfee9b06a7988d2268a9614ca5cd385 Author: Florian Krohm <fl...@ei...> Date: Sat Mar 15 22:29:30 2025 +0000 s390x: misc. fixes pertaining to vector insns This patch is fall-out from working on fixing the disassembly for the vector insns. Specifically: 1) replace vassert with s390_insn_assert where appropriate 2) add missing s390_insn_asserts (many) 3) remove incorrect s390_insn_asserts (few) 4) check availability of vector opcodes based on hardware capabilities and issue an emulation failure if opcode is not available 5) fix a typo in a mnemonic: vfspo -> vfpso 6) inline function s390_vr_get_n_elem Part of fixing https://bugs.kde.org/show_bug.cgi?id=495817 Diff: --- VEX/priv/guest_s390_toIR.c | 533 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 429 insertions(+), 104 deletions(-) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 9fddd95495..b5816dd1f8 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -1983,11 +1983,9 @@ get_vr_b15(UInt archreg) static IRType s390_vr_get_type(const UChar m) { + vassert(m <= 4); + static const IRType results[] = {Ity_I8, Ity_I16, Ity_I32, Ity_I64, Ity_V128}; - if (m > 4) { - vex_printf("s390_vr_get_type: m=%x\n", m); - vpanic("s390_vr_get_type: reserved m value"); - } return results[m]; } @@ -1996,20 +1994,10 @@ s390_vr_get_type(const UChar m) static IRType s390_vr_get_ftype(const UChar m) { - static const IRType results[] = {Ity_F32, Ity_F64, Ity_F128}; - if (m >= 2 && m <= 4) - return results[m - 2]; - return Ity_INVALID; -} + vassert(m >= 2 && m <= 4); -/* Determine number of elements from instruction's floating-point format - field */ -static UChar -s390_vr_get_n_elem(const UChar m) -{ - if (m >= 2 && m <= 4) - return 1 << (4 - m); - return 0; + static const IRType results[] = {Ity_F32, Ity_F64, Ity_F128}; + return results[m - 2]; } /* Determine if Condition Code Set (CS) flag is set in m field */ @@ -9344,6 +9332,11 @@ s390_call_pfpo_helper(IRExpr *gr0) static const HChar * s390_irgen_PFPO(void) { + if (! s390_host_has_pfpo) { + emulation_failure(EmFail_S390X_pfpo); + return "pfpo"; + } + IRTemp gr0 = newTemp(Ity_I32); /* word 1 [32:63] of GR 0 */ IRTemp test_bit = newTemp(Ity_I32); /* bit 32 of GR 0 - test validity */ IRTemp fn = newTemp(Ity_I32); /* [33:55] of GR 0 - function code */ @@ -9386,11 +9379,6 @@ s390_irgen_PFPO(void) IRTemp dst18 = newTemp(Ity_F128); IRExpr *irrm; - if (! s390_host_has_pfpo) { - emulation_failure(EmFail_S390X_pfpo); - goto done; - } - assign(gr0, get_gpr_w1(0)); /* get function code */ assign(fn, binop(Iop_And32, binop(Iop_Shr32, mkexpr(gr0), mkU8(8)), @@ -9568,7 +9556,6 @@ s390_irgen_PFPO(void) s390_cc_thunk_put1d128Z(S390_CC_OP_PFPO_128, src18, gr0); next_insn_if(binop(Iop_CmpEQ32, mkexpr(fn), mkU32(S390_PFPO_D128_TO_F128))); - done: return "pfpo"; } @@ -16334,6 +16321,8 @@ s390_irgen_VST(UChar v1, IRTemp op2addr) static const HChar * s390_irgen_VLREP(UChar v1, IRTemp op2addr, UChar m3) { + s390_insn_assert("vlrep", m3 <= 3); + IRType o2type = s390_vr_get_type(m3); IRExpr* o2 = load(o2type, mkexpr(op2addr)); s390_vr_fill(v1, o2); @@ -16343,6 +16332,7 @@ s390_irgen_VLREP(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VLEB(UChar v1, IRTemp op2addr, UChar m3) { + /* Specification exception cannot occur. */ IRExpr* o2 = load(Ity_I8, mkexpr(op2addr)); put_vr(v1, Ity_I8, m3, o2); @@ -16352,6 +16342,8 @@ s390_irgen_VLEB(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VLEH(UChar v1, IRTemp op2addr, UChar m3) { + s390_insn_assert("vleh", m3 < 8); + IRExpr* o2 = load(Ity_I16, mkexpr(op2addr)); put_vr(v1, Ity_I16, m3, o2); @@ -16361,6 +16353,8 @@ s390_irgen_VLEH(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VLEF(UChar v1, IRTemp op2addr, UChar m3) { + s390_insn_assert("vlef", m3 < 4); + IRExpr* o2 = load(Ity_I32, mkexpr(op2addr)); put_vr(v1, Ity_I32, m3, o2); @@ -16370,6 +16364,8 @@ s390_irgen_VLEF(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VLEG(UChar v1, IRTemp op2addr, UChar m3) { + s390_insn_assert("vleg", m3 < 2); + IRExpr* o2 = load(Ity_I64, mkexpr(op2addr)); put_vr(v1, Ity_I64, m3, o2); @@ -16379,6 +16375,7 @@ s390_irgen_VLEG(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VLEIB(UChar v1, UShort i2, UChar m3) { + /* Specification exception cannot occur. */ IRExpr* o2 = unop(Iop_16to8, mkU16(i2)); put_vr(v1, Ity_I8, m3, o2); @@ -16388,6 +16385,8 @@ s390_irgen_VLEIB(UChar v1, UShort i2, UChar m3) static const HChar * s390_irgen_VLEIH(UChar v1, UShort i2, UChar m3) { + s390_insn_assert("vleih", m3 < 8); + IRExpr* o2 = mkU16(i2); put_vr(v1, Ity_I16, m3, o2); @@ -16397,6 +16396,8 @@ s390_irgen_VLEIH(UChar v1, UShort i2, UChar m3) static const HChar * s390_irgen_VLEIF(UChar v1, UShort i2, UChar m3) { + s390_insn_assert("vleif", m3 < 4); + IRExpr* o2 = unop(Iop_16Sto32, mkU16(i2)); put_vr(v1, Ity_I32, m3, o2); @@ -16406,6 +16407,8 @@ s390_irgen_VLEIF(UChar v1, UShort i2, UChar m3) static const HChar * s390_irgen_VLEIG(UChar v1, UShort i2, UChar m3) { + s390_insn_assert("vleig", m3 < 2); + IRExpr* o2 = unop(Iop_16Sto64, mkU16(i2)); put_vr(v1, Ity_I64, m3, o2); @@ -16415,6 +16418,8 @@ s390_irgen_VLEIG(UChar v1, UShort i2, UChar m3) static const HChar * s390_irgen_VLGV(UChar r1, IRTemp op2addr, UChar v3, UChar m4) { + s390_insn_assert("vlgv", m4 <= 3); + IRType o2type = s390_vr_get_type(m4); IRExpr* index = unop(Iop_64to8, binop(Iop_And64, mkexpr(op2addr), mkU64(0xf))); IRExpr* o2; @@ -16531,6 +16536,8 @@ s390_irgen_VLLEZ(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VGEF(UChar v1, IRTemp op2addr, UChar m3) { + s390_insn_assert("vgef", m3 < 4); + put_vr(v1, Ity_I32, m3, load(Ity_I32, mkexpr(op2addr))); return "vgef"; } @@ -16538,6 +16545,8 @@ s390_irgen_VGEF(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VGEG(UChar v1, IRTemp op2addr, UChar m3) { + s390_insn_assert("vgeg", m3 < 2); + put_vr(v1, Ity_I64, m3, load(Ity_I64, mkexpr(op2addr))); return "vgeg"; } @@ -16545,9 +16554,10 @@ s390_irgen_VGEG(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VLM(UChar v1, IRTemp op2addr, UChar v3) { + s390_insn_assert("vlm", v3 >= v1); + s390_insn_assert("vlm", v3 - v1 <= 16); + IRExpr* current = mkexpr(op2addr); - vassert(v3 >= v1); - vassert(v3 - v1 <= 16); for(UChar vr = v1; vr <= v3; vr++) { IRExpr* next = binop(Iop_Add64, current, mkU64(16)); @@ -16569,6 +16579,8 @@ s390_irgen_VLVGP(UChar v1, UChar r2, UChar r3) static const HChar * s390_irgen_VLVG(UChar v1, IRTemp op2addr, UChar r3, UChar m4) { + s390_insn_assert("vlvg", m4 <= 3); + IRType type = s390_vr_get_type(m4); IRExpr* index = unop(Iop_64to8, mkexpr(op2addr)); IRExpr* vr = get_vr_qw(v1); @@ -16600,9 +16612,10 @@ s390_irgen_VLVG(UChar v1, IRTemp op2addr, UChar r3, UChar m4) static const HChar * s390_irgen_VMRH(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vmrh", m4 <= 3); + const IROp ops[] = { Iop_InterleaveHI8x16, Iop_InterleaveHI16x8, Iop_InterleaveHI32x4, Iop_InterleaveHI64x2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vmrh"; @@ -16611,9 +16624,10 @@ s390_irgen_VMRH(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VMRL(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vmrl", m4 <= 3); + const IROp ops[] = { Iop_InterleaveLO8x16, Iop_InterleaveLO16x8, Iop_InterleaveLO32x4, Iop_InterleaveLO64x2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vmrl"; @@ -16622,10 +16636,11 @@ s390_irgen_VMRL(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VPK(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vpk", m4 >= 1 && m4 <= 3); + const IROp ops[] = { Iop_NarrowBin16to8x16, Iop_NarrowBin32to16x8, Iop_NarrowBin64to32x4 }; Char index = m4 - 1; - vassert((index >= 0) && (index < sizeof(ops) / sizeof(ops[0]))); put_vr_qw(v1, binop(ops[index], get_vr_qw(v2), get_vr_qw(v3))); return "vpk"; } @@ -16642,6 +16657,8 @@ s390_irgen_VPERM(UChar v1, UChar v2, UChar v3, UChar v4) static const HChar * s390_irgen_VSCEF(UChar v1, IRTemp op2addr, UChar m3) { + s390_insn_assert("vscef", m3 < 4); + store(mkexpr(op2addr), get_vr(v1, Ity_I32, m3)); return "vscef"; } @@ -16649,6 +16666,8 @@ s390_irgen_VSCEF(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VSCEG(UChar v1, IRTemp op2addr, UChar m3) { + s390_insn_assert("vsceg", m3 < 2); + store(mkexpr(op2addr), get_vr(v1, Ity_I64, m3)); return "vsceg"; } @@ -16656,9 +16675,6 @@ s390_irgen_VSCEG(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VPDI(UChar v1, UChar v2, UChar v3, UChar m4) { - /* These bits are reserved by specification */ - s390_insn_assert("vpdi", (m4 & 2) == 0 && (m4 & 8) == 0); - put_vr_qw(v1, binop(Iop_64HLtoV128, m4 & 4 ? get_vr_dw1(v2) : get_vr_dw0(v2), m4 & 1 ? get_vr_dw1(v3) : get_vr_dw0(v3))); return "vpdi"; @@ -16667,6 +16683,8 @@ s390_irgen_VPDI(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VSEG(UChar v1, UChar v2, UChar m3) { + s390_insn_assert("vseg", m3 <= 2); + IRType type = s390_vr_get_type(m3); switch(type) { case Ity_I8: @@ -16692,6 +16710,7 @@ s390_irgen_VSEG(UChar v1, UChar v2, UChar m3) static const HChar * s390_irgen_VSTEB(UChar v1, IRTemp op2addr, UChar m3) { + /* Specification exception cannot occur. */ store(mkexpr(op2addr), get_vr(v1, Ity_I8, m3)); return "vsteb"; @@ -16700,6 +16719,8 @@ s390_irgen_VSTEB(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VSTEH(UChar v1, IRTemp op2addr, UChar m3) { + s390_insn_assert("vsteh", m3 < 8); + store(mkexpr(op2addr), get_vr(v1, Ity_I16, m3)); return "vsteh"; @@ -16708,6 +16729,8 @@ s390_irgen_VSTEH(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VSTEF(UChar v1, IRTemp op2addr, UChar m3) { + s390_insn_assert("vstef", m3 < 8); + store(mkexpr(op2addr), get_vr(v1, Ity_I32, m3)); return "vstef"; @@ -16716,6 +16739,8 @@ s390_irgen_VSTEF(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VSTEG(UChar v1, IRTemp op2addr, UChar m3) { + s390_insn_assert("vsteg", m3 < 2); + store(mkexpr(op2addr), get_vr(v1, Ity_I64, m3)); return "vsteg"; @@ -16724,9 +16749,10 @@ s390_irgen_VSTEG(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VSTM(UChar v1, IRTemp op2addr, UChar v3) { + s390_insn_assert("vstm", v3 >= v1); + s390_insn_assert("vstm", v3 - v1 <= 16); + IRExpr* current = mkexpr(op2addr); - vassert(v3 >= v1); - vassert(v3 - v1 <= 16); for(UChar vr = v1; vr <= v3; vr++) { IRExpr* next = binop(Iop_Add64, current, mkU64(16)); @@ -16740,8 +16766,9 @@ s390_irgen_VSTM(UChar v1, IRTemp op2addr, UChar v3) static const HChar * s390_irgen_VUPH(UChar v1, UChar v2, UChar m3) { + s390_insn_assert("vuph", m3 <= 2); + const IROp ops[] = { Iop_Widen8Sto16x8, Iop_Widen16Sto32x4, Iop_Widen32Sto64x2 }; - vassert(m3 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, unop(ops[m3], get_vr_dw0(v2))); return "vuph"; @@ -16750,8 +16777,9 @@ s390_irgen_VUPH(UChar v1, UChar v2, UChar m3) static const HChar * s390_irgen_VUPLH(UChar v1, UChar v2, UChar m3) { + s390_insn_assert("vuplh", m3 <= 2); + const IROp ops[] = { Iop_Widen8Uto16x8, Iop_Widen16Uto32x4, Iop_Widen32Uto64x2 }; - vassert(m3 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, unop(ops[m3], get_vr_dw0(v2))); return "vuplh"; } @@ -16759,8 +16787,9 @@ s390_irgen_VUPLH(UChar v1, UChar v2, UChar m3) static const HChar * s390_irgen_VUPL(UChar v1, UChar v2, UChar m3) { + s390_insn_assert("vupl", m3 <= 2); + const IROp ops[] = { Iop_Widen8Sto16x8, Iop_Widen16Sto32x4, Iop_Widen32Sto64x2 }; - vassert(m3 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, unop(ops[m3], get_vr_dw1(v2))); return "vupl"; @@ -16769,8 +16798,9 @@ s390_irgen_VUPL(UChar v1, UChar v2, UChar m3) static const HChar * s390_irgen_VUPLL(UChar v1, UChar v2, UChar m3) { + s390_insn_assert("vupll", m3 <= 2); + const IROp ops[] = { Iop_Widen8Uto16x8, Iop_Widen16Uto32x4, Iop_Widen32Uto64x2 }; - vassert(m3 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, unop(ops[m3], get_vr_dw1(v2))); return "vupll"; @@ -16779,6 +16809,10 @@ s390_irgen_VUPLL(UChar v1, UChar v2, UChar m3) static const HChar * s390_irgen_VREP(UChar v1, UChar v3, UShort i2, UChar m4) { + s390_insn_assert("vrep", m4 <= 3); + s390_insn_assert("vrep", (m4 == 0 && i2 < 16) || (m4 == 1 && i2 < 8) || + (m4 == 2 && i2 < 4) || (m4 == 3 && i2 < 2)); + IRType type = s390_vr_get_type(m4); IRExpr* arg = get_vr(v3, type, i2); s390_vr_fill(v1, arg); @@ -16789,6 +16823,8 @@ s390_irgen_VREP(UChar v1, UChar v3, UShort i2, UChar m4) static const HChar * s390_irgen_VREPI(UChar v1, UShort i2, UChar m3) { + s390_insn_assert("vrepi", m3 <= 3); + IRType type = s390_vr_get_type(m3); IRExpr *value; switch (type) { @@ -16816,11 +16852,12 @@ s390_irgen_VREPI(UChar v1, UShort i2, UChar m3) static const HChar * s390_irgen_VPKS(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5) { + s390_insn_assert("vpks", m4 >= 1 && m4 <= 3); + if (!s390_vr_is_cs_set(m5)) { const IROp ops[] = { Iop_QNarrowBin16Sto8Sx16, Iop_QNarrowBin32Sto16Sx8, Iop_QNarrowBin64Sto32Sx4 }; Char index = m4 - 1; - vassert((index >= 0) && (index < sizeof(ops) / sizeof(ops[0]))); put_vr_qw(v1, binop(ops[index], get_vr_qw(v2), get_vr_qw(v3))); } else { @@ -16862,11 +16899,12 @@ s390_irgen_VPKS(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5) static const HChar * s390_irgen_VPKLS(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5) { + s390_insn_assert("vpkls", m4 >= 1 && m4 <= 3); + if (!s390_vr_is_cs_set(m5)) { const IROp ops[] = { Iop_QNarrowBin16Uto8Ux16, Iop_QNarrowBin32Uto16Ux8, Iop_QNarrowBin64Uto32Ux4 }; Char index = m4 - 1; - vassert((index >= 0) && (index < sizeof(ops) / sizeof(ops[0]))); put_vr_qw(v1, binop(ops[index], get_vr_qw(v2), get_vr_qw(v3))); } else { @@ -16919,6 +16957,8 @@ s390_irgen_VSEL(UChar v1, UChar v2, UChar v3, UChar v4) static const HChar * s390_irgen_VLBB(UChar v1, IRTemp addr, UChar m3) { + s390_insn_assert("vlbb", m3 <= 6); + IRExpr* maxIndex = binop(Iop_Sub32, s390_getCountToBlockBoundary(addr, m3), mkU32(1)); @@ -16939,7 +16979,13 @@ s390_irgen_VLL(UChar v1, IRTemp addr, UChar r3) static const HChar * s390_irgen_VLRL(UChar v1, IRTemp addr, UChar i3) { + if (! s390_host_has_vxd) { + emulation_failure(EmFail_S390X_vxd); + return "vlrl"; + } + s390_insn_assert("vlrl", (i3 & 0xf0) == 0); + s390_vr_loadWithLength(v1, addr, mkU32((UInt) i3), True); return "vlrl"; @@ -16948,6 +16994,11 @@ s390_irgen_VLRL(UChar v1, IRTemp addr, UChar i3) static const HChar * s390_irgen_VLRLR(UChar v1, UChar r3, IRTemp addr) { + if (! s390_host_has_vxd) { + emulation_failure(EmFail_S390X_vxd); + return "vlrlr"; + } + s390_vr_loadWithLength(v1, addr, get_gpr_w1(r3), True); return "vlrlr"; @@ -16963,7 +17014,13 @@ s390_irgen_VSTL(UChar v1, IRTemp addr, UChar r3) static const HChar * s390_irgen_VSTRL(UChar v1, IRTemp addr, UChar i3) { + if (! s390_host_has_vxd) { + emulation_failure(EmFail_S390X_vxd); + return "vstrl"; + } + s390_insn_assert("vstrl", (i3 & 0xf0) == 0); + s390_vr_storeWithLength(v1, addr, mkU32((UInt) i3), True); return "vstrl"; } @@ -16971,6 +17028,11 @@ s390_irgen_VSTRL(UChar v1, IRTemp addr, UChar i3) static const HChar * s390_irgen_VSTRLR(UChar v1, UChar r3, IRTemp addr) { + if (! s390_host_has_vxd) { + emulation_failure(EmFail_S390X_vxd); + return "vstrlr"; + } + s390_vr_storeWithLength(v1, addr, get_gpr_w1(r3), True); return "vstrlr"; } @@ -17002,6 +17064,11 @@ s390_irgen_VO(UChar v1, UChar v2, UChar v3) static const HChar * s390_irgen_VOC(UChar v1, UChar v2, UChar v3) { + if (! s390_host_has_vxe) { + emulation_failure(EmFail_S390X_vxe); + return "voc"; + } + put_vr_qw(v1, binop(Iop_OrV128, get_vr_qw(v2), unop(Iop_NotV128, get_vr_qw(v3)))); @@ -17011,6 +17078,11 @@ s390_irgen_VOC(UChar v1, UChar v2, UChar v3) static const HChar * s390_irgen_VNN(UChar v1, UChar v2, UChar v3) { + if (! s390_host_has_vxe) { + emulation_failure(EmFail_S390X_vxe); + return "vnn"; + } + put_vr_qw(v1, unop(Iop_NotV128, binop(Iop_AndV128, get_vr_qw(v2), get_vr_qw(v3)))); @@ -17029,6 +17101,11 @@ s390_irgen_VNO(UChar v1, UChar v2, UChar v3) static const HChar * s390_irgen_VNX(UChar v1, UChar v2, UChar v3) { + if (! s390_host_has_vxe) { + emulation_failure(EmFail_S390X_vxe); + return "vnx"; + } + put_vr_qw(v1, unop(Iop_NotV128, binop(Iop_XorV128, get_vr_qw(v2), get_vr_qw(v3)))); @@ -17155,7 +17232,10 @@ s390_irgen_PPNO(UChar r1, UChar r2) static const HChar * s390_irgen_DFLTCC(UChar r3, UChar r1, UChar r2) { - s390_insn_assert("dfltcc", s390_host_has_dflt); + if (!s390_host_has_dflt) { + emulation_failure(EmFail_S390X_dflt); + return "ppno"; + } /* Check for obvious specification exceptions */ s390_insn_assert("dfltcc", r1 % 2 == 0 && r1 != 0 && @@ -17498,6 +17578,11 @@ s390_irgen_VSTRC(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5, UChar m6) static const HChar * s390_irgen_VSTRS(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5, UChar m6) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vstrs"; + } + s390_insn_assert("vstrs", m5 <= 2 && m6 == (m6 & 2)); IRTemp op2 = newTemp(Ity_V128); @@ -17607,9 +17692,10 @@ s390_irgen_VNC(UChar v1, UChar v2, UChar v3) static const HChar * s390_irgen_VA(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("va", m4 <= 4); + const IROp ops[] = { Iop_Add8x16, Iop_Add16x8, Iop_Add32x4, Iop_Add64x2, Iop_Add128x1 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "va"; @@ -17618,9 +17704,10 @@ s390_irgen_VA(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VS(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vs", m4 <= 4); + const IROp ops[] = { Iop_Sub8x16, Iop_Sub16x8, Iop_Sub32x4, Iop_Sub64x2, Iop_Sub128x1 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vs"; @@ -17629,8 +17716,9 @@ s390_irgen_VS(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VMX(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vmx", m4 <= 3); + const IROp ops[] = { Iop_Max8Sx16, Iop_Max16Sx8, Iop_Max32Sx4, Iop_Max64Sx2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vmx"; @@ -17639,8 +17727,9 @@ s390_irgen_VMX(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VMXL(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vmxl", m4 <= 3); + const IROp ops[] = { Iop_Max8Ux16, Iop_Max16Ux8, Iop_Max32Ux4, Iop_Max64Ux2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vmxl"; @@ -17649,8 +17738,9 @@ s390_irgen_VMXL(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VMN(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vmn", m4 <= 3); + const IROp ops[] = { Iop_Min8Sx16, Iop_Min16Sx8, Iop_Min32Sx4, Iop_Min64Sx2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vmn"; @@ -17659,8 +17749,9 @@ s390_irgen_VMN(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VMNL(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vmnl", m4 <= 3); + const IROp ops[] = { Iop_Min8Ux16, Iop_Min16Ux8, Iop_Min32Ux4, Iop_Min64Ux2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vmnl"; @@ -17669,8 +17760,9 @@ s390_irgen_VMNL(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VAVG(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vavg", m4 <= 3); + const IROp ops[] = { Iop_Avg8Sx16, Iop_Avg16Sx8, Iop_Avg32Sx4, Iop_Avg64Sx2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vavg"; @@ -17679,8 +17771,9 @@ s390_irgen_VAVG(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VAVGL(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vavgl", m4 <= 3); + const IROp ops[] = { Iop_Avg8Ux16, Iop_Avg16Ux8, Iop_Avg32Ux4, Iop_Avg64Ux2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vavgl"; @@ -17689,7 +17782,8 @@ s390_irgen_VAVGL(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VLC(UChar v1, UChar v2, UChar m3) { - vassert(m3 < 4); + s390_insn_assert("vlc", m3 < 4); + IRType type = s390_vr_get_type(m3); put_vr_qw(v1, s390_V128_get_complement(get_vr_qw(v2), type)); return "vlc"; @@ -17698,8 +17792,9 @@ s390_irgen_VLC(UChar v1, UChar v2, UChar m3) static const HChar * s390_irgen_VLP(UChar v1, UChar v2, UChar m3) { + s390_insn_assert("vlp", m3 <= 3); + const IROp ops[] = { Iop_Abs8x16, Iop_Abs16x8, Iop_Abs32x4, Iop_Abs64x2 }; - vassert(m3 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, unop(ops[m3], get_vr_qw(v2))); return "vlp"; @@ -17708,10 +17803,11 @@ s390_irgen_VLP(UChar v1, UChar v2, UChar m3) static const HChar * s390_irgen_VCH(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5) { + s390_insn_assert("vch", m4 <= 3); + if (!s390_vr_is_cs_set(m5)) { const IROp ops[] = { Iop_CmpGT8Sx16, Iop_CmpGT16Sx8, Iop_CmpGT32Sx4, Iop_CmpGT64Sx2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); } else { @@ -17753,10 +17849,11 @@ s390_irgen_VCH(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5) static const HChar * s390_irgen_VCHL(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5) { + s390_insn_assert("vchl", m4 <= 3); + if (!s390_vr_is_cs_set(m5)) { const IROp ops[] = { Iop_CmpGT8Ux16, Iop_CmpGT16Ux8, Iop_CmpGT32Ux4, Iop_CmpGT64Ux2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); } else { @@ -17798,8 +17895,9 @@ s390_irgen_VCHL(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5) static const HChar * s390_irgen_VCLZ(UChar v1, UChar v2, UChar m3) { + s390_insn_assert("vclz", m3 <= 3); + const IROp ops[] = { Iop_Clz8x16, Iop_Clz16x8, Iop_Clz32x4, Iop_Clz64x2 }; - vassert(m3 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, unop(ops[m3], get_vr_qw(v2))); return "vclz"; @@ -17808,8 +17906,9 @@ s390_irgen_VCLZ(UChar v1, UChar v2, UChar m3) static const HChar * s390_irgen_VCTZ(UChar v1, UChar v2, UChar m3) { + s390_insn_assert("vctz", m3 <= 3); + const IROp ops[] = { Iop_Ctz8x16, Iop_Ctz16x8, Iop_Ctz32x4, Iop_Ctz64x2 }; - vassert(m3 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, unop(ops[m3], get_vr_qw(v2))); return "vctz"; @@ -17838,8 +17937,9 @@ s390_irgen_VPOPCT(UChar v1, UChar v2, UChar m3) static const HChar * s390_irgen_VML(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vml", m4 <= 2); + const IROp ops[] = { Iop_Mul8x16, Iop_Mul16x8, Iop_Mul32x4 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vml"; @@ -17848,8 +17948,9 @@ s390_irgen_VML(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VMLH(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vmlh", m4 <= 2); + const IROp ops[] = { Iop_MulHi8Ux16, Iop_MulHi16Ux8, Iop_MulHi32Ux4 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vmlh"; @@ -17858,8 +17959,9 @@ s390_irgen_VMLH(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VMH(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vmh", m4 <= 2); + const IROp ops[] = { Iop_MulHi8Sx16, Iop_MulHi16Sx8, Iop_MulHi32Sx4 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vmh"; @@ -17868,8 +17970,9 @@ s390_irgen_VMH(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VME(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vme", m4 <= 2); + const IROp ops[] = { Iop_MullEven8Sx16, Iop_MullEven16Sx8, Iop_MullEven32Sx4 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vme"; @@ -17878,8 +17981,9 @@ s390_irgen_VME(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VMLE(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vmle", m4 <= 2); + const IROp ops[] = { Iop_MullEven8Ux16, Iop_MullEven16Ux8, Iop_MullEven32Ux4 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vmle"; @@ -17888,8 +17992,9 @@ s390_irgen_VMLE(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VESLV(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vselv", m4 <= 3); + const IROp ops[] = { Iop_Shl8x16, Iop_Shl16x8, Iop_Shl32x4, Iop_Shl64x2}; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "veslv"; @@ -17898,9 +18003,10 @@ s390_irgen_VESLV(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VESL(UChar v1, IRTemp op2addr, UChar v3, UChar m4) { + s390_insn_assert("vesl", m4 <= 3); + IRExpr* shift_amount = unop(Iop_64to8, mkexpr(op2addr)); const IROp ops[] = { Iop_ShlN8x16, Iop_ShlN16x8, Iop_ShlN32x4, Iop_ShlN64x2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v3), shift_amount)); return "vesl"; @@ -17909,8 +18015,9 @@ s390_irgen_VESL(UChar v1, IRTemp op2addr, UChar v3, UChar m4) static const HChar * s390_irgen_VESRAV(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vesrav", m4 <= 3); + const IROp ops[] = { Iop_Sar8x16, Iop_Sar16x8, Iop_Sar32x4, Iop_Sar64x2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vesrav"; @@ -17919,9 +18026,10 @@ s390_irgen_VESRAV(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VESRA(UChar v1, IRTemp op2addr, UChar v3, UChar m4) { + s390_insn_assert("vesra", m4 <= 3); + IRExpr* shift_amount = unop(Iop_64to8, mkexpr(op2addr)); const IROp ops[] = { Iop_SarN8x16, Iop_SarN16x8, Iop_SarN32x4, Iop_SarN64x2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v3), shift_amount)); return "vesra"; @@ -17930,8 +18038,9 @@ s390_irgen_VESRA(UChar v1, IRTemp op2addr, UChar v3, UChar m4) static const HChar * s390_irgen_VESRLV(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vesrlv", m4 <= 3); + const IROp ops[] = { Iop_Shr8x16, Iop_Shr16x8, Iop_Shr32x4, Iop_Shr64x2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "vesrlv"; @@ -17940,9 +18049,10 @@ s390_irgen_VESRLV(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VESRL(UChar v1, IRTemp op2addr, UChar v3, UChar m4) { + s390_insn_assert("vesrl", m4 <= 3); + IRExpr* shift_amount = unop(Iop_64to8, mkexpr(op2addr)); const IROp ops[] = { Iop_ShrN8x16, Iop_ShrN16x8, Iop_ShrN32x4, Iop_ShrN64x2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v3), shift_amount)); return "vesrl"; @@ -17951,8 +18061,9 @@ s390_irgen_VESRL(UChar v1, IRTemp op2addr, UChar v3, UChar m4) static const HChar * s390_irgen_VERLLV(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("verllv", m4 <= 3); + const IROp ops[] = { Iop_Rol8x16, Iop_Rol16x8, Iop_Rol32x4, Iop_Rol64x2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); return "verllv"; @@ -17961,13 +18072,13 @@ s390_irgen_VERLLV(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VERLL(UChar v1, IRTemp op2addr, UChar v3, UChar m4) { + s390_insn_assert("verll", m4 <= 3); /* There is no Iop_RolN?x?? operations so we have to use VECTOR x VECTOR variant. */ IRExpr* shift_vector = unop(Iop_Dup8x16, unop(Iop_64to8, mkexpr(op2addr))); const IROp ops[] = { Iop_Rol8x16, Iop_Rol16x8, Iop_Rol32x4, Iop_Rol64x2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v3), shift_vector)); return "verll"; @@ -18042,12 +18153,12 @@ s390_irgen_VSRA(UChar v1, UChar v2, UChar v3) static const HChar * s390_irgen_VERIM(UChar v1, UChar v2, UChar v3, UChar i4, UChar m5) { + s390_insn_assert("verim", m5 <= 3); /* There is no Iop_RolN?x?? operations so we have to use VECTOR x VECTOR variant. */ const IROp ops[] = { Iop_Rol8x16, Iop_Rol16x8, Iop_Rol32x4, Iop_Rol64x2 }; - vassert(m5 < sizeof(ops) / sizeof(ops[0])); IRExpr* shift_vector = unop(Iop_Dup8x16, mkU8(i4)); IRExpr* rotated_vector = binop(ops[m5], get_vr_qw(v2), shift_vector); @@ -18062,6 +18173,8 @@ s390_irgen_VERIM(UChar v1, UChar v2, UChar v3, UChar i4, UChar m5) static const HChar * s390_irgen_VEC(UChar v1, UChar v2, UChar m3) { + s390_insn_assert("vec", m3 <= 3); + IRType type = s390_vr_get_type(m3); IRTemp op1 = newTemp(type); IRTemp op2 = newTemp(type); @@ -18095,6 +18208,8 @@ s390_irgen_VEC(UChar v1, UChar v2, UChar m3) static const HChar * s390_irgen_VECL(UChar v1, UChar v2, UChar m3) { + s390_insn_assert("vecl", m3 <= 3); + IRType type = s390_vr_get_type(m3); IRTemp op1 = newTemp(type); IRTemp op2 = newTemp(type); @@ -18128,10 +18243,11 @@ s390_irgen_VECL(UChar v1, UChar v2, UChar m3) static const HChar * s390_irgen_VCEQ(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5) { + s390_insn_assert("vceq", m4 <= 3); + if (!s390_vr_is_cs_set(m5)) { const IROp ops[] = { Iop_CmpEQ8x16, Iop_CmpEQ16x8, Iop_CmpEQ32x4, Iop_CmpEQ64x2 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); put_vr_qw(v1, binop(ops[m4], get_vr_qw(v2), get_vr_qw(v3))); } else { @@ -18224,6 +18340,11 @@ s390_irgen_VSLDB(UChar v1, UChar v2, UChar v3, UChar i4) static const HChar * s390_irgen_VSLD(UChar v1, UChar v2, UChar v3, UChar i4) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vsld"; + } + s390_insn_assert("vsld", i4 <= 7); if (i4 == 0) { @@ -18245,6 +18366,11 @@ s390_irgen_VSLD(UChar v1, UChar v2, UChar v3, UChar i4) static const HChar * s390_irgen_VSRD(UChar v1, UChar v2, UChar v3, UChar i4) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vsrd"; + } + s390_insn_assert("vsrd", i4 <= 7); if (i4 == 0) { @@ -18266,10 +18392,11 @@ s390_irgen_VSRD(UChar v1, UChar v2, UChar v3, UChar i4) static const HChar * s390_irgen_VMO(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vmo", m4 <= 2); + const IROp ops[] = { Iop_MullEven8Sx16, Iop_MullEven16Sx8, Iop_MullEven32Sx4 }; UChar shifts[] = { 8, 16, 32 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); IRExpr* result = binop(ops[m4], binop(Iop_ShlV128, get_vr_qw(v2), mkU8(shifts[m4])), binop(Iop_ShlV128, get_vr_qw(v3), mkU8(shifts[m4])) @@ -18282,10 +18409,11 @@ s390_irgen_VMO(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VMLO(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vmlo", m4 <= 2); + const IROp ops[] = { Iop_MullEven8Ux16, Iop_MullEven16Ux8, Iop_MullEven32Ux4 }; UChar shifts[] = { 8, 16, 32 }; - vassert(m4 < sizeof(ops) / sizeof(ops[0])); IRExpr* result = binop(ops[m4], binop(Iop_ShlV128, get_vr_qw(v2), mkU8(shifts[m4])), binop(Iop_ShlV128, get_vr_qw(v3), mkU8(shifts[m4])) @@ -18298,10 +18426,11 @@ s390_irgen_VMLO(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VMAE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { + s390_insn_assert("vmae", m5 <= 2); + const IROp mul_ops[] = { Iop_MullEven8Sx16, Iop_MullEven16Sx8, Iop_MullEven32Sx4 }; const IROp add_ops[] = { Iop_Add16x8, Iop_Add32x4, Iop_Add64x2}; - vassert(m5 < sizeof(mul_ops) / sizeof(mul_ops[0])); IRExpr* mul_result = binop(mul_ops[m5], get_vr_qw(v2), get_vr_qw(v3)); IRExpr* result = binop(add_ops[m5], mul_result, get_vr_qw(v4)); @@ -18313,10 +18442,11 @@ s390_irgen_VMAE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) static const HChar * s390_irgen_VMALE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { + s390_insn_assert("vmale", m5 <= 2); + const IROp mul_ops[] = { Iop_MullEven8Ux16, Iop_MullEven16Ux8, Iop_MullEven32Ux4 }; const IROp add_ops[] = { Iop_Add16x8, Iop_Add32x4, Iop_Add64x2 }; - vassert(m5 < sizeof(mul_ops) / sizeof(mul_ops[0])); IRExpr* mul_result = binop(mul_ops[m5], get_vr_qw(v2), get_vr_qw(v3)); IRExpr* result = binop(add_ops[m5], mul_result, get_vr_qw(v4)); @@ -18328,11 +18458,12 @@ s390_irgen_VMALE(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) static const HChar * s390_irgen_VMAO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { + s390_insn_assert("vmao", m5 <= 2); + const IROp mul_ops[] = { Iop_MullEven8Sx16, Iop_MullEven16Sx8, Iop_MullEven32Sx4 }; const IROp add_ops[] = { Iop_Add16x8, Iop_Add32x4, Iop_Add64x2 }; UChar shifts[] = { 8, 16, 32 }; - vassert(m5 < sizeof(mul_ops) / sizeof(mul_ops[0])); IRExpr* mul_result = binop(mul_ops[m5], @@ -18347,11 +18478,12 @@ s390_irgen_VMAO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) static const HChar * s390_irgen_VMALO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { + s390_insn_assert("vmalo", m5 <= 2); + const IROp mul_ops[] = { Iop_MullEven8Ux16, Iop_MullEven16Ux8, Iop_MullEven32Ux4 }; const IROp add_ops[] = { Iop_Add16x8, Iop_Add32x4, Iop_Add64x2 }; UChar shifts[] = { 8, 16, 32 }; - vassert(m5 < sizeof(mul_ops) / sizeof(mul_ops[0])); IRExpr* mul_result = binop(mul_ops[m5], binop(Iop_ShlV128, @@ -18369,9 +18501,10 @@ s390_irgen_VMALO(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) static const HChar * s390_irgen_VMAL(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { + s390_insn_assert("vmal", m5 <= 2); + const IROp mul_ops[] = { Iop_Mul8x16, Iop_Mul16x8, Iop_Mul32x4 }; const IROp add_ops[] = { Iop_Add8x16, Iop_Add16x8, Iop_Add32x4 }; - vassert(m5 < sizeof(mul_ops) / sizeof(mul_ops[0])); IRExpr* mul_result = binop(mul_ops[m5], get_vr_qw(v2), get_vr_qw(v3)); IRExpr* result = binop(add_ops[m5], mul_result, get_vr_qw(v4)); @@ -18383,6 +18516,8 @@ s390_irgen_VMAL(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) static const HChar * s390_irgen_VSUM(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vsum", m4 <= 1); + IRType type = s390_vr_get_type(m4); IRExpr* mask; IRExpr* sum; @@ -18408,6 +18543,8 @@ s390_irgen_VSUM(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VSUMG(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vsumg", m4 == 1 || m4 == 2); + IRType type = s390_vr_get_type(m4); IRExpr* mask; IRExpr* sum; @@ -18433,6 +18570,8 @@ s390_irgen_VSUMG(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VSUMQ(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vsumq", m4 == 2 || m4 == 3); + IRType type = s390_vr_get_type(m4); IRExpr* mask; IRExpr* sum; @@ -18490,7 +18629,7 @@ s390_irgen_VTM(UChar v1, UChar v2) static const HChar * s390_irgen_VAC(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { - vassert(m5 == 4); /* specification exception otherwise */ + s390_insn_assert("vac", m5 == 4); IRTemp sum = newTemp(Ity_V128); assign(sum, binop(Iop_Add128x1, get_vr_qw(v2), get_vr_qw(v3))); @@ -18505,6 +18644,8 @@ s390_irgen_VAC(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) static const HChar * s390_irgen_VACC(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vacc", m4 <= 4); + IRType type = s390_vr_get_type(m4); IRExpr* arg1 = get_vr_qw(v2); IRExpr* arg2 = get_vr_qw(v3); @@ -18516,7 +18657,8 @@ s390_irgen_VACC(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VACCC(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { - vassert(m5 == 4); /* specification exception otherwise */ + s390_insn_assert("vaccc", m5 == 4); + IRExpr* result = s390_V128_calculate_carry_out_with_carry(get_vr_qw(v2), get_vr_qw(v3), @@ -18545,6 +18687,8 @@ s390_irgen_VCKSM(UChar v1, UChar v2, UChar v3) static const HChar * s390_irgen_VGFM(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vgfm", m4 <= 3); + IRDirty* d; IRTemp cc = newTemp(Ity_I64); @@ -18579,6 +18723,8 @@ s390_irgen_VGFM(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VGFMA(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { + s390_insn_assert("vgfma", m5 <= 3); + IRDirty* d; IRTemp cc = newTemp(Ity_I64); @@ -18617,7 +18763,7 @@ s390_irgen_VGFMA(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) static const HChar * s390_irgen_VSBI(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { - vassert(m5 == 4); /* specification exception otherwise */ + s390_insn_assert("vsbi", m5 == 4); IRExpr* mask = binop(Iop_64HLtoV128, mkU64(0ULL), mkU64(1ULL)); IRExpr* carry_in = binop(Iop_AndV128, get_vr_qw(v4), mask); @@ -18636,6 +18782,8 @@ s390_irgen_VSBI(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) static const HChar * s390_irgen_VSCBI(UChar v1, UChar v2, UChar v3, UChar m4) { + s390_insn_assert("vscbi", m4 <= 4); + IRType type = s390_vr_get_type(m4); IRExpr* arg1 = get_vr_qw(v2); IRExpr* arg2 = s390_V128_get_complement(get_vr_qw(v3), type); @@ -18648,7 +18796,8 @@ s390_irgen_VSCBI(UChar v1, UChar v2, UChar v3, UChar m4) static const HChar * s390_irgen_VSBCBI(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { - vassert(m5 == 4); /* specification exception otherwise */ + s390_insn_assert("vsbcbi", m5 == 4); + IRExpr* result = s390_V128_calculate_carry_out_with_carry(get_vr_qw(v2), unop(Iop_NotV128, get_vr_qw(v3)), @@ -18661,12 +18810,11 @@ s390_irgen_VSBCBI(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) static const HChar * s390_irgen_VMAH(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { + s390_insn_assert("vmah", m5 < 3); + IRDirty* d; IRTemp cc = newTemp(Ity_I64); - /* Check for specification exception */ - vassert(m5 < 3); - s390x_vec_op_details_t details = { .serialized = 0ULL }; details.op = S390_VEC_OP_VMAH; details.v1 = v1; @@ -18703,12 +18851,11 @@ s390_irgen_VMAH(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) static const HChar * s390_irgen_VMALH(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) { + s390_insn_assert("vmalh", m5 < 3); + IRDirty* d; IRTemp cc = newTemp(Ity_I64); - /* Check for specification exception */ - vassert(m5 < 3); - s390x_vec_op_details_t details = { .serialized = 0ULL }; details.op = S390_VEC_OP_VMALH; details.v1 = v1; @@ -18745,6 +18892,11 @@ s390_irgen_VMALH(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5) static const HChar * s390_irgen_VMSL(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5, UChar m6) { + if (! s390_host_has_vxe) { + emulation_failure(EmFail_S390X_vxe); + return "vmsl"; + } + s390_insn_assert("vmsl", m5 == 3 && (m6 & 3) == 0); IRDirty* d; @@ -18829,7 +18981,9 @@ s390_vector_fp_convert(IROp op, IRType fromType, IRType toType, Bool rounding, static const HChar * s390_irgen_VCDG(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) { - s390_insn_assert("vcdg", m3 == 2 || m3 == 3); + s390_insn_assert("vcdg", m3 == 3 || (m3 == 2 && s390_host_has_vxe2)); + s390_insn_assert("vcdg", (m4 & 0x3) == 0); + s390_insn_assert("vcdg", m5 != 2 && m5 <= 7); s390_vector_fp_convert(m3 == 2 ? Iop_I32StoF32 : Iop_I64StoF64, m3 == 2 ? Ity_I32 : Ity_I64, @@ -18841,7 +18995,9 @@ s390_irgen_VCDG(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) static const HChar * s390_irgen_VCDLG(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) { - s390_insn_assert("vcdlg", m3 == 2 || m3 == 3); + s390_insn_assert("vcdlg", m3 == 3 || (m3 == 2 && s390_host_has_vxe2)); + s390_insn_assert("vcdlg", (m4 & 0x3) == 0); + s390_insn_assert("vcdlg", m5 != 2 && m5 <= 7); s390_vector_fp_convert(m3 == 2 ? Iop_I32UtoF32 : Iop_I64UtoF64, m3 == 2 ? Ity_I32 : Ity_I64, @@ -18853,7 +19009,9 @@ s390_irgen_VCDLG(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) static const HChar * s390_irgen_VCGD(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) { - s390_insn_assert("vcgd", m3 == 2 || m3 == 3); + s390_insn_assert("vcgd", m3 == 3 || (m3 == 2 && s390_host_has_vxe2)); + s390_insn_assert("vcgd", (m4 & 0x3) == 0); + s390_insn_assert("vcgd", m5 != 2 && m5 <= 7); s390_vector_fp_convert(m3 == 2 ? Iop_F32toI32S : Iop_F64toI64S, m3 == 2 ? Ity_F32 : Ity_F64, @@ -18865,7 +19023,9 @@ s390_irgen_VCGD(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) static const HChar * s390_irgen_VCLGD(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) { - s390_insn_assert("vclgd", m3 == 2 || m3 == 3); + s390_insn_assert("vclgd", m3 == 3 || (m3 == 2 && s390_host_has_vxe2)); + s390_insn_assert("vclgd", (m4 & 0x3) == 0); + s390_insn_assert("vclgd", m5 != 2 && m5 <= 7); s390_vector_fp_convert(m3 == 2 ? Iop_F32toI32U : Iop_F64toI64U, m3 == 2 ? Ity_F32 : Ity_F64, @@ -18879,6 +19039,8 @@ s390_irgen_VFI(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) { s390_insn_assert("vfi", (m3 == 3 || (s390_host_has_vxe && m3 >= 2 && m3 <= 4))); + s390_insn_assert("vfi", (m4 & 0x3) == 0); + s390_insn_assert("vfi", m5 != 2 && m5 <= 7); switch (m3) { case 2: s390_vector_fp_convert(Iop_RoundF32toInt, Ity_F32, Ity_F32, True, @@ -18896,6 +19058,7 @@ static const HChar * s390_irgen_VFLL(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) { s390_insn_assert("vfll", m3 == 2 || (s390_host_has_vxe && m3 == 3)); + s390_insn_assert("vfll", (m4 & 0x7) == 0); if (m3 == 2) s390_vector_fp_convert(Iop_F32toF64, Ity_F32, Ity_F64, False, @@ -18911,6 +19074,8 @@ static const HChar * s390_irgen_VFLR(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) { s390_insn_assert("vflr", m3 == 3 || (s390_host_has_vxe && m3 == 4)); + s390_insn_assert("vflr", (m4 & 0x3) == 0); + s390_insn_assert("vflr", m5 != 2 && m5 <= 7); if (m3 == 3) s390_vector_fp_convert(Iop_F64toF32, Ity_F64, Ity_F32, True, @@ -18925,8 +19090,9 @@ s390_irgen_VFLR(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) static const HChar * s390_irgen_VFPSO(UChar v1, UChar v2, UChar m3, UChar m4, UChar m5) { - s390_insn_assert("vfpso", m5 <= 2 && - (m3 == 3 || (s390_host_has_vxe && m3 >= 2 && m3 <= 4))); + s390_insn_assert("vfpso", m3 == 3 || (s390_host_has_vxe && m3 >= 2 && m3 <= 4)); + s390_insn_assert("vfpso", (m4 & 0x7) == 0); + s390_insn_assert("vfpso", m5 <= 2); Bool single = s390_vr_is_single_element_control_set(m4) || m3 == 4; IRType type = single ? s390_vr_get_ftype(m3) : Ity_V128; @@ -19010,12 +19176,13 @@ s390_vector_fp_mulAddOrSub(UChar v1, UChar v2, UChar v3, UChar v4, const HChar* mnm, const IROp single_ops[], Bool negate) { + s390_insn_assert(mnm, (m5 & 0x7) == 0); s390_insn_assert(mnm, m6 == 3 || (s390_host_has_vxe && m6 >= 2 && m6 <= 4)); static const IROp negate_ops[] = { Iop_NegF32, Iop_NegF64, Iop_NegF128 }; IRType type = s390_vr_get_ftype(m6); Bool single = s390_vr_is_single_element_control_set(m5) || m6 == 4; - UChar n_elem = single ? 1 : s390_vr_get_n_elem(m6); + UChar n_elem = single ? 1 : (1 << (4 - m6)); IRTemp irrm_temp = newTemp(Ity_I32); assign(irrm_temp, get_bfp_rounding_mode_from_fpc()); IRExpr* irrm = mkexpr(irrm_temp); @@ -19100,6 +19267,11 @@ s390_irgen_VFMA(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5, UChar m6) static const HChar * s390_irgen_VFNMA(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5, UChar m6) { + if (! s390_host_has_vxe) { + emulation_failure(EmFail_S390X_vxe); + return "vfnma"; + } + return s390_vector_fp_mulAddOrSub(v1, v2, v3, v4, m5, m6, "vfnma", FMA_single_ops, True); } @@ -19118,6 +19290,11 @@ s390_irgen_VFMS(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5, UChar m6) static const HChar * s390_irgen_VFNMS(UChar v1, UChar v2, UChar v3, UChar v4, UChar m5, UChar m6) { + if (! s390_host_has_vxe) { + emulation_failure(EmFail_S390X_vxe); + return "vfnms"; + } + return s390_vector_fp_mulAddOrSub(v1, v2, v3, v4, m5, m6, "vfnms", FMS_single_ops, True); } @@ -19144,6 +19321,9 @@ s390_irgen_WFC(UChar v1, UChar v2, UChar m3, UChar m4) static const HChar * s390_irgen_WFK(UChar v1, UChar v2, UChar m3, UChar m4) { + s390_insn_assert("wfk", m4 == 0 && + (m3 == 3 || (s390_host_has_vxe && m3 >= 2 && m3 <= 4))); + s390_irgen_WFC(v1, v2, m3, m4); return "wfk"; @@ -19240,6 +19420,7 @@ s390_irgen_VFTCI(UChar v1, UChar v2, UShort i3, UChar m4, UChar m5) { s390_insn_assert("vftci", (m4 == 3 || (s390_host_has_vxe && m4 >= 2 && m4 <= 4))); + s390_insn_assert("vftci", (m5 & 0x7) == 0); Bool isSingleElementOp = s390_vr_is_single_element_control_set(m5); @@ -19279,8 +19460,14 @@ s390_irgen_VFTCI(UChar v1, UChar v2, UShort i3, UChar m4, UChar m5) static const HChar * s390_irgen_VFMIN(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, UChar m6) { - s390_insn_assert("vfmin", - (m4 == 3 || (s390_host_has_vxe && m4 >= 2 && m4 <= 4))); + if (! s390_host_has_vxe) { + emulation_failure(EmFail_S390X_vxe); + return "vfmin"; + } + + s390_insn_assert("vfmin", m4 >= 2 && m4 <= 4); + s390_insn_assert("vfmin", (m5 & 0x7) == 0); + s390_insn_assert("vfmin", m6 <= 4 || (m6 >= 8 && m6 <= 12)); Bool isSingleElementOp = s390_vr_is_single_element_control_set(m5); IRDirty* d; @@ -19320,8 +19507,14 @@ s390_irgen_VFMIN(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, UChar m6) static const HChar * s390_irgen_VFMAX(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, UChar m6) { - s390_insn_assert("vfmax", - (m4 == 3 || (s390_host_has_vxe && m4 >= 2 && m4 <= 4))); + if (! s390_host_has_vxe) { + emulation_failure(EmFail_S390X_vxe); + return "vfmax"; + } + + s390_insn_assert("vfmax", m4 >= 2 && m4 <= 4); + s390_insn_assert("vfmax", (m5 & 0x7) == 0); + s390_insn_assert("vfmax", m6 <= 4 || (m6 >= 8 && m6 <= 12)); Bool isSingleElementOp = s390_vr_is_single_element_control_set(m5); IRDirty* d; @@ -19361,6 +19554,11 @@ s390_irgen_VFMAX(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5, UChar m6) static const HChar * s390_irgen_VBPERM(UChar v1, UChar v2, UChar v3) { + if (! s390_host_has_vxe) { + emulation_failure(EmFail_S390X_vxe); + return "vbperm"; + } + IRDirty* d; IRTemp cc = newTemp(Ity_I64); @@ -19451,7 +19649,13 @@ s390_reverse_elements(IRExpr* v, UChar m) static const HChar * s390_irgen_VLBR(UChar v1, IRTemp op2addr, UChar m3) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vlbr"; + } + s390_insn_assert("vlbr", m3 >= 1 && m3 <= 4); + put_vr_qw(v1, s390_byteswap_elements(load(Ity_V128, mkexpr(op2addr)), m3)); return "vlbr"; } @@ -19459,7 +19663,13 @@ s390_irgen_VLBR(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VSTBR(UChar v1, IRTemp op2addr, UChar m3) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vstbr"; + } + s390_insn_assert("vstbr", m3 >= 1 && m3 <= 4); + store(mkexpr(op2addr), s390_byteswap_elements(get_vr_qw(v1), m3)); return "vstbr"; } @@ -19467,7 +19677,13 @@ s390_irgen_VSTBR(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VLER(UChar v1, IRTemp op2addr, UChar m3) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vler"; + } + s390_insn_assert("vler", m3 >= 1 && m3 <= 3); + put_vr_qw(v1, s390_reverse_elements(load(Ity_V128, mkexpr(op2addr)), m3)); return "vler"; } @@ -19475,9 +19691,15 @@ s390_irgen_VLER(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VSTER(UChar v1, IRTemp op2addr, UChar m3) { - s390_insn_assert("vstbr", m3 >= 1 && m3 <= 4); + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vster"; + } + + s390_insn_assert("vster", m3 >= 1 && m3 <= 4); + store(mkexpr(op2addr), s390_reverse_elements(get_vr_qw(v1), m3)); - return "vstbr"; + return "vster"; } /* Helper function that combines its two V128 operands by replacing element 'to' @@ -19506,7 +19728,13 @@ s390_insert_byteswapped(IRExpr* a, IRExpr* b, UChar m, UChar to, UChar from) static const HChar * s390_irgen_VLEBRH(UChar v1, IRTemp op2addr, UChar m3) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vlebrh"; + } + s390_insn_assert("vlebrh", m3 <= 7); + IRTemp op2 = newTemp(Ity_I16); assign(op2, load(Ity_I16, mkexpr(op2addr))); put_vr(v1, Ity_I16, m3, binop(Iop_Or16, @@ -19518,7 +19746,13 @@ s390_irgen_VLEBRH(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VLEBRF(UChar v1, IRTemp op2addr, UChar m3) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vlebrf"; + } + s390_insn_assert("vlebrf", m3 <= 3); + IRTemp op1 = newTemp(Ity_V128); assign(op1, get_vr_qw(v1)); IRTemp op2 = newTemp(Ity_I64); @@ -19531,7 +19765,13 @@ s390_irgen_VLEBRF(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VLEBRG(UChar v1, IRTemp op2addr, UChar m3) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vlebrg"; + } + s390_insn_assert("vlebrg", m3 <= 1); + IRTemp op1 = newTemp(Ity_V128); assign(op1, get_vr_qw(v1)); IRTemp op2 = newTemp(Ity_I64); @@ -19544,7 +19784,13 @@ s390_irgen_VLEBRG(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VLBRREP(UChar v1, IRTemp op2addr, UChar m3) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vlbrrep"; + } + s390_insn_assert("vlbrrep", m3 >= 1 && m3 <= 3); + static const ULong perm[3] = { 0x0f0e0f0e0f0e0f0e, /* 2-byte element */ 0x0f0e0d0c0f0e0d0c, /* 4-byte element */ @@ -19566,7 +19812,13 @@ s390_irgen_VLBRREP(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VLLEBRZ(UChar v1, IRTemp op2addr, UChar m3) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vllebrz"; + } + s390_insn_assert("vllebrz", (m3 >= 1 && m3 <= 3) || m3 == 6); + static const ULong perm[6] = { 0x0000000000000f0e, /* 2-byte element */ 0x000000000f0e0d0c, /* 4-byte element */ @@ -19591,7 +19843,13 @@ s390_irgen_VLLEBRZ(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VSTEBRH(UChar v1, IRTemp op2addr, UChar m3) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vstebrh"; + } + s390_insn_assert("vstebrh", m3 <= 7); + IRTemp op1 = newTemp(Ity_I16); assign(op1, get_vr(v1, Ity_I16, m3)); store(mkexpr(op2addr), binop(Iop_Or16, @@ -19603,7 +19861,13 @@ s390_irgen_VSTEBRH(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VSTEBRF(UChar v1, IRTemp op2addr, UChar m3) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vstebrf"; + } + s390_insn_assert("vstebrf", m3 <= 3); + IRTemp op1 = newTemp(Ity_V128); assign(op1, get_vr_qw(v1)); IRExpr* b = s390_insert_byteswapped(mkexpr(op1), mkexpr(op1), 2, 3, m3); @@ -19614,7 +19878,13 @@ s390_irgen_VSTEBRF(UChar v1, IRTemp op2addr, UChar m3) static const HChar * s390_irgen_VSTEBRG(UChar v1, IRTemp op2addr, UChar m3) { + if (! s390_host_has_vxe2) { + emulation_failure(EmFail_S390X_vxe2); + return "vstebrg"; + } + s390_insn_assert("vstebrg", m3 <= 1); + IRTemp op1 = newTemp(Ity_V128); assign(op1, get_vr_qw(v1)); IRExpr* b = s390_insert_byteswapped(mkexpr(op1), mkexpr(op1), 3, 1, m3); @@ -19626,7 +19896,10 @@ static const HChar * s390_irgen_VCxx(const HChar *mnem, s390x_vec_op_details_t details, UShort v2_offs, UShort v2_size) { - s390_insn_assert(mnem, s390_host_has_nnpa); + if (! s390_host_has_nnpa) { + emulation_failure(EmFail_S390X_nnpa); + return mnem; + } IRDirty* d = unsafeIRDirty_0_N(0, "s390x_dirtyhelper_vec_op", &s390x_dirtyhelper_vec_op, @@ -19650,6 +19923,9 @@ s390_irgen_VCxx(const HChar *mnem, s390x_vec_op_details_t details, static const HChar * s390_irgen_VCNF(UChar v1, UChar v2, UChar m3, UChar m4) { + s390_insn_assert("vcnf", m3 == 0); + s390_insn_assert("vcnf", m4 < 2); + s390x_vec_op_details_t details = { .serialized = 0ULL }; details.op = S390_VEC_OP_VCNF; details.v1 = v1; @@ -19699,7 +19975,10 @@ s390_irgen_VCLFNL(UChar v1, UChar v2, UChar m3, UChar m4) static const HChar * s390_irgen_VCRNF(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5) { - s390_insn_assert("vcrnf", s390_host_has_nnpa); + if (! s390_host_has_nnpa) { + emulation_failure(EmFail_S390X_nnpa); + return "vcrnf"; + } s390x_vec_op_details_t details = { .serialized = 0ULL }; details.op = S390_VEC_OP_VCRNF; @@ -19732,7 +20011,10 @@ s390_irgen_VCRNF(UChar v1, UChar v2, UChar v3, UChar m4, UChar m5) static const HChar * s390_irgen_NNPA(void) { - s390_insn_assert("nnpa", s390_host_has_nnpa); + if (! s390_host_has_nnpa) { + emulation_failure(EmFail_S390X_nnpa); + return "nnpa"; + } extension(S390_EXT_NNPA, 0); return "nnpa"; } @@ -19740,6 +20022,10 @@ s390_irgen_NNPA(void) static const HChar * s390_irgen_KM(UChar r1, UChar r2) { + if (! s390_host_has_msa) { + emulation_failure(EmFail_S390X_msa); + return "km"; + } s390_insn_assert("km", r1 != 0 && r1 % 2 == 0 && r2 != 0 && r2 % 2 == 0); extension(S390_EXT_KM, r1 | (r2 << 4)); return "km"; @@ -19748,6 +20034,10 @@ s390_irgen_KM(UChar r1, UChar r2) static const HChar * s390_irgen_KMC(UChar r1, UChar r2) { + if (! s390_host_has_msa) { + emulation_failure(EmFail_S390X_msa); + return "kmc"; + } s390_insn_assert("kmc", r1 != 0 && r1 % 2 == 0 && r2 != 0 && r2 % 2 == 0); extension(S390_EXT_KMC, r1 | (r2 << 4)); return "kmc"; @@ -19756,6 +20046,10 @@ s390_irgen_KMC(UChar r1, UChar r2) static const HChar * s390_irgen_KIMD(UChar r1, UChar r2) { + if (! s390_host_has_msa) { + emulation_failure(EmFail_S390X_msa); + return "kimd"; + } /* r1 is reserved */ s390_insn_assert("kimd", r2 != 0 && r2 % 2 == 0); extension(S390_EXT_KIMD, r1 | (r2 << 4)); @@ -19765,6 +20059,10 @@ s390_irgen_KIMD(UChar r1, UChar r2) static const HChar * s390_irgen_KLMD(UChar r1, UChar r2) { + if (! s390_host_has_msa) { + emulation_failure(EmFail_S390X_msa); + return "klmd"; + } /* r1 is only used by some functions */ s390_insn_assert("klmd", r2 != 0 && r2 % 2 == 0); extension(S390_EXT_KLMD, r1 | (r2 << 4)); @@ -19774,6 +20072,10 @@ s390_irgen_KLMD(UChar r1, UChar r2) static const HChar * s390_irgen_KMAC(UChar r1, UChar r2) { + if (! s390_host_has_msa) { + emulation_failure(EmFail_S390X_msa); + return "kmac"; + } /* r1 is ignored */ s390_insn_assert("kmac", r2 != 0 && r2 % 2 == 0); extension(S390_EXT_KMAC, r1 | (r2 << 4)); @@ -19783,6 +20085,10 @@ s390_irgen_KMAC(UChar r1, UChar r2) static const HChar * s390_irgen_PCC(void) { + if (! s390_host_has_msa4) { + emulation_failure(EmFail_S390X_msa4); + return "pcc"; + } extension(S390_EXT_PCC, 0); return "pcc"; } @@ -19790,6 +20096,10 @@ s390_irgen_PCC(void) static const HChar * s390_irgen_KMCTR(UChar r3, UChar r1, UChar r2) { + if (! s390_host_has_msa4) { + emulation_failure(EmFail_S390X_msa4); + return "kmctr"; + } s390_insn_assert("kmctr", r1 % 2 == 0 && r1 != 0 && r2 % 2 == 0 && r2 != 0 && r3 % 2 == 0 && r3 != 0); extension(S390_EXT_KMCTR, r1 | (r2 << 4) | (r3 << 8)); @@ -19799,6 +20109,10 @@ s390_irgen_KMCTR(UChar r3, UChar r1, UChar r2) static const HChar * s390_irgen_KMO(UChar r1, UChar r2) { + if (! s390_host_has_msa4) { + emulation_failure(EmFail_S390X_msa4); + return "kmo"; + } s390_insn_assert("kmo", r1 != 0 && r1 % 2 == 0 && r2 != 0 && r2 % 2 == 0); extension(S390_EXT_KMO, r1 | (r2 << 4)); return "kmo"; @@ -19807,6 +20121,10 @@ s390_irgen_KMO(UChar r1, UChar r2) static const HChar * s390_irgen_KMF(UChar r1, UChar r2) { + if (! s390_host_has_msa4) { + emulation_failure(EmFail_S390X_msa4); + return "kmf"; + } s390_insn_assert("kmf", r1 != 0 && r1 % 2 == 0 && r2 != 0 && r2 % 2 == 0); extension(S390_EXT_KMF, r1 | (r2 << 4)); return "kmf"; @@ -19815,6 +20133,10 @@ s390_irgen_KMF(UChar r1, UChar r2) static const HChar * s390_irgen_KMA(UChar r3, UChar r1, UChar r2) { + if (! s390_host_has_msa8) { + emulation_failure(EmFail_S390X_msa8); + return "kma"; + } s390_insn_assert("kma", r1 % 2 == 0 && r1 != 0 && r2 % 2 == 0 && r2 != 0 && r3 % 2 == 0 && r3 != 0); extension(S390_EXT_KMA, r1 | (r2 << 4) | (r3 << 8)); @@ -19824,6 +20146,10 @@ s390_irgen_KMA(UChar r3, UChar r1, UChar r2) static const HChar * s390_irgen_KDSA(UChar r1, UChar r2) { + if (! s390_host_has_msa9) { + emulation_failure(EmFail_S390X_msa9); + return "kdsa"; + } /* r1 is reserved */ s390_insn_assert("kdsa", r2 != 0 && r2 % 2 == 0); exten... [truncated message content] |