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: Florian K. <fk...@so...> - 2025-04-11 11:57:39
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=e4fa98e0eac13b9c1333711288af707cb4dccd10 commit e4fa98e0eac13b9c1333711288af707cb4dccd10 Author: Florian Krohm <fl...@ei...> Date: Fri Apr 11 11:55:24 2025 +0000 s390x: In s390_disasm_aux - simplify control flow a bit. Diff: --- VEX/priv/s390_disasm.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/VEX/priv/s390_disasm.c b/VEX/priv/s390_disasm.c index 139e141990..0b03c14edd 100644 --- a/VEX/priv/s390_disasm.c +++ b/VEX/priv/s390_disasm.c @@ -1093,14 +1093,11 @@ s390_disasm_aux(const s390_opnd *opnds, const HChar *xmnm, HChar *p, vassert(opnds[0].kind == S390_OPND_MNM || opnds[0].kind == S390_OPND_XMNM); - Int separator = 0; + Int write_separator = 0; // no separator after mnemonic for (UInt ix = 0; opnds[ix].kind != S390_OPND_DONE; ++ix) { const s390_opnd *opnd = opnds + ix; - if (ix > 1 && separator) - *p++ = ','; - switch (opnd->kind) { case S390_OPND_MNM: p += vex_sprintf(p, "%s", padmnm(opnd->mnm)); @@ -1132,13 +1129,9 @@ s390_disasm_aux(const s390_opnd *opnds, const HChar *xmnm, HChar *p, UInt value; if (mh && mh(ix, opnd->mask, &value)) p += vex_sprintf(p, "%u", value); - else { - if (ix != 1) - (*--p) = '\0'; // overwrite the separator - else - separator = 0; - } - continue; // *not* break + else + write_separator = 0; + break; } case S390_OPND_UINT: @@ -1204,8 +1197,14 @@ s390_disasm_aux(const s390_opnd *opnds, const HChar *xmnm, HChar *p, break; } - separator = ','; + if (write_separator) + *p++ = ','; + write_separator = 1; } + + if (p[-1] == ',') // remove trailing separator, if any + *--p = '\0'; + return p; } |
From: Florian K. <fl...@ei...> - 2025-04-10 21:00:47
|
On 10.04.25 21:35, Paul Floyd via Valgrind-developers wrote: > > > One other thing. > > https://bugs.kde.org/show_bug.cgi?id=497977 > > Making a change so that the 'fishy' warnings show both signed and unsigned > values is pretty straightforward. > Yes. In https://bugs.kde.org/show_bug.cgi?id=497977#c9 I had recommended to change the wording like so: Argument 'size' of function malloc is excessively large: <value in hex>. Perhaps a negative value of <negative value here> was passed. The person who had opened the BZ considered that change an improvement (in comment #10). Cheers, Florian |
From: John R. <jr...@bi...> - 2025-04-10 20:25:20
|
> https://bugs.kde.org/show_bug.cgi?id=497977 Don't sugar-coat the reporting of the user error. The declaration is "void *malloc(size_t size);" memcheck should print the argument as size_t, which is some flavor of unsigned. If the user wants to believe otherwise, then the user can use a debugger or other tool to convert. |
From: Paul F. <pj...@wa...> - 2025-04-10 19:35:58
|
One other thing. https://bugs.kde.org/show_bug.cgi?id=497977 Making a change so that the 'fishy' warnings show both signed and unsigned values is pretty straightforward. The guy the reported the bugzi item couldn't get it into his head that you can call malloc and family with a signed value which gets implicitly converted to size_t. This problem came up at work last week, and it was another case of signed arithmetic wrapping and becoming negative. Other than artificial testcases using values in the top half of the 64bit unsigned value range I don't see this happening in the real world and so can't see much benefit in making this change. Does anyone else think that showing the unsigned value would be useful? A+ Paul |
From: Paul F. <pa...@so...> - 2025-04-10 18:57:00
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=3d7fdf7ecf2c0e50fc45a9ef97686f5a99261944 commit 3d7fdf7ecf2c0e50fc45a9ef97686f5a99261944 Author: Paul Floyd <pj...@wa...> Date: Sun May 19 11:55:30 2024 +0200 Bug 290061 - pie elf always loaded at 0x108000 Initial patch from Amir Szekely <ki...@gm... Diff: --- .gitignore | 1 + NEWS | 1 + coregrind/m_ume/elf.c | 22 +++++++++++++--------- none/tests/Makefile.am | 6 +++++- none/tests/bug290061.c | 5 +++++ none/tests/bug290061.stderr.exp | 0 none/tests/bug290061.vgtest | 3 +++ 7 files changed, 28 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index f58e91dd83..43b5d9b6ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1552,6 +1552,7 @@ /none/tests/blockfault /none/tests/bug129866 /none/tests/bug234814 +/none/tests/bug290061 /none/tests/bug491394 /none/tests/bug492678 /none/tests/closeall diff --git a/NEWS b/NEWS index ee501aef69..98270e95e6 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,7 @@ bugzilla (https://bugs.kde.org/enter_bug.cgi?product=valgrind) rather than mailing the developers (or mailing lists) directly -- bugs that are not entered into bugzilla tend to get forgotten about or ignored. +290061 pie elf always loaded at 0x108000 396415 Valgrind is not looking up $ORIGIN rpath of shebang programs 420682 io_pgetevents is not supported 469782 Valgrind does not support zstd-compressed debug sections diff --git a/coregrind/m_ume/elf.c b/coregrind/m_ume/elf.c index bad7e5ee6b..67d3139d29 100644 --- a/coregrind/m_ume/elf.c +++ b/coregrind/m_ume/elf.c @@ -513,8 +513,8 @@ Bool VG_(match_ELF)(const void *hdr, SizeT len) required. mapelf() returns the address just beyond the end of the furthest-along mapping it creates. The executable is mapped starting at EBASE, which is usually read from it (eg, 0x8048000 - etc) except if it's a PIE, in which case I'm not sure what - happens. + etc) except if it's a PIE, in which case aspacem is queried for + the first adequately sized segement. The returned address is recorded in info->brkbase as the start point of the brk (data) segment, as it is traditional to place @@ -566,10 +566,8 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info) return VKI_ENOEXEC; /* The kernel maps position-independent executables at TASK_SIZE*2/3; - duplicate this behavior as close as we can. */ + for us it's good enough to just load it somewhere with enough free space. */ if (e->e.e_type == ET_DYN && ebase == 0) { - ebase = VG_PGROUNDDN(info->exe_base - + (info->exe_end - info->exe_base) * 2 / 3); /* We really don't want to load PIEs at zero or too close. It works, but it's unrobust (NULL pointer reads and writes become legit, which is really bad) and causes problems for @@ -582,13 +580,19 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info) /* Later .. on mips64 we can't use 0x108000, because mapelf will fail. */ # if defined(VGP_mips64_linux) + ebase = VG_PGROUNDDN(info->exe_base + + (info->exe_end - info->exe_base) * 2 / 3); if (ebase < 0x100000) ebase = 0x100000; # else - vg_assert(VKI_PAGE_SIZE >= 4096); /* stay sane */ - ESZ(Addr) hacky_load_address = 0x100000 + 8 * VKI_PAGE_SIZE; - if (ebase < hacky_load_address) - ebase = hacky_load_address; + Bool ok = False; + ebase = VG_(am_get_advisory_client_simple)( 0, e->p->p_filesz, &ok ); + + if (!ok) { + VG_(printf)( "Cannot find segment large enough to contain %llx bytes\n", (ULong)e->p->p_filesz ); + return VKI_ENOMEM; + } + # endif # if defined(VGO_solaris) diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index d119c74a1d..8bd4b9bf28 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -106,6 +106,7 @@ EXTRA_DIST = \ bitfield1.stderr.exp bitfield1.vgtest \ bug129866.vgtest bug129866.stderr.exp bug129866.stdout.exp \ bug234814.vgtest bug234814.stderr.exp bug234814.stdout.exp \ + bug290061.vgtest bug290061.stderr.exp \ bug491394.vgtest bug491394.stderr.exp \ bug492678.vgtest bug492678.stderr.exp \ closeall.stderr.exp closeall.vgtest \ @@ -273,7 +274,9 @@ check_PROGRAMS = \ args \ async-sigs \ bitfield1 \ - bug129866 bug234814 bug492678\ + bug129866 bug234814 \ + bug290061 \ + bug492678 \ closeall coolo_strlen \ discard exec-sigmask execve faultstatus fcntl_setown \ fdleak_cmsg fdleak_creat fdleak_dup fdleak_dup2 \ @@ -371,6 +374,7 @@ AM_CXXFLAGS += $(AM_FLAG_M3264_PRI) # Extra stuff for C tests ansi_CFLAGS = $(AM_CFLAGS) -ansi +bug290061_CFLAGS = ${AM_CFLAGS} -pie bug491394_LDADD = -lc bug491394_LDFLAGS = -nostdlib -static bug491394_CFLAGS = ${AM_CFLAGS} -Os diff --git a/none/tests/bug290061.c b/none/tests/bug290061.c new file mode 100644 index 0000000000..40d847e8e1 --- /dev/null +++ b/none/tests/bug290061.c @@ -0,0 +1,5 @@ +static char meh[3000000]; // ~3mb +int main(void) +{ +} + diff --git a/none/tests/bug290061.stderr.exp b/none/tests/bug290061.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/none/tests/bug290061.vgtest b/none/tests/bug290061.vgtest new file mode 100644 index 0000000000..ab6217ac0c --- /dev/null +++ b/none/tests/bug290061.vgtest @@ -0,0 +1,3 @@ +prereq: ! ../../tests/arch_test mips64 +prog: bug290061 +vgopts: -q |
From: Paul F. <pj...@wa...> - 2025-04-10 05:39:56
|
On 06-04-25 14:03, Mark Wielaard wrote: > Hi Valgrind hackers, > > Normally we do a major releases in April and October. We have been > updating the VALGRIND_3_24_BRANCH but there has been lots of activity > that hasn't landed there. So it is time to prepare for a new major > release. > > I am proposing to do a release on Wednesday April 23. With an RC1 a > week before, Wednesday April 16. And a RC2 on Monday April 21. > > Please try to schedule major updates before RC1 and at the latest RC2. > With only documentation, testcase and regression bug fixes after RC2. Hi Mark Good news. No major things on the cards for me. I've tested https://bugs.kde.org/show_bug.cgi?id=486398 I might reorder the case statements to put them in numerical order and also make some effort to understand the new opcodes and corresponding VEX. Do you think that you could also take a look at the diffs? If https://bugs.kde.org/show_bug.cgi?id=290061 is clean with a try- push I'll merge that. It's probably more important for clang(++) which defaults to using PIE. If I have the time to finish cleaning up regtest for https://bugs.kde.org/show_bug.cgi?id=390310 I'll push that as well. After that, maybe some small cleanup for Illumos and arm64, time permitting. A+ Paul |
From: Paul F. <pa...@so...> - 2025-04-09 06:53:05
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=4f023b20b98880a838f1abe946c4446b579771a4 commit 4f023b20b98880a838f1abe946c4446b579771a4 Author: Paul Floyd <pj...@wa...> Date: Wed Apr 9 08:49:52 2025 +0200 Helgrind: Fixes for ETIMEDOUT pthread_rwlock_timedrdlock and pthread_rwlock_clockrdlock were generating API errors if they timed out. This fixes that and only generates API errors for non-zero and non-ETIMEDOUT return codes. Diff: --- helgrind/hg_intercepts.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c index d41cb66048..e639abca84 100644 --- a/helgrind/hg_intercepts.c +++ b/helgrind/hg_intercepts.c @@ -2781,8 +2781,10 @@ static int pthread_rwlock_timedrdlock_WRK(pthread_rwlock_t *rwlock, DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST, pthread_rwlock_t *, rwlock, long, 0/*isW*/, long, (ret == 0) ? True : False); + if (ret != 0) { - DO_PthAPIerror("pthread_rwlock_timedrdlock", ret); + if (ret != ETIMEDOUT) + DO_PthAPIerror("pthread_rwlock_timedrdlock", ret); } if (TRACE_PTH_FNS) { @@ -2847,8 +2849,10 @@ static int pthread_rwlock_clockrdlock_WRK(pthread_rwlock_t *rwlock, pthread_rwlock_t *, rwlock, long, 0/*isW*/, long, (ret == 0) ? True : False); } + if (ret != 0) { - DO_PthAPIerror("pthread_rwlock_clockrdlock", ret); + if (ret != ETIMEDOUT) + DO_PthAPIerror("pthread_rwlock_clockrdlock", ret); } if (TRACE_PTH_FNS) { |
From: Paul F. <pa...@so...> - 2025-04-06 18:51:50
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=c87f1f3c667c280f490996e254caae441079e4f1 commit c87f1f3c667c280f490996e254caae441079e4f1 Author: Paul Floyd <pj...@wa...> Date: Sun Apr 6 20:47:39 2025 +0200 Illumos helgrind: redir, filter and suppresions Add a redir for sem_timedwait (Solaris redirects sema_timedwait which seems to have been replaced on Illumos). Filter the arena size for the free_is_write test Use the Illumos expected for gone_abrt_xml Add Helgrind suppressions for printf, pthread_barrier_init and pthread_barrier_destroy. Diff: --- helgrind/hg_intercepts.c | 5 +++++ helgrind/tests/filter_stderr_solaris | 6 ++++++ memcheck/tests/gone_abrt_xml.stderr.exp-solaris | 5 +++++ solaris11.supp | 20 ++++++++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c index 54711d8f26..d41cb66048 100644 --- a/helgrind/hg_intercepts.c +++ b/helgrind/hg_intercepts.c @@ -3402,6 +3402,11 @@ LIBC_FUNC(int, semZutimedwait, sem_t* sem, const struct timespec* abs_timeout) { PTH_FUNC(int, semaZutimedwait, sem_t *sem, const struct timespec* abs_timeout) { /* sema_timedwait */ return sem_timedwait_WRK(sem, abs_timeout); } +#if defined(__illumos__) +PTH_FUNC(int, semZutimedwait, sem_t *sem, const struct timespec* abs_timeout) { /* sem_timedwait */ + return sem_timedwait_WRK(sem, abs_timeout); +} +#endif #else # error "Unsupported OS" #endif diff --git a/helgrind/tests/filter_stderr_solaris b/helgrind/tests/filter_stderr_solaris index 56ecfb3fb0..b82dde943f 100755 --- a/helgrind/tests/filter_stderr_solaris +++ b/helgrind/tests/filter_stderr_solaris @@ -33,3 +33,9 @@ my $check = join "|", keys %regex; if (! /: pthread_/ && ! /WRK/) { s/($check)(.*hg_intercepts.c)/$regex{$1}$2/g; } + +# this is for free_is_write on Illumos +# on other platforms a 10 byte alloc results in a 16 byte arena +# on Illumos there are many other allocations resulting in a +# 4Mbyte arena +s/4,194,208 in arena/16 in arena/; diff --git a/memcheck/tests/gone_abrt_xml.stderr.exp-solaris b/memcheck/tests/gone_abrt_xml.stderr.exp-solaris index db2109f4df..a6c88df27e 100644 --- a/memcheck/tests/gone_abrt_xml.stderr.exp-solaris +++ b/memcheck/tests/gone_abrt_xml.stderr.exp-solaris @@ -37,6 +37,11 @@ aborting ... <signame>SIGABRT</signame> <sicode>0</sicode> <stack> + <frame> + <ip>0x........</ip> + <obj>...</obj> + <fn>_start_crt</fn> + </frame> <frame> <ip>0x........</ip> <obj>...</obj> diff --git a/solaris11.supp b/solaris11.supp index e3ef0b7843..c772df3955 100644 --- a/solaris11.supp +++ b/solaris11.supp @@ -62,4 +62,24 @@ fun:gomp_team_start fun:GOMP_parallel } +# conflict between printf and _setorientation on data symbol "_iob" +{ + Illumos:printf + Helgrind:Race + fun:printf +} +# conflict between pthread_barrier_init and pthread_barrier_wait +{ + Illumos:pthread_barrier_init + Helgrind:Race + fun:pthread_barrier_init +} +# conflict between pthread_barrier_destroy and pthread_barrier_wait +{ + Illumos:pthread_barrier_destroy + Helgrind:Race + fun:memset + fun:pthread_barrier_destroy + fun:pthread_barrier_destroy +} |
From: Mark W. <ma...@kl...> - 2025-04-06 14:04:03
|
Hi Valgrind hackers, Normally we do a major releases in April and October. We have been updating the VALGRIND_3_24_BRANCH but there has been lots of activity that hasn't landed there. So it is time to prepare for a new major release. I am proposing to do a release on Wednesday April 23. With an RC1 a week before, Wednesday April 16. And a RC2 on Monday April 21. Please try to schedule major updates before RC1 and at the latest RC2. With only documentation, testcase and regression bug fixes after RC2. Thanks, Mark |
From: Mark W. <ma...@kl...> - 2025-04-06 13:24:22
|
Hi, On Mon, Mar 31, 2025 at 11:29:41AM +0200, Mark Wielaard wrote: > On Fri, Mar 28, 2025 at 07:02:28PM +0100, Mark Wielaard wrote: > > On Fri, 2025-03-21 at 14:01 +0100, Florian Weimer wrote: > > > Without this change, the system call wrapper function is not visible > > > on the stack at the time of the system call, which causes problems > > > for interception tools such as valgrind. > > > > > > Enhances commit 89b53077d2a58f00e7debdfe58afabe953dac60d ("nptl: Fix > > > Race conditions in pthread cancellation [BZ#12683]"). > > > > > > Tested on i686-linux-gnu, powerpc64le-linux-gnu, x86_64-linux-gnu. > > > (We're still discussing if valgrind needs this, but if it does, here's a > > > patch.) > > > > I implemented the valgrind part of skipping the syscall_cancel frames > > here: https://bugs.kde.org/show_bug.cgi?id=502126#c2 > > And there is a valgrind package build for fedora rawhide: > > https://koji.fedoraproject.org/koji/buildinfo?buildID=2687393 > > > > For ppc64le, s390x and x86_64 that patch seems enough. > > > > For i686 and aarch64 there does seem to be an issue with missing the > > glibc calling function because of a tail call. > > > > Also on i686 there is another extra frame on top __libc_do_syscall. > > I extended the patch to cover some extra sycall wrapper function > symbols on i386 and armhf and pushed it to valgrind trunk and > VALGRIND_3_24_BRANCH. There are builds for fedora rawhide and > f42. This does seem to show that only on arm64 the tail calls > obscure observing the full call stack. This has now landed in fedora rawhide and f42. Test results look good, except for some if the arm64 tests where the tail calls obscure observing the full call stack. Please let me know if you need any more input from us to get this fix in glibc. Cheers, Mark |
From: Paul F. <pa...@so...> - 2025-04-05 06:19:00
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=7d3ee1f1a0a5f6e425dc2a052926fe2d34de46c1 commit 7d3ee1f1a0a5f6e425dc2a052926fe2d34de46c1 Author: Paul Floyd <pj...@wa...> Date: Sat Apr 5 08:16:54 2025 +0200 Illumos resgtest: revert previous change to filter_libc and update expected instead Diff: --- drd/tests/pth_cond_destroy_busy.stderr.exp-solaris | 2 +- tests/filter_libc | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drd/tests/pth_cond_destroy_busy.stderr.exp-solaris b/drd/tests/pth_cond_destroy_busy.stderr.exp-solaris index 392bc1d0fe..583c32dc55 100644 --- a/drd/tests/pth_cond_destroy_busy.stderr.exp-solaris +++ b/drd/tests/pth_cond_destroy_busy.stderr.exp-solaris @@ -23,7 +23,7 @@ condition variable has been destroyed while being waited upon: cond 0x........, at 0x........: pthread_cond_wait (drd_pthread_intercepts.c:?) by 0x........: thread_func (pth_cond_destroy_busy.c:?) by 0x........: vgDrd_thread_wrapper (drd_pthread_intercepts.c:?) - by 0x........: (within libpthread-?.?.so) + by 0x........: start_thread Thread 1: not a condition variable: cond 0x........ diff --git a/tests/filter_libc b/tests/filter_libc index a99b11f405..d3c875d90f 100755 --- a/tests/filter_libc +++ b/tests/filter_libc @@ -28,7 +28,6 @@ while (<>) # on Illumos s#_start_crt \(in .*#(below main)#; - s#start_thread#(within libpthread-?.?.so)#; # filter out the exact libc-start.c:### line number. (ppc64*) s/\(libc-start.c:[0-9]*\)$/(in \/...libc...)/; |
From: Paul F. <pa...@so...> - 2025-04-04 20:03:12
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=fc5099c2b73a4d26c8c23659221f566be56f0e82 commit fc5099c2b73a4d26c8c23659221f566be56f0e82 Author: Paul Floyd <pj...@wa...> Date: Fri Apr 4 22:00:38 2025 +0200 Illumos regtest: one filter and one pre script fix filter a change for the bottom of thread stacks and add use the same pre check as Linux for DRD OpenMP tests. Diff: --- drd/tests/run_openmp_test | 2 +- tests/filter_libc | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drd/tests/run_openmp_test b/drd/tests/run_openmp_test index e09b543467..e978625400 100755 --- a/drd/tests/run_openmp_test +++ b/drd/tests/run_openmp_test @@ -13,7 +13,7 @@ if /usr/bin/file "$1" | grep -q 'statically linked'; then exit 1 fi -if [ "$(uname)" = Linux ]; then +if [ "$(uname)" = Linux -o "$(uname)" = SunOS ]; then # Let the dynamic linker/loader print the path of libgomp. See also man ld.so libgomp_path="$(LD_TRACE_LOADED_OBJECTS=1 "$1" \ diff --git a/tests/filter_libc b/tests/filter_libc index d3c875d90f..a99b11f405 100755 --- a/tests/filter_libc +++ b/tests/filter_libc @@ -28,6 +28,7 @@ while (<>) # on Illumos s#_start_crt \(in .*#(below main)#; + s#start_thread#(within libpthread-?.?.so)#; # filter out the exact libc-start.c:### line number. (ppc64*) s/\(libc-start.c:[0-9]*\)$/(in \/...libc...)/; |
From: Paul F. <pa...@so...> - 2025-04-03 20:05:55
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=43957bdc6b9b1146cda0f4e6f558286f9b05c329 commit 43957bdc6b9b1146cda0f4e6f558286f9b05c329 Author: Paul Floyd <pj...@wa...> Date: Thu Apr 3 19:56:51 2025 +0200 Illumos helgrind: fix for pthread_rwlock_timedrdlock and pthread_rwlock_timedrwlock On Illumos these two functions are implemented by calling pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock respectively. Since we intercept both it was appearing as though the lock was being taken recursively when it wasn't. Fixed it by using a static flag for each and not callinng the client requests if already in a call to the timed functions. I think that musl also does this but, ho-hum, Helgrind has never worked on musl. Diff: --- helgrind/hg_intercepts.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c index 661ab1a093..54711d8f26 100644 --- a/helgrind/hg_intercepts.c +++ b/helgrind/hg_intercepts.c @@ -2750,6 +2750,7 @@ static int pthread_rwlock_tryrdlock_WRK(pthread_rwlock_t* rwlock) # error "Unsupported OS" #endif +static Bool in_pthread_rwlock_timedrdlock_WRK = False; //----------------------------------------------------------- // glibc: pthread_rwlock_timedrdlock @@ -2773,7 +2774,9 @@ static int pthread_rwlock_timedrdlock_WRK(pthread_rwlock_t *rwlock, pthread_rwlock_t *, rwlock, long, 0/*isW*/, long, 0/*isTryLock*/); + in_pthread_rwlock_timedrdlock_WRK = True; CALL_FN_W_WW(ret, fn, rwlock, timeout); + in_pthread_rwlock_timedrdlock_WRK = False; DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST, pthread_rwlock_t *, rwlock, long, 0/*isW*/, @@ -2831,15 +2834,19 @@ static int pthread_rwlock_clockrdlock_WRK(pthread_rwlock_t *rwlock, fprintf(stderr, "<< pthread_rwl_clockrdl %p", rwlock); fflush(stderr); } - DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE, - pthread_rwlock_t *, rwlock, - long, 0/*isW*/, long, 0/*isTryLock*/); + if (!in_pthread_rwlock_timedrdlock_WRK) { + DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE, + pthread_rwlock_t *, rwlock, + long, 0/*isW*/, long, 0/*isTryLock*/); + } CALL_FN_W_WWW(ret, fn, rwlock, clockid, timeout); - DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST, - pthread_rwlock_t *, rwlock, long, 0/*isW*/, - long, (ret == 0) ? True : False); + if (!in_pthread_rwlock_timedrdlock_WRK) { + DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST, + pthread_rwlock_t *, rwlock, long, 0/*isW*/, + long, (ret == 0) ? True : False); + } if (ret != 0) { DO_PthAPIerror("pthread_rwlock_clockrdlock", ret); } @@ -2858,6 +2865,7 @@ PTH_FUNC(int, pthreadZurwlockZuclockrdlock, // pthread_rwlock_clockrdlock } #endif +static Bool in_pthread_rwlock_timedwrlock_WRK = False; //----------------------------------------------------------- // glibc: pthread_rwlock_timedwrlock @@ -2880,7 +2888,9 @@ static int pthread_rwlock_timedwrlock_WRK(pthread_rwlock_t *rwlock, pthread_rwlock_t *, rwlock, long, 1/*isW*/, long, 0/*isTryLock*/); + in_pthread_rwlock_timedwrlock_WRK = True; CALL_FN_W_WW(ret, fn, rwlock, timeout); + in_pthread_rwlock_timedwrlock_WRK = False; DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST, pthread_rwlock_t *, rwlock, long, 1/*isW*/, @@ -2925,6 +2935,7 @@ PTH_FUNC(int, pthreadZurwlockZutimedwrlock, // pthread_rwlock_timedwrlock #if defined(VGO_linux) || defined(VGO_solaris) //----------------------------------------------------------- // glibc: pthread_rwlock_clockwrlock +// Illumos: pthread_rwlock_clockwrlock // __attribute__((noinline)) __attribute__((unused)) static int pthread_rwlock_clockwrlock_WRK(pthread_rwlock_t *rwlock, @@ -2938,15 +2949,19 @@ static int pthread_rwlock_clockwrlock_WRK(pthread_rwlock_t *rwlock, fprintf(stderr, "<< pthread_rwl_clockwrl %p", rwlock); fflush(stderr); } - DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE, - pthread_rwlock_t *, rwlock, - long, 1/*isW*/, long, 0/*isTryLock*/); + if (!in_pthread_rwlock_timedwrlock_WRK) { + DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_PRE, + pthread_rwlock_t *, rwlock, + long, 1/*isW*/, long, 0/*isTryLock*/); + } CALL_FN_W_WWW(ret, fn, rwlock, clockid, timeout); - DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST, - pthread_rwlock_t *, rwlock, long, 1/*isW*/, - long, (ret == 0) ? True : False); + if (!in_pthread_rwlock_timedwrlock_WRK) { + DO_CREQ_v_WWW(_VG_USERREQ__HG_PTHREAD_RWLOCK_LOCK_POST, + pthread_rwlock_t *, rwlock, long, 1/*isW*/, + long, (ret == 0) ? True : False); + } if (ret != 0) { DO_PthAPIerror("pthread_rwlock_clockwrlock", ret); } |
From: Andreas A. <ar...@so...> - 2025-04-03 17:23:52
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=5cb67042c8dfae139def50942dfa8243442752df commit 5cb67042c8dfae139def50942dfa8243442752df Author: Andreas Arnez <ar...@li...> Date: Thu Apr 3 17:40:03 2025 +0200 s390x: Support the PPA instruction The perform processor assist (PPA) instruction provides the CPU with special execution hints. It belongs to the processor-assist facility, which shares facility bit 49 with the execution-hint and load-and-trap facilities and with the miscellaneous-instruction-extensions facility 1. Implementing PPA enables setting facility bit 49 to one. Similar to other execution hint instructions, implement PPA as a no-op for now. Diff: --- VEX/priv/guest_s390_toIR.c | 12 +++++++++++- coregrind/m_extension/extension-s390x.c | 2 +- docs/internals/s390-opcodes.csv | 2 +- none/tests/s390x/disasm-test/opcode.c | 3 ++- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 6639b1b7bc..f2ef193765 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -20664,6 +20664,15 @@ s390_irgen_NIAI(UChar i1, UChar i2) return "niai"; } +static const HChar * +s390_irgen_PPA(UChar m3, UChar r1, UChar r2) +{ + /* Treat as a no-op. m3 could indicate one of the following: + 1: transaction-abort assist -- fine, we don't support transactions + 15: in-order-execution assist -- we don't claim support */ + return "ppa"; +} + /* New insns are added here. If an insn is contingent on a facility being installed also check whether function do_extension_STFLE needs updating. */ @@ -21020,7 +21029,8 @@ s390_decode_4byte_and_irgen(const UChar *bytes) case 0xb2e1: /* SPCTR */ goto unimplemented; case 0xb2e4: /* ECCTR */ goto unimplemented; case 0xb2e5: /* EPCTR */ goto unimplemented; - case 0xb2e8: /* PPA */ goto unimplemented; + case 0xb2e8: s390_format_RRFa_U0RR(s390_irgen_PPA, RRF2_m3(ovl), + RRF2_r1(ovl), RRF2_r2(ovl)); goto ok; case 0xb2ec: /* ETND */ goto unimplemented; case 0xb2ed: /* ECPGA */ goto unimplemented; case 0xb2f8: /* TEND */ goto unimplemented; diff --git a/coregrind/m_extension/extension-s390x.c b/coregrind/m_extension/extension-s390x.c index 5751afc87b..85b99ad086 100644 --- a/coregrind/m_extension/extension-s390x.c +++ b/coregrind/m_extension/extension-s390x.c @@ -861,7 +861,7 @@ static enum ExtensionError do_extension_STFLE(ThreadState* tst, ULong variant) /* 44: PFPO, not fully supported */ | S390_SETBITS(45, 47) /* 48: DFP zoned-conversion, not supported */ - /* 49: includes PPA, not supported */ + | S390_SETBITS(49, 49) /* 50: constrained transactional-execution, not supported */ | S390_SETBITS(51, 55) /* 56: unassigned */ diff --git a/docs/internals/s390-opcodes.csv b/docs/internals/s390-opcodes.csv index 1d4afb75bb..abee097ace 100644 --- a/docs/internals/s390-opcodes.csv +++ b/docs/internals/s390-opcodes.csv @@ -968,7 +968,7 @@ tbeginc,"constrained transaction begin","not implemented",zEC12, tend,"transaction end","not implemented",zEC12, bpp,"branch prediction preload",implemented,zEC12, bprp,"branch prediction relative preload",implemented,zEC12, -ppa,"perform processor assist","not implemented",zEC12, +ppa,"perform processor assist",implemented,zEC12, niai,"next instruction access intent",implemented,zEC12, crdte,"compare and replace DAT table entry",N/A,"privileged instruction" lat,"load and trap 32 bit",implemented,zEC12, diff --git a/none/tests/s390x/disasm-test/opcode.c b/none/tests/s390x/disasm-test/opcode.c index bed2e278e4..24684a613a 100644 --- a/none/tests/s390x/disasm-test/opcode.c +++ b/none/tests/s390x/disasm-test/opcode.c @@ -106,6 +106,7 @@ msa8 --> message-security-assist extension 8 msa9 --> message-security-assist extension 9 nnpa --> neural-network-processing-assist facility + ppa --> processor-assist facility pfpo --> PFPO facility popc --> population-count facility == lsc stckf --> STCKF facility @@ -729,7 +730,7 @@ static const char *opcodes[] = { "pcc", // msa4 // plo not implemented - // ppa not implemented + "ppa r1,r2,m3:{1,15}", // ppa no spec exception for m3 "ppno r1,r2", // msa5 "prno r1,r2", // msa5 |
From: Andreas A. <ar...@so...> - 2025-04-03 17:23:47
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=a2e2a414251633ad38942c3a9c3cdced68e871e0 commit a2e2a414251633ad38942c3a9c3cdced68e871e0 Author: Andreas Arnez <ar...@li...> Date: Thu Apr 3 19:07:32 2025 +0200 s390x: Reflect renaming of DFP insns in opcode checker After renaming various DFP instructions to their new name, reflect this in s390-check-opcodes.pl by ignoring their old names, so the checker doesn't complain about mismatches. Also, add the missing documentation in s390-opcodes.csv about the fact that the "with rounding mode" instruction versions cgdtra, cgxtra, and cxgtra are implemented. Diff: --- auxprogs/s390-check-opcodes.pl | 47 +++++++---------------------------------- docs/internals/s390-opcodes.csv | 3 +++ 2 files changed, 11 insertions(+), 39 deletions(-) diff --git a/auxprogs/s390-check-opcodes.pl b/auxprogs/s390-check-opcodes.pl index bd1abc8057..4e0d2c6ac1 100755 --- a/auxprogs/s390-check-opcodes.pl +++ b/auxprogs/s390-check-opcodes.pl @@ -55,12 +55,20 @@ my @extended_mnemonics = ( # Base mnemonic(s) "bi", # bic 'brul?', 'jc', # brc + 'cf[dex]br', # cf[dex]bra + 'cg[dex]br', # cg[dex]dbra + 'c[dex]fbr', # c[dex]fbra + 'c[dex]gbr', # c[dex]gbra + 'c[dx]gtr', # c[dx]gtra + 'cg[dx]tr', # cg[dx]tra 'jasl?', 'jct[gh]?', 'jg?nop', 'jxleg?', 'jxhg?', 'l[de]rv', + 'l[de]xbr', # l[de]xbra + 'ledbr', # ledbra 'lfi', # iilf 'llg[fh]i', # llilf, llill 'notg?r', # nork, nogrk @@ -215,25 +223,6 @@ while (my $line = <OPC>) { next if ($mnemonic eq "cuutf"); # alternate mnemonic for cu21 next if ($mnemonic eq "cutfu"); # alternate mnemonic for cu12 - next if ($mnemonic eq "cfdbra"); # indistinguishable from cfdbr - next if ($mnemonic eq "cfebra"); # indistinguishable from cfebr - next if ($mnemonic eq "cfxbra"); # indistinguishable from cfxbr - next if ($mnemonic eq "cgdbra"); # indistinguishable from cgdbr - next if ($mnemonic eq "cgebra"); # indistinguishable from cgebr - next if ($mnemonic eq "cgxbra"); # indistinguishable from cgxbr - next if ($mnemonic eq "cdfbra"); # indistinguishable from cdfbr - next if ($mnemonic eq "cefbra"); # indistinguishable from cefbr - next if ($mnemonic eq "cxfbra"); # indistinguishable from cxfbr - next if ($mnemonic eq "cdgbra"); # indistinguishable from cdgbr - next if ($mnemonic eq "cegbra"); # indistinguishable from cegbr - next if ($mnemonic eq "cxgbra"); # indistinguishable from cxgbr - next if ($mnemonic eq "ldxbra"); # indistinguishable from ldxbr - next if ($mnemonic eq "lexbra"); # indistinguishable from lexbr - next if ($mnemonic eq "ledbra"); # indistinguishable from ledbr - next if ($mnemonic eq "cdgtr"); # indistinguishable from cdgtra - next if ($mnemonic eq "cxgtra"); # indistinguishable from cxgtr - next if ($mnemonic eq "cgdtra"); # indistinguishable from cgdtr - next if ($mnemonic eq "cgxtra"); # indistinguishable from cgxtr next if ($mnemonic eq "fidbr"); # indistinguishable from fidbra next if ($mnemonic eq "fiebr"); # indistinguishable from fiebra next if ($mnemonic eq "fixbr"); # indistinguishable from fixbra @@ -293,26 +282,6 @@ while (my $line = <CSV>) { $mnemonic =~ s/"//g; $description =~ s/"//g; - next if ($mnemonic eq "cfdbra"); # indistinguishable from cfdbr - next if ($mnemonic eq "cfebra"); # indistinguishable from cfebr - next if ($mnemonic eq "cfxbra"); # indistinguishable from cfxbr - next if ($mnemonic eq "cgdbra"); # indistinguishable from cgdbr - next if ($mnemonic eq "cgebra"); # indistinguishable from cgebr - next if ($mnemonic eq "cgxbra"); # indistinguishable from cgxbr - next if ($mnemonic eq "cdfbra"); # indistinguishable from cdfbr - next if ($mnemonic eq "cefbra"); # indistinguishable from cefbr - next if ($mnemonic eq "cxfbra"); # indistinguishable from cxfbr - next if ($mnemonic eq "cegbra"); # indistinguishable from cegbr - next if ($mnemonic eq "cdgbra"); # indistinguishable from cdgbr - next if ($mnemonic eq "cegbra"); # indistinguishable from cegbr - next if ($mnemonic eq "cxgbra"); # indistinguishable from cxgbr - next if ($mnemonic eq "ldxbra"); # indistinguishable from ldxbr - next if ($mnemonic eq "lexbra"); # indistinguishable from lexbr - next if ($mnemonic eq "ledbra"); # indistinguishable from ledbr - next if ($mnemonic eq "cdgtr"); # indistinguishable from cdgtra - next if ($mnemonic eq "cxgtra"); # indistinguishable from cxgtr - next if ($mnemonic eq "cgdtra"); # indistinguishable from cgdtr - next if ($mnemonic eq "cgxtra"); # indistinguishable from cgxtr next if ($mnemonic eq "fidbr"); # indistinguishable from fidbra next if ($mnemonic eq "fiebr"); # indistinguishable from fiebra next if ($mnemonic eq "fixbr"); # indistinguishable from fixbra diff --git a/docs/internals/s390-opcodes.csv b/docs/internals/s390-opcodes.csv index 931d8987cb..1d4afb75bb 100644 --- a/docs/internals/s390-opcodes.csv +++ b/docs/internals/s390-opcodes.csv @@ -950,6 +950,9 @@ clgdtr,"convert to 64 bit fixed logical from long dfp with rounding mode",implem clgxtr,"convert to 64 bit fixed logical from extended dfp with rounding mode",implemented clfdtr,"convert to 32 bit fixed logical from long dfp with rounding mode",implemented clfxtr,"convert to 32 bit fixed logical from extended dfp with rounding mode",implemented +cgdtra,"convert to 64 bit fixed from long dfp with rounding mode",implemented +cgxtra,"convert to 64 bit fixed from extended dfp with rounding mode",implemented +cxgtra,"convert from fixed extended dfp with rounding mode",implemented ddtra,"divide long dfp with rounding mode",implemented dxtra,"divide extended dfp with rounding mode",implemented mdtra,"multiply long dfp with rounding mode",implemented |
From: Florian K. <fk...@so...> - 2025-04-03 13:01:28
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=9dea723319b74582b153c3544e595cee7e362115 commit 9dea723319b74582b153c3544e595cee7e362115 Author: Florian Krohm <fl...@ei...> Date: Thu Apr 3 13:00:19 2025 +0000 s390x: Add missing s390_insn_assert for non-vector opcodes Based on the specification in disasm-test/opcode.c With a few corrections: - kma: tighten up the assert - cdftr, cxftr: no emulation failure when floating-point-extension facility is not installed - cgdtra, cgxtra: check for floating-point-extension facility - ltdtr, ltxtr, lxdtr: check for DFP facility Diff: --- VEX/priv/guest_s390_toIR.c | 422 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 361 insertions(+), 61 deletions(-) diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index a5b1fcae6a..6639b1b7bc 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -310,6 +310,15 @@ typedef enum { /*--- Helpers for constructing IR. ---*/ /*------------------------------------------------------------*/ +/* Whether or not REGNO designates a valid FPR pair. */ +#define is_valid_fpr_pair(regno) (((regno) & 0x2) == 0) + +/* Whether or not REGNO designates an even-odd GPR pair. */ +#define is_valid_gpr_pair(regno) (((regno) & 0x1) == 0) + +#define is_valid_rounding_mode(rm) ((rm) < 8 && (rm) != 2) + + /* Add a statement to the current irsb. */ static __inline__ void stmt(IRStmt *st) @@ -8595,6 +8604,8 @@ s390_irgen_LOCG(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_LPQ(UChar r1, IRTemp op2addr) { + s390_insn_assert("lpq", is_valid_gpr_pair(r1)); + put_gpr_dw0(r1, load(Ity_I64, mkexpr(op2addr))); put_gpr_dw0(r1 + 1, load(Ity_I64, binop(Iop_Add64, mkexpr(op2addr), mkU64(8)) )); @@ -8796,6 +8807,8 @@ s390_irgen_MVIY(UChar i2, IRTemp op1addr) static const HChar * s390_irgen_MR(UChar r1, UChar r2) { + s390_insn_assert("mr", is_valid_gpr_pair(r1)); + IRTemp op1 = newTemp(Ity_I32); IRTemp op2 = newTemp(Ity_I32); IRTemp result = newTemp(Ity_I64); @@ -8812,6 +8825,8 @@ s390_irgen_MR(UChar r1, UChar r2) static const HChar * s390_irgen_M(UChar r1, IRTemp op2addr) { + s390_insn_assert("m", is_valid_gpr_pair(r1)); + IRTemp op1 = newTemp(Ity_I32); IRTemp op2 = newTemp(Ity_I32); IRTemp result = newTemp(Ity_I64); @@ -8828,6 +8843,8 @@ s390_irgen_M(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_MFY(UChar r1, IRTemp op2addr) { + s390_insn_assert("mfy", is_valid_gpr_pair(r1)); + IRTemp op1 = newTemp(Ity_I32); IRTemp op2 = newTemp(Ity_I32); IRTemp result = newTemp(Ity_I64); @@ -8844,6 +8861,8 @@ s390_irgen_MFY(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_MG(UChar r1, IRTemp op2addr) { + s390_insn_assert("mg", is_valid_gpr_pair(r1)); + IRTemp op1 = newTemp(Ity_I64); IRTemp op2 = newTemp(Ity_I64); IRTemp result = newTemp(Ity_I128); @@ -8876,6 +8895,8 @@ s390_irgen_MGH(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_MGRK(UChar r3, UChar r1, UChar r2) { + s390_insn_assert("mgrk", is_valid_gpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I64); IRTemp op3 = newTemp(Ity_I64); IRTemp result = newTemp(Ity_I128); @@ -8956,6 +8977,8 @@ s390_irgen_MGHI(UChar r1, UShort i2) static const HChar * s390_irgen_MLR(UChar r1, UChar r2) { + s390_insn_assert("mlr", is_valid_gpr_pair(r1)); + IRTemp op1 = newTemp(Ity_I32); IRTemp op2 = newTemp(Ity_I32); IRTemp result = newTemp(Ity_I64); @@ -8972,6 +8995,8 @@ s390_irgen_MLR(UChar r1, UChar r2) static const HChar * s390_irgen_MLGR(UChar r1, UChar r2) { + s390_insn_assert("mlgr", is_valid_gpr_pair(r1)); + IRTemp op1 = newTemp(Ity_I64); IRTemp op2 = newTemp(Ity_I64); IRTemp result = newTemp(Ity_I128); @@ -8988,6 +9013,8 @@ s390_irgen_MLGR(UChar r1, UChar r2) static const HChar * s390_irgen_ML(UChar r1, IRTemp op2addr) { + s390_insn_assert("ml", is_valid_gpr_pair(r1)); + IRTemp op1 = newTemp(Ity_I32); IRTemp op2 = newTemp(Ity_I32); IRTemp result = newTemp(Ity_I64); @@ -9004,6 +9031,8 @@ s390_irgen_ML(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_MLG(UChar r1, IRTemp op2addr) { + s390_insn_assert("mlg", is_valid_gpr_pair(r1)); + IRTemp op1 = newTemp(Ity_I64); IRTemp op2 = newTemp(Ity_I64); IRTemp result = newTemp(Ity_I128); @@ -10037,6 +10066,8 @@ s390_irgen_SAR(UChar r1, UChar r2) static const HChar * s390_irgen_SLDA(UChar r1, IRTemp op2addr) { + s390_insn_assert("slda", is_valid_gpr_pair(r1)); + IRTemp p1 = newTemp(Ity_I64); IRTemp p2 = newTemp(Ity_I64); IRTemp op = newTemp(Ity_I64); @@ -10063,6 +10094,8 @@ s390_irgen_SLDA(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_SLDL(UChar r1, IRTemp op2addr) { + s390_insn_assert("sldl", is_valid_gpr_pair(r1)); + IRTemp p1 = newTemp(Ity_I64); IRTemp p2 = newTemp(Ity_I64); IRTemp result = newTemp(Ity_I64); @@ -10174,6 +10207,8 @@ s390_irgen_SLLG(UChar r1, UChar r3, IRTemp op2addr) static const HChar * s390_irgen_SRDA(UChar r1, IRTemp op2addr) { + s390_insn_assert("srda", is_valid_gpr_pair(r1)); + IRTemp p1 = newTemp(Ity_I64); IRTemp p2 = newTemp(Ity_I64); IRTemp result = newTemp(Ity_I64); @@ -10193,6 +10228,8 @@ s390_irgen_SRDA(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_SRDL(UChar r1, IRTemp op2addr) { + s390_insn_assert("srdl", is_valid_gpr_pair(r1)); + IRTemp p1 = newTemp(Ity_I64); IRTemp p2 = newTemp(Ity_I64); IRTemp result = newTemp(Ity_I64); @@ -10495,6 +10532,8 @@ s390_irgen_STOCG(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_STPQ(UChar r1, IRTemp op2addr) { + s390_insn_assert("stpq", is_valid_gpr_pair(r1)); + store(mkexpr(op2addr), get_gpr_dw0(r1)); store(binop(Iop_Add64, mkexpr(op2addr), mkU64(8)), get_gpr_dw0(r1 + 1)); @@ -11173,6 +11212,9 @@ s390_irgen_LDER(UChar r1, UChar r2) static const HChar * s390_irgen_LXR(UChar r1, UChar r2) { + s390_insn_assert("lxr", is_valid_fpr_pair(r1)); + s390_insn_assert("lxr", is_valid_fpr_pair(r2)); + put_fpr_dw0(r1, get_fpr_dw0(r2)); put_fpr_dw0(r1 + 2, get_fpr_dw0(r2 + 2)); @@ -11247,6 +11289,8 @@ s390_irgen_LZDR(UChar r1) static const HChar * s390_irgen_LZXR(UChar r1) { + s390_insn_assert("lzxr", is_valid_fpr_pair(r1)); + put_fpr_dw0(r1, mkF64i(0x0)); put_fpr_dw0(r1 + 2, mkF64i(0x0)); @@ -11448,6 +11492,8 @@ s390_irgen_CEFBRA(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + s390_insn_assert("cefbra", is_valid_rounding_mode(m3)); + IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -11458,9 +11504,11 @@ s390_irgen_CEFBRA(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDFBRA(UChar m3 __attribute__((unused)), +s390_irgen_CDFBRA(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { + s390_insn_assert("cdfbra", is_valid_rounding_mode(m3)); + IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -11477,6 +11525,8 @@ s390_irgen_CEGBRA(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + s390_insn_assert("cegbra", is_valid_rounding_mode(m3)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, get_gpr_dw0(r2)); @@ -11494,6 +11544,8 @@ s390_irgen_CDGBRA(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + s390_insn_assert("cdgbra", is_valid_rounding_mode(m3)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, get_gpr_dw0(r2)); @@ -11510,6 +11562,8 @@ s390_irgen_CELFBR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("celfbr", is_valid_rounding_mode(m3)); + IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -11520,12 +11574,14 @@ s390_irgen_CELFBR(UChar m3, UChar m4 __attribute__((unused)), } static const HChar * -s390_irgen_CDLFBR(UChar m3 __attribute__((unused)), +s390_irgen_CDLFBR(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("cdlfbr", is_valid_rounding_mode(m3)); + IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -11541,6 +11597,8 @@ s390_irgen_CELGBR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("celgbr", is_valid_rounding_mode(m3)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, get_gpr_dw0(r2)); @@ -11557,6 +11615,8 @@ s390_irgen_CDLGBR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("cdlgbr", is_valid_rounding_mode(m3)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, get_gpr_dw0(r2)); @@ -11574,6 +11634,8 @@ s390_irgen_CLFEBR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("clfebr", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_bfp_rounding_mode(m3); @@ -11594,6 +11656,8 @@ s390_irgen_CLFDBR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("clfdbr", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_bfp_rounding_mode(m3); @@ -11614,6 +11678,8 @@ s390_irgen_CLGEBR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("clgebr", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I64); IRTemp rounding_mode = encode_bfp_rounding_mode(m3); @@ -11634,6 +11700,8 @@ s390_irgen_CLGDBR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("clgdbr", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I64); IRTemp rounding_mode = encode_bfp_rounding_mode(m3); @@ -11651,6 +11719,8 @@ static const HChar * s390_irgen_CFEBRA(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { + s390_insn_assert("cfebra", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_bfp_rounding_mode(m3); @@ -11668,6 +11738,8 @@ static const HChar * s390_irgen_CFDBRA(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { + s390_insn_assert("cfdbra", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_bfp_rounding_mode(m3); @@ -11685,6 +11757,8 @@ static const HChar * s390_irgen_CGEBRA(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { + s390_insn_assert("cgebra", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F32); IRTemp result = newTemp(Ity_I64); IRTemp rounding_mode = encode_bfp_rounding_mode(m3); @@ -11702,6 +11776,8 @@ static const HChar * s390_irgen_CGDBRA(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { + s390_insn_assert("cgdbra", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F64); IRTemp result = newTemp(Ity_I64); IRTemp rounding_mode = encode_bfp_rounding_mode(m3); @@ -11861,6 +11937,8 @@ s390_irgen_LEDBRA(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + s390_insn_assert("ledbra", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F64); assign(op, get_fpr_dw0(r2)); @@ -12044,6 +12122,10 @@ s390_irgen_AXTRA(UChar r3, UChar m4, UChar r1, UChar r2) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("axtra", is_valid_fpr_pair(r1)); + s390_insn_assert("axtra", is_valid_fpr_pair(r2)); + s390_insn_assert("axtra", is_valid_fpr_pair(r3)); + IRTemp op1 = newTemp(Ity_D128); IRTemp op2 = newTemp(Ity_D128); IRTemp result = newTemp(Ity_D128); @@ -12063,7 +12145,7 @@ s390_irgen_AXTRA(UChar r3, UChar m4, UChar r1, UChar r2) s390_cc_thunk_put1d128(S390_CC_OP_DFP_RESULT_128, result); } - return (m4 == 0) ? "axtr" : "axtra"; + return "axtra"; } static const HChar * @@ -12087,6 +12169,9 @@ s390_irgen_CDTR(UChar r1, UChar r2) static const HChar * s390_irgen_CXTR(UChar r1, UChar r2) { + s390_insn_assert("cxtr", is_valid_fpr_pair(r1)); + s390_insn_assert("cxtr", is_valid_fpr_pair(r2)); + IRTemp op1 = newTemp(Ity_D128); IRTemp op2 = newTemp(Ity_D128); IRTemp cc_vex = newTemp(Ity_I32); @@ -12109,14 +12194,10 @@ s390_irgen_CDFTR(UChar m3 __attribute__((unused)), if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { - if (! s390_host_has_fpext) { - emulation_failure(EmFail_S390X_fpext); - } else { - IRTemp op2 = newTemp(Ity_I32); + IRTemp op2 = newTemp(Ity_I32); - assign(op2, get_gpr_w1(r2)); - put_dpr_dw0(r1, unop(Iop_I32StoD64, mkexpr(op2))); - } + assign(op2, get_gpr_w1(r2)); + put_dpr_dw0(r1, unop(Iop_I32StoD64, mkexpr(op2))); } return "cdftr"; } @@ -12128,14 +12209,12 @@ s390_irgen_CXFTR(UChar m3 __attribute__((unused)), if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { - if (! s390_host_has_fpext) { - emulation_failure(EmFail_S390X_fpext); - } else { - IRTemp op2 = newTemp(Ity_I32); + s390_insn_assert("cxftr", is_valid_fpr_pair(r1)); - assign(op2, get_gpr_w1(r2)); - put_dpr_pair(r1, unop(Iop_I32StoD128, mkexpr(op2))); - } + IRTemp op2 = newTemp(Ity_I32); + + assign(op2, get_gpr_w1(r2)); + put_dpr_pair(r1, unop(Iop_I32StoD128, mkexpr(op2))); } return "cxftr"; } @@ -12168,6 +12247,8 @@ s390_irgen_CXGTRA(UChar m3 __attribute__((unused)), if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("cxgtra", is_valid_fpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I64); /* No emulation warning here about an non-zero m3 on hosts without @@ -12208,6 +12289,8 @@ s390_irgen_CXLFTR(UChar m3 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("cxlftr", is_valid_fpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -12248,6 +12331,8 @@ s390_irgen_CXLGTR(UChar m3 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("cxlgtr", is_valid_fpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, get_gpr_dw0(r2)); @@ -12291,6 +12376,8 @@ s390_irgen_CFXTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("cfxtr", is_valid_fpr_pair(r2)); + IRTemp op = newTemp(Ity_D128); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12313,19 +12400,16 @@ s390_irgen_CGDTRA(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { - IRTemp op = newTemp(Ity_D64); - IRTemp rounding_mode = encode_dfp_rounding_mode(m3); + if (! s390_host_has_fpext) { + emulation_failure(EmFail_S390X_fpext); + } else { + IRTemp op = newTemp(Ity_D64); + IRTemp rounding_mode = encode_dfp_rounding_mode(m3); - /* If fpext is not installed and m3 is in 1:7, - rounding mode performed is unpredictable */ - if (! s390_host_has_fpext && m3 > 0 && m3 < 8) { - emulation_warning(EmWarn_S390X_fpext_rounding); - m3 = S390_DFP_ROUND_PER_FPC_0; + assign(op, get_dpr_dw0(r2)); + put_gpr_dw0(r1, binop(Iop_D64toI64S, mkexpr(rounding_mode), mkexpr(op))); + s390_cc_thunk_putFZ(S390_CC_OP_DFP_64_TO_INT_64, op, rounding_mode); } - - assign(op, get_dpr_dw0(r2)); - put_gpr_dw0(r1, binop(Iop_D64toI64S, mkexpr(rounding_mode), mkexpr(op))); - s390_cc_thunk_putFZ(S390_CC_OP_DFP_64_TO_INT_64, op, rounding_mode); } return "cgdtra"; } @@ -12337,18 +12421,18 @@ s390_irgen_CGXTRA(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { - IRTemp op = newTemp(Ity_D128); - IRTemp rounding_mode = encode_dfp_rounding_mode(m3); + if (! s390_host_has_fpext) { + emulation_failure(EmFail_S390X_fpext); + } else { + s390_insn_assert("cgxtra", is_valid_fpr_pair(r2)); - /* If fpext is not installed and m3 is in 1:7, - rounding mode performed is unpredictable */ - if (! s390_host_has_fpext && m3 > 0 && m3 < 8) { - emulation_warning(EmWarn_S390X_fpext_rounding); - m3 = S390_DFP_ROUND_PER_FPC_0; + IRTemp op = newTemp(Ity_D128); + IRTemp rounding_mode = encode_dfp_rounding_mode(m3); + + assign(op, get_dpr_pair(r2)); + put_gpr_dw0(r1, binop(Iop_D128toI64S, mkexpr(rounding_mode), mkexpr(op))); + s390_cc_thunk_put1d128Z(S390_CC_OP_DFP_128_TO_INT_64, op, rounding_mode); } - assign(op, get_dpr_pair(r2)); - put_gpr_dw0(r1, binop(Iop_D128toI64S, mkexpr(rounding_mode), mkexpr(op))); - s390_cc_thunk_put1d128Z(S390_CC_OP_DFP_128_TO_INT_64, op, rounding_mode); } return "cgxtra"; } @@ -12380,6 +12464,9 @@ s390_irgen_CEXTR(UChar r1, UChar r2) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("cextr", is_valid_fpr_pair(r1)); + s390_insn_assert("cextr", is_valid_fpr_pair(r2)); + IRTemp op1 = newTemp(Ity_D128); IRTemp op2 = newTemp(Ity_D128); IRTemp cc_vex = newTemp(Ity_I32); @@ -12429,6 +12516,8 @@ s390_irgen_CLFXTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("clfxtr", is_valid_fpr_pair(r2)); + IRTemp op = newTemp(Ity_D128); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12478,6 +12567,8 @@ s390_irgen_CLGXTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("clgxtr", is_valid_fpr_pair(r2)); + IRTemp op = newTemp(Ity_D128); IRTemp result = newTemp(Ity_I64); IRTemp rounding_mode = encode_dfp_rounding_mode(m3); @@ -12516,7 +12607,7 @@ s390_irgen_DDTRA(UChar r3, UChar m4, UChar r1, UChar r2) mkexpr(op2))); put_dpr_dw0(r1, mkexpr(result)); } - return (m4 == 0) ? "ddtr" : "ddtra"; + return "ddtra"; } static const HChar * @@ -12525,6 +12616,10 @@ s390_irgen_DXTRA(UChar r3, UChar m4, UChar r1, UChar r2) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("dxtra", is_valid_fpr_pair(r1)); + s390_insn_assert("dxtra", is_valid_fpr_pair(r2)); + s390_insn_assert("dxtra", is_valid_fpr_pair(r3)); + IRTemp op1 = newTemp(Ity_D128); IRTemp op2 = newTemp(Ity_D128); IRTemp result = newTemp(Ity_D128); @@ -12542,7 +12637,7 @@ s390_irgen_DXTRA(UChar r3, UChar m4, UChar r1, UChar r2) mkexpr(op2))); put_dpr_pair(r1, mkexpr(result)); } - return (m4 == 0) ? "dxtr" : "dxtra"; + return "dxtra"; } static const HChar * @@ -12562,6 +12657,8 @@ s390_irgen_EEXTR(UChar r1, UChar r2) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("eextr", is_valid_fpr_pair(r2)); + put_gpr_dw0(r1, unop(Iop_ExtractExpD128, get_dpr_pair(r2))); } return "eextr"; @@ -12584,6 +12681,8 @@ s390_irgen_ESXTR(UChar r1, UChar r2) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("esxtr", is_valid_fpr_pair(r2)); + put_gpr_dw0(r1, unop(Iop_ExtractSigD128, get_dpr_pair(r2))); } return "esxtr"; @@ -12613,6 +12712,9 @@ s390_irgen_IEXTR(UChar r3, UChar r1, UChar r2) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("iextr", is_valid_fpr_pair(r1)); + s390_insn_assert("iextr", is_valid_fpr_pair(r3)); + IRTemp op1 = newTemp(Ity_I64); IRTemp op2 = newTemp(Ity_D128); IRTemp result = newTemp(Ity_D128); @@ -12642,11 +12744,16 @@ s390_irgen_LDETR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) static const HChar * s390_irgen_LXDTR(UChar m4 __attribute__((unused)), UChar r1, UChar r2) { - IRTemp op = newTemp(Ity_D64); + if (! s390_host_has_dfp) { + emulation_failure(EmFail_S390X_DFP_insn); + } else { + s390_insn_assert("lxdtr", is_valid_fpr_pair(r1)); - assign(op, get_dpr_dw0(r2)); - put_dpr_pair(r1, unop(Iop_D64toD128, mkexpr(op))); + IRTemp op = newTemp(Ity_D64); + assign(op, get_dpr_dw0(r2)); + put_dpr_pair(r1, unop(Iop_D64toD128, mkexpr(op))); + } return "lxdtr"; } @@ -12657,6 +12764,9 @@ s390_irgen_LDXTR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("ldxtr", is_valid_fpr_pair(r1)); + s390_insn_assert("ldxtr", is_valid_fpr_pair(r2)); + /* If fpext is not installed and m3 is in 1:7, rounding mode performed is unpredictable */ if (! s390_host_has_fpext && m3 > 0 && m3 < 8) { @@ -12697,24 +12807,33 @@ s390_irgen_LEDTR(UChar m3, UChar m4 __attribute__((unused)), static const HChar * s390_irgen_LTDTR(UChar r1, UChar r2) { - IRTemp result = newTemp(Ity_D64); - - assign(result, get_dpr_dw0(r2)); - put_dpr_dw0(r1, mkexpr(result)); - s390_cc_thunk_putF(S390_CC_OP_DFP_RESULT_64, result); + if (! s390_host_has_dfp) { + emulation_failure(EmFail_S390X_DFP_insn); + } else { + IRTemp result = newTemp(Ity_D64); + assign(result, get_dpr_dw0(r2)); + put_dpr_dw0(r1, mkexpr(result)); + s390_cc_thunk_putF(S390_CC_OP_DFP_RESULT_64, result); + } return "ltdtr"; } static const HChar * s390_irgen_LTXTR(UChar r1, UChar r2) { - IRTemp result = newTemp(Ity_D128); + if (! s390_host_has_dfp) { + emulation_failure(EmFail_S390X_DFP_insn); + } else { + s390_insn_assert("ltxtr", is_valid_fpr_pair(r1)); + s390_insn_assert("ltxtr", is_valid_fpr_pair(r2)); - assign(result, get_dpr_pair(r2)); - put_dpr_pair(r1, mkexpr(result)); - s390_cc_thunk_put1d128(S390_CC_OP_DFP_RESULT_128, result); + IRTemp result = newTemp(Ity_D128); + assign(result, get_dpr_pair(r2)); + put_dpr_pair(r1, mkexpr(result)); + s390_cc_thunk_put1d128(S390_CC_OP_DFP_RESULT_128, result); + } return "ltxtr"; } @@ -12741,7 +12860,7 @@ s390_irgen_MDTRA(UChar r3, UChar m4, UChar r1, UChar r2) mkexpr(op2))); put_dpr_dw0(r1, mkexpr(result)); } - return (m4 == 0) ? "mdtr" : "mdtra"; + return "mdtra"; } static const HChar * @@ -12750,6 +12869,10 @@ s390_irgen_MXTRA(UChar r3, UChar m4, UChar r1, UChar r2) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("mxtra", is_valid_fpr_pair(r1)); + s390_insn_assert("mxtra", is_valid_fpr_pair(r2)); + s390_insn_assert("mxtra", is_valid_fpr_pair(r3)); + IRTemp op1 = newTemp(Ity_D128); IRTemp op2 = newTemp(Ity_D128); IRTemp result = newTemp(Ity_D128); @@ -12767,7 +12890,7 @@ s390_irgen_MXTRA(UChar r3, UChar m4, UChar r1, UChar r2) mkexpr(op2))); put_dpr_pair(r1, mkexpr(result)); } - return (m4 == 0) ? "mxtr" : "mxtra"; + return "mxtra"; } static const HChar * @@ -12804,6 +12927,10 @@ s390_irgen_QAXTR(UChar r3, UChar m4, UChar r1, UChar r2) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("qaxtr", is_valid_fpr_pair(r1)); + s390_insn_assert("qaxtr", is_valid_fpr_pair(r2)); + s390_insn_assert("qaxtr", is_valid_fpr_pair(r3)); + IRTemp op1 = newTemp(Ity_D128); IRTemp op2 = newTemp(Ity_D128); IRTemp result = newTemp(Ity_D128); @@ -12860,6 +12987,9 @@ s390_irgen_RRXTR(UChar r3, UChar m4, UChar r1, UChar r2) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("rrxtr", is_valid_fpr_pair(r1)); + s390_insn_assert("rrxtr", is_valid_fpr_pair(r3)); + IRTemp op1 = newTemp(Ity_I8); IRTemp op2 = newTemp(Ity_D128); IRTemp result = newTemp(Ity_D128); @@ -12906,7 +13036,7 @@ s390_irgen_SDTRA(UChar r3, UChar m4, UChar r1, UChar r2) s390_cc_thunk_putF(S390_CC_OP_DFP_RESULT_64, result); put_dpr_dw0(r1, mkexpr(result)); } - return (m4 == 0) ? "sdtr" : "sdtra"; + return "sdtra"; } static const HChar * @@ -12915,6 +13045,10 @@ s390_irgen_SXTRA(UChar r3, UChar m4, UChar r1, UChar r2) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("sxtra", is_valid_fpr_pair(r1)); + s390_insn_assert("sxtra", is_valid_fpr_pair(r2)); + s390_insn_assert("sxtra", is_valid_fpr_pair(r3)); + IRTemp op1 = newTemp(Ity_D128); IRTemp op2 = newTemp(Ity_D128); IRTemp result = newTemp(Ity_D128); @@ -12934,7 +13068,7 @@ s390_irgen_SXTRA(UChar r3, UChar m4, UChar r1, UChar r2) s390_cc_thunk_put1d128(S390_CC_OP_DFP_RESULT_128, result); } - return (m4 == 0) ? "sxtr" : "sxtra"; + return "sxtra"; } static const HChar * @@ -12959,6 +13093,9 @@ s390_irgen_SLXT(UChar r3, IRTemp op2addr, UChar r1) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("slxt", is_valid_fpr_pair(r1)); + s390_insn_assert("slxt", is_valid_fpr_pair(r3)); + IRTemp op = newTemp(Ity_D128); assign(op, get_dpr_pair(r3)); @@ -12991,6 +13128,9 @@ s390_irgen_SRXT(UChar r3, IRTemp op2addr, UChar r1) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("srxt", is_valid_fpr_pair(r1)); + s390_insn_assert("srxt", is_valid_fpr_pair(r3)); + IRTemp op = newTemp(Ity_D128); assign(op, get_dpr_pair(r3)); @@ -13037,6 +13177,8 @@ s390_irgen_TDCXT(UChar r1, IRTemp op2addr) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("tdcxt", is_valid_fpr_pair(r1)); + IRTemp value = newTemp(Ity_D128); assign(value, get_dpr_pair(r1)); @@ -13082,6 +13224,8 @@ s390_irgen_TDGXT(UChar r1, IRTemp op2addr) if (! s390_host_has_dfp) { emulation_failure(EmFail_S390X_DFP_insn); } else { + s390_insn_assert("tdgxt", is_valid_fpr_pair(r1)); + IRTemp value = newTemp(Ity_D128); assign(value, get_dpr_pair(r1)); @@ -13122,6 +13266,9 @@ s390_irgen_CLC(UChar length, IRTemp start1, IRTemp start2) static const HChar * s390_irgen_CLCL(UChar r1, UChar r2) { + s390_insn_assert("clcl", is_valid_gpr_pair(r1)); + s390_insn_assert("clcl", is_valid_gpr_pair(r2)); + IRTemp addr1 = newTemp(Ity_I64); IRTemp addr2 = newTemp(Ity_I64); IRTemp addr1_load = newTemp(Ity_I64); @@ -13202,6 +13349,9 @@ s390_irgen_CLCL(UChar r1, UChar r2) static const HChar * s390_irgen_CLCLE(UChar r1, UChar r3, IRTemp pad2) { + s390_insn_assert("clcle", is_valid_gpr_pair(r1)); + s390_insn_assert("clcle", is_valid_gpr_pair(r3)); + IRTemp addr1, addr3, addr1_load, addr3_load, len1, len3, single1, single3; addr1 = newTemp(Ity_I64); @@ -13993,6 +14143,9 @@ s390_irgen_MVCRL(IRTemp op1addr, IRTemp op2addr) static const HChar * s390_irgen_MVCL(UChar r1, UChar r2) { + s390_insn_assert("mvcl", is_valid_gpr_pair(r1)); + s390_insn_assert("mvcl", is_valid_gpr_pair(r2)); + IRTemp addr1 = newTemp(Ity_I64); IRTemp addr2 = newTemp(Ity_I64); IRTemp addr2_load = newTemp(Ity_I64); @@ -14076,6 +14229,9 @@ s390_irgen_MVCL(UChar r1, UChar r2) static const HChar * s390_irgen_MVCLE(UChar r1, UChar r3, IRTemp pad2) { + s390_insn_assert("mvcle", is_valid_gpr_pair(r1)); + s390_insn_assert("mvcle", is_valid_gpr_pair(r3)); + IRTemp addr1, addr3, addr3_load, len1, len3, single; addr1 = newTemp(Ity_I64); @@ -14197,6 +14353,8 @@ s390_irgen_divide_64to64(IROp op, UChar r1, IRTemp op2) static const HChar * s390_irgen_DR(UChar r1, UChar r2) { + s390_insn_assert("dr", is_valid_gpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -14209,6 +14367,8 @@ s390_irgen_DR(UChar r1, UChar r2) static const HChar * s390_irgen_D(UChar r1, IRTemp op2addr) { + s390_insn_assert("d", is_valid_gpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I32); assign(op2, load(Ity_I32, mkexpr(op2addr))); @@ -14221,6 +14381,8 @@ s390_irgen_D(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_DLR(UChar r1, UChar r2) { + s390_insn_assert("dlr", is_valid_gpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -14233,6 +14395,8 @@ s390_irgen_DLR(UChar r1, UChar r2) static const HChar * s390_irgen_DL(UChar r1, IRTemp op2addr) { + s390_insn_assert("dl", is_valid_gpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I32); assign(op2, load(Ity_I32, mkexpr(op2addr))); @@ -14245,6 +14409,8 @@ s390_irgen_DL(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_DLG(UChar r1, IRTemp op2addr) { + s390_insn_assert("dlg", is_valid_gpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, load(Ity_I64, mkexpr(op2addr))); @@ -14257,6 +14423,8 @@ s390_irgen_DLG(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_DLGR(UChar r1, UChar r2) { + s390_insn_assert("dlgr", is_valid_gpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, get_gpr_dw0(r2)); @@ -14269,6 +14437,8 @@ s390_irgen_DLGR(UChar r1, UChar r2) static const HChar * s390_irgen_DSGR(UChar r1, UChar r2) { + s390_insn_assert("dsgr", is_valid_gpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, get_gpr_dw0(r2)); @@ -14281,6 +14451,8 @@ s390_irgen_DSGR(UChar r1, UChar r2) static const HChar * s390_irgen_DSG(UChar r1, IRTemp op2addr) { + s390_insn_assert("dsg", is_valid_gpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, load(Ity_I64, mkexpr(op2addr))); @@ -14293,6 +14465,8 @@ s390_irgen_DSG(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_DSGFR(UChar r1, UChar r2) { + s390_insn_assert("dsgfr", is_valid_gpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, unop(Iop_32Sto64, get_gpr_w1(r2))); @@ -14305,6 +14479,8 @@ s390_irgen_DSGFR(UChar r1, UChar r2) static const HChar * s390_irgen_DSGF(UChar r1, IRTemp op2addr) { + s390_insn_assert("dsgf", is_valid_gpr_pair(r1)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, unop(Iop_32Sto64, load(Ity_I32, mkexpr(op2addr)))); @@ -14510,6 +14686,8 @@ s390_irgen_cdas_32(UChar r1, UChar r3, IRTemp op2addr) static const HChar * s390_irgen_CDS(UChar r1, UChar r3, IRTemp op2addr) { + s390_insn_assert("cds", is_valid_gpr_pair(r1)); + s390_insn_assert("cds", is_valid_gpr_pair(r3)); s390_irgen_cdas_32(r1, r3, op2addr); return "cds"; @@ -14518,6 +14696,8 @@ s390_irgen_CDS(UChar r1, UChar r3, IRTemp op2addr) static const HChar * s390_irgen_CDSY(UChar r1, UChar r3, IRTemp op2addr) { + s390_insn_assert("cdsy", is_valid_gpr_pair(r1)); + s390_insn_assert("cdsy", is_valid_gpr_pair(r3)); s390_irgen_cdas_32(r1, r3, op2addr); return "cdsy"; @@ -14526,6 +14706,9 @@ s390_irgen_CDSY(UChar r1, UChar r3, IRTemp op2addr) static const HChar * s390_irgen_CDSG(UChar r1, UChar r3, IRTemp op2addr) { + s390_insn_assert("cdsg", is_valid_gpr_pair(r1)); + s390_insn_assert("cdsg", is_valid_gpr_pair(r3)); + IRCAS *cas; IRTemp op1_high = newTemp(Ity_I64); IRTemp op1_low = newTemp(Ity_I64); @@ -14575,6 +14758,9 @@ s390_irgen_CDSG(UChar r1, UChar r3, IRTemp op2addr) static const HChar * s390_irgen_AXBR(UChar r1, UChar r2) { + s390_insn_assert("axbr", is_valid_fpr_pair(r1)); + s390_insn_assert("axbr", is_valid_fpr_pair(r2)); + IRTemp op1 = newTemp(Ity_F128); IRTemp op2 = newTemp(Ity_F128); IRTemp result = newTemp(Ity_F128); @@ -14637,12 +14823,18 @@ s390_irgen_KDBR(UChar r1, UChar r2) static const HChar * s390_irgen_CXBR(UChar r1, UChar r2) { + s390_insn_assert("cxbr", is_valid_fpr_pair(r1)); + s390_insn_assert("cxbr", is_valid_fpr_pair(r2)); + return s390_irgen_CxBR("cxbr", r1, r2, Ity_F128, Iop_CmpF128); } static const HChar * s390_irgen_KXBR(UChar r1, UChar r2) { + s390_insn_assert("kxbr", is_valid_fpr_pair(r1)); + s390_insn_assert("kxbr", is_valid_fpr_pair(r2)); + return s390_irgen_CxBR("kxbr", r1, r2, Ity_F128, Iop_CmpF128); } @@ -14690,9 +14882,12 @@ s390_irgen_KDB(UChar r1, IRTemp op2addr) } static const HChar * -s390_irgen_CXFBRA(UChar m3 __attribute__((unused)), +s390_irgen_CXFBRA(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { + s390_insn_assert("cxfbra", is_valid_fpr_pair(r1)); + s390_insn_assert("cxfbra", is_valid_rounding_mode(m3)); + IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -14702,12 +14897,15 @@ s390_irgen_CXFBRA(UChar m3 __attribute__((unused)), } static const HChar * -s390_irgen_CXLFBR(UChar m3 __attribute__((unused)), +s390_irgen_CXLFBR(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("cxlfbr", is_valid_fpr_pair(r1)); + s390_insn_assert("cxlfbr", is_valid_rounding_mode(m3)); + IRTemp op2 = newTemp(Ity_I32); assign(op2, get_gpr_w1(r2)); @@ -14718,9 +14916,12 @@ s390_irgen_CXLFBR(UChar m3 __attribute__((unused)), static const HChar * -s390_irgen_CXGBRA(UChar m3 __attribute__((unused)), +s390_irgen_CXGBRA(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { + s390_insn_assert("cxgbra", is_valid_fpr_pair(r1)); + s390_insn_assert("cxgbra", is_valid_rounding_mode(m3)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, get_gpr_dw0(r2)); @@ -14730,12 +14931,15 @@ s390_irgen_CXGBRA(UChar m3 __attribute__((unused)), } static const HChar * -s390_irgen_CXLGBR(UChar m3 __attribute__((unused)), +s390_irgen_CXLGBR(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("cxlgbr", is_valid_fpr_pair(r1)); + s390_insn_assert("cxlgbr", is_valid_rounding_mode(m3)); + IRTemp op2 = newTemp(Ity_I64); assign(op2, get_gpr_dw0(r2)); @@ -14748,6 +14952,9 @@ static const HChar * s390_irgen_CFXBRA(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { + s390_insn_assert("cfxbra", is_valid_fpr_pair(r2)); + s390_insn_assert("cfxbra", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_bfp_rounding_mode(m3); @@ -14768,6 +14975,9 @@ s390_irgen_CLFXBR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("clfxbr", is_valid_fpr_pair(r2)); + s390_insn_assert("clfxbr", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I32); IRTemp rounding_mode = encode_bfp_rounding_mode(m3); @@ -14786,6 +14996,9 @@ static const HChar * s390_irgen_CGXBRA(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { + s390_insn_assert("cgxbra", is_valid_fpr_pair(r2)); + s390_insn_assert("cgxbra", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I64); IRTemp rounding_mode = encode_bfp_rounding_mode(m3); @@ -14806,6 +15019,9 @@ s390_irgen_CLGXBR(UChar m3, UChar m4 __attribute__((unused)), if (! s390_host_has_fpext) { emulation_failure(EmFail_S390X_fpext); } else { + s390_insn_assert("clgxbr", is_valid_fpr_pair(r2)); + s390_insn_assert("clgxbr", is_valid_rounding_mode(m3)); + IRTemp op = newTemp(Ity_F128); IRTemp result = newTemp(Ity_I64); IRTemp rounding_mode = encode_bfp_rounding_mode(m3); @@ -14823,6 +15039,9 @@ s390_irgen_CLGXBR(UChar m3, UChar m4 __attribute__((unused)), static const HChar * s390_irgen_DXBR(UChar r1, UChar r2) { + s390_insn_assert("dxbr", is_valid_fpr_pair(r1)); + s390_insn_assert("dxbr", is_valid_fpr_pair(r2)); + IRTemp op1 = newTemp(Ity_F128); IRTemp op2 = newTemp(Ity_F128); IRTemp result = newTemp(Ity_F128); @@ -14840,6 +15059,9 @@ s390_irgen_DXBR(UChar r1, UChar r2) static const HChar * s390_irgen_LTXBR(UChar r1, UChar r2) { + s390_insn_assert("ltxbr", is_valid_fpr_pair(r1)); + s390_insn_assert("ltxbr", is_valid_fpr_pair(r2)); + IRTemp result = newTemp(Ity_F128); assign(result, get_fpr_pair(r2)); @@ -14852,6 +15074,9 @@ s390_irgen_LTXBR(UChar r1, UChar r2) static const HChar * s390_irgen_LCXBR(UChar r1, UChar r2) { + s390_insn_assert("lcxbr", is_valid_fpr_pair(r1)); + s390_insn_assert("lcxbr", is_valid_fpr_pair(r2)); + IRTemp result = newTemp(Ity_F128); assign(result, unop(Iop_NegF128, get_fpr_pair(r2))); @@ -14864,6 +15089,8 @@ s390_irgen_LCXBR(UChar r1, UChar r2) static const HChar * s390_irgen_LXDBR(UChar r1, UChar r2) { + s390_insn_assert("lxdbr", is_valid_fpr_pair(r1)); + IRTemp op = newTemp(Ity_F64); assign(op, get_fpr_dw0(r2)); @@ -14875,6 +15102,8 @@ s390_irgen_LXDBR(UChar r1, UChar r2) static const HChar * s390_irgen_LXEBR(UChar r1, UChar r2) { + s390_insn_assert("lxebr", is_valid_fpr_pair(r1)); + IRTemp op = newTemp(Ity_F32); assign(op, get_fpr_w0(r2)); @@ -14886,6 +15115,8 @@ s390_irgen_LXEBR(UChar r1, UChar r2) static const HChar * s390_irgen_LXDB(UChar r1, IRTemp op2addr) { + s390_insn_assert("lxdb", is_valid_fpr_pair(r1)); + IRTemp op = newTemp(Ity_F64); assign(op, load(Ity_F64, mkexpr(op2addr))); @@ -14897,6 +15128,8 @@ s390_irgen_LXDB(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_LXEB(UChar r1, IRTemp op2addr) { + s390_insn_assert("lxeb", is_valid_fpr_pair(r1)); + IRTemp op = newTemp(Ity_F32); assign(op, load(Ity_F32, mkexpr(op2addr))); @@ -14909,6 +15142,8 @@ static const HChar * s390_irgen_FIEBRA(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { + s390_insn_assert("fiebra", is_valid_rounding_mode(m3)); + IRTemp result = newTemp(Ity_F32); assign(result, binop(Iop_RoundF32toInt, mkexpr(encode_bfp_rounding_mode(m3)), @@ -14922,6 +15157,8 @@ static const HChar * s390_irgen_FIDBRA(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { + s390_insn_assert("fidbra", is_valid_rounding_mode(m3)); + IRTemp result = newTemp(Ity_F64); assign(result, binop(Iop_RoundF64toInt, mkexpr(encode_bfp_rounding_mode(m3)), @@ -14935,6 +15172,10 @@ static const HChar * s390_irgen_FIXBRA(UChar m3, UChar m4 __attribute__((unused)), UChar r1, UChar r2) { + s390_insn_assert("fixbra", is_valid_fpr_pair(r1)); + s390_insn_assert("fixbra", is_valid_fpr_pair(r2)); + s390_insn_assert("fixbra", is_valid_rounding_mode(m3)); + IRTemp result = newTemp(Ity_F128); assign(result, binop(Iop_RoundF128toInt, mkexpr(encode_bfp_rounding_mode(m3)), @@ -14971,6 +15212,9 @@ s390_irgen_LNDBR(UChar r1, UChar r2) static const HChar * s390_irgen_LNXBR(UChar r1, UChar r2) { + s390_insn_assert("lnxbr", is_valid_fpr_pair(r1)); + s390_insn_assert("lnxbr", is_valid_fpr_pair(r2)); + IRTemp result = newTemp(Ity_F128); assign(result, unop(Iop_NegF128, unop(Iop_AbsF128, get_fpr_pair(r2)))); @@ -15007,6 +15251,9 @@ s390_irgen_LPDBR(UChar r1, UChar r2) static const HChar * s390_irgen_LPXBR(UChar r1, UChar r2) { + s390_insn_assert("lpxbr", is_valid_fpr_pair(r1)); + s390_insn_assert("lpxbr", is_valid_fpr_pair(r2)); + IRTemp result = newTemp(Ity_F128); assign(result, unop(Iop_AbsF128, get_fpr_pair(r2))); @@ -15024,6 +15271,10 @@ s390_irgen_LDXBRA(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + s390_insn_assert("ldxbra", is_valid_fpr_pair(r1)); + s390_insn_assert("ldxbra", is_valid_fpr_pair(r2)); + s390_insn_assert("ldxbra", is_valid_rounding_mode(m3)); + IRTemp result = newTemp(Ity_F64); assign(result, binop(Iop_F128toF64, mkexpr(encode_bfp_rounding_mode(m3)), @@ -15041,6 +15292,10 @@ s390_irgen_LEXBRA(UChar m3, UChar m4 __attribute__((unused)), emulation_warning(EmWarn_S390X_fpext_rounding); m3 = S390_BFP_ROUND_PER_FPC; } + s390_insn_assert("lexbra", is_valid_fpr_pair(r1)); + s390_insn_assert("lexbra", is_valid_fpr_pair(r2)); + s390_insn_assert("lexbra", is_valid_rounding_mode(m3)); + IRTemp result = newTemp(Ity_F32); assign(result, binop(Iop_F128toF32, mkexpr(encode_bfp_rounding_mode(m3)), @@ -15053,6 +15308,9 @@ s390_irgen_LEXBRA(UChar m3, UChar m4 __attribute__((unused)), static const HChar * s390_irgen_MXBR(UChar r1, UChar r2) { + s390_insn_assert("mxbr", is_valid_fpr_pair(r1)); + s390_insn_assert("mxbr", is_valid_fpr_pair(r2)); + IRTemp op1 = newTemp(Ity_F128); IRTemp op2 = newTemp(Ity_F128); IRTemp result = newTemp(Ity_F128); @@ -15186,6 +15444,9 @@ s390_irgen_SQDBR(UChar r1, UChar r2) static const HChar * s390_irgen_SQXBR(UChar r1, UChar r2) { + s390_insn_assert("sqxbr", is_valid_fpr_pair(r1)); + s390_insn_assert("sqxbr", is_valid_fpr_pair(r2)); + IRTemp result = newTemp(Ity_F128); IRTemp rounding_mode = encode_bfp_rounding_mode(S390_BFP_ROUND_PER_FPC); @@ -15223,6 +15484,9 @@ s390_irgen_SQDB(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_SXBR(UChar r1, UChar r2) { + s390_insn_assert("sxbr", is_valid_fpr_pair(r1)); + s390_insn_assert("sxbr", is_valid_fpr_pair(r2)); + IRTemp op1 = newTemp(Ity_F128); IRTemp op2 = newTemp(Ity_F128); IRTemp result = newTemp(Ity_F128); @@ -15265,6 +15529,8 @@ s390_irgen_TCDB(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_TCXB(UChar r1, IRTemp op2addr) { + s390_insn_assert("tcxb", is_valid_fpr_pair(r1)); + IRTemp value = newTemp(Ity_F128); assign(value, get_fpr_pair(r1)); @@ -15407,6 +15673,8 @@ s390_irgen_CVDY(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_FLOGR(UChar r1, UChar r2) { + s390_insn_assert("flogr", is_valid_gpr_pair(r1)); + IRTemp input = newTemp(Ity_I64); IRTemp num = newTemp(Ity_I64); IRTemp shift_amount = newTemp(Ity_I8); @@ -15549,6 +15817,8 @@ s390_irgen_STFLE(UChar b2, UShort d2) static const HChar * s390_irgen_CKSM(UChar r1,UChar r2) { + s390_insn_assert("cksm", is_valid_gpr_pair(r2)); + IRTemp addr = newTemp(Ity_I64); IRTemp op = newTemp(Ity_I32); IRTemp len = newTemp(Ity_I64); @@ -15613,6 +15883,8 @@ s390_irgen_CKSM(UChar r1,UChar r2) static const HChar * s390_irgen_TROO(UChar m3, UChar r1, UChar r2) { + s390_insn_assert("troo", is_valid_gpr_pair(r1)); + IRTemp src_addr, des_addr, tab_addr, src_len, test_byte; src_addr = newTemp(Ity_I64); des_addr = newTemp(Ity_I64); @@ -15660,6 +15932,8 @@ s390_irgen_TROO(UChar m3, UChar r1, UChar r2) static const HChar * s390_irgen_TRTO(UChar m3, UChar r1, UChar r2) { + s390_insn_assert("trto", is_valid_gpr_pair(r1)); + IRTemp src_addr, des_addr, tab_addr, src_len, test_byte; src_addr = newTemp(Ity_I64); des_addr = newTemp(Ity_I64); @@ -15708,6 +15982,8 @@ s390_irgen_TRTO(UChar m3, UChar r1, UChar r2) static const HChar * s390_irgen_TROT(UChar m3, UChar r1, UChar r2) { + s390_insn_assert("trot", is_valid_gpr_pair(r1)); + IRTemp src_addr, des_addr, tab_addr, src_len, test_byte; src_addr = newTemp(Ity_I64); des_addr = newTemp(Ity_I64); @@ -15755,6 +16031,8 @@ s390_irgen_TROT(UChar m3, UChar r1, UChar r2) static const HChar * s390_irgen_TRTT(UChar m3, UChar r1, UChar r2) { + s390_insn_assert("trtt", is_valid_gpr_pair(r1)); + IRTemp src_addr, des_addr, tab_addr, src_len, test_byte; src_addr = newTemp(Ity_I64); des_addr = newTemp(Ity_I64); @@ -15814,6 +16092,8 @@ s390_irgen_TR(UChar length, IRTemp start1, IRTemp start2) static const HChar * s390_irgen_TRE(UChar r1,UChar r2) { + s390_insn_assert("tre", is_valid_gpr_pair(r1)); + IRTemp src_addr, tab_addr, src_len, test_byte; src_addr = newTemp(Ity_I64); tab_addr = newTemp(Ity_I64); @@ -15870,6 +16150,9 @@ s390_call_cu21(IRExpr *srcval, IRExpr *low_surrogate) static const HChar * s390_irgen_CU21(UChar m3, UChar r1, UChar r2) { + s390_insn_assert("cu21", is_valid_gpr_pair(r1)); + s390_insn_assert("cu21", is_valid_gpr_pair(r2)); + IRTemp addr1 = newTemp(Ity_I64); IRTemp addr2 = newTemp(Ity_I64); IRTemp len1 = newTemp(Ity_I64); @@ -15997,6 +16280,9 @@ s390_call_cu24(IRExpr *srcval, IRExpr *low_surrogate) static const HChar * s390_irgen_CU24(UChar m3, UChar r1, UChar r2) { + s390_insn_assert("cu24", is_valid_gpr_pair(r1)); + s390_insn_assert("cu24", is_valid_gpr_pair(r2)); + IRTemp addr1 = newTemp(Ity_I64); IRTemp addr2 = newTemp(Ity_I64); IRTemp len1 = newTemp(Ity_I64); @@ -16104,6 +16390,9 @@ s390_call_cu42(IRExpr *srcval) static const HChar * s390_irgen_CU42(UChar r1, UChar r2) { + s390_insn_assert("cu42", is_valid_gpr_pair(r1)); + s390_insn_assert("cu42", is_valid_gpr_pair(r2)); + IRTemp addr1 = newTemp(Ity_I64); IRTemp addr2 = newTemp(Ity_I64); IRTemp len1 = newTemp(Ity_I64); @@ -16198,6 +16487,9 @@ s390_call_cu41(IRExpr *srcval) static const HChar * s390_irgen_CU41(UChar r1, UChar r2) { + s390_insn_assert("cu41", is_valid_gpr_pair(r1)); + s390_insn_assert("cu41", is_valid_gpr_pair(r2)); + IRTemp addr1 = newTemp(Ity_I64); IRTemp addr2 = newTemp(Ity_I64); IRTemp len1 = newTemp(Ity_I64); @@ -16445,6 +16737,9 @@ s390_irgen_cu12_cu14(UChar m3, UChar r1, UChar r2, Bool is_cu12) static const HChar * s390_irgen_CU12(UChar m3, UChar r1, UChar r2) { + s390_insn_assert("cu12", is_valid_gpr_pair(r1)); + s390_insn_assert("cu12", is_valid_gpr_pair(r2)); + s390_irgen_cu12_cu14(m3, r1, r2, /* is_cu12 = */ 1); return "cu12"; @@ -16453,6 +16748,9 @@ s390_irgen_CU12(UChar m3, UChar r1, UChar r2) static const HChar * s390_irgen_CU14(UChar m3, UChar r1, UChar r2) { + s390_insn_assert("cu14", is_valid_gpr_pair(r1)); + s390_insn_assert("cu14", is_valid_gpr_pair(r2)); + s390_irgen_cu12_cu14(m3, r1, r2, /* is_cu12 = */ 0); return "cu14"; @@ -17394,6 +17692,8 @@ s390_irgen_STOCFH(UChar r1, IRTemp op2addr) static const HChar * s390_irgen_LCBB(UChar r1, IRTemp op2addr, UChar m3) { + s390_insn_assert("lcbb", m3 <= 6); + IRTemp op2 = newTemp(Ity_I32); assign(op2, s390_getCountToBlockBoundary(op2addr, m3)); put_gpr_w1(r1, mkexpr(op2)); @@ -20325,7 +20625,7 @@ s390_irgen_KMA(UChar r3, UChar r1, UChar r2) return "kma"; } s390_insn_assert("kma", r1 % 2 == 0 && r1 != 0 && r2 % 2 == 0 && r2 != 0 && - r3 % 2 == 0 && r3 != 0); + r3 % 2 == 0 && r3 != 0 && r3 != r1 && r3 != r2); extension(S390_EXT_KMA, r1 | (r2 << 4) | (r3 << 8)); return "kma"; } |
From: Florian K. <fk...@so...> - 2025-04-03 13:01:20
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=a4260a7da3f01247373594990addeef21bdd9d0c commit a4260a7da3f01247373594990addeef21bdd9d0c Author: Florian Krohm <fl...@ei...> Date: Thu Apr 3 12:58:38 2025 +0000 s390x disasm-test: Fix niai opcode spec Diff: --- none/tests/s390x/disasm-test/opcode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/none/tests/s390x/disasm-test/opcode.c b/none/tests/s390x/disasm-test/opcode.c index 51c7694cf6..bed2e278e4 100644 --- a/none/tests/s390x/disasm-test/opcode.c +++ b/none/tests/s390x/disasm-test/opcode.c @@ -691,7 +691,7 @@ static const char *opcodes[] = { "nnrk r1,r2,r3", // mi3 "nngrk r1,r2,r3", // mi3 - "niai i1:u4,i2:u4", // exhi + "niai i1:u4{0..3},i2:u4{0..3}", // exhi no spec exc for i1,i2 // ntstg not implemented |
From: Florian K. <fk...@so...> - 2025-04-03 09:44:20
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=fbc967c36984f54b967bf580be8ebc05f2c0451b commit fbc967c36984f54b967bf580be8ebc05f2c0451b Author: Florian Krohm <fl...@ei...> Date: Thu Apr 3 09:43:32 2025 +0000 s390x disasm-test: Fix a few constraints and facility indications. Diff: --- none/tests/s390x/disasm-test/opcode.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/none/tests/s390x/disasm-test/opcode.c b/none/tests/s390x/disasm-test/opcode.c index 993a1fb050..51c7694cf6 100644 --- a/none/tests/s390x/disasm-test/opcode.c +++ b/none/tests/s390x/disasm-test/opcode.c @@ -83,8 +83,6 @@ diop --> distinct-operands == lsc exe --> execute-extensions eimm --> extended-immediate facility - etf2 --> ETF2-enhancement facility - etf3 --> ETF2-enhancement facility exhi --> execution-hint extr2 --> extended-translation facility 2 extr3 --> extended-translation facility 3 @@ -397,16 +395,16 @@ static const char *opcodes[] = { "cvdy r1,d20(x2,b2)", // cvdg not implemented - "cu24 r1:{0,2,4,6,8,10,12,14},r2:{0,2,4,6,8,10,12,14},m3:{0,1}", // extr3 + "cu24 r1:{0,2,4,6,8,10,12,14},r2:{0,2,4,6,8,10,12,14},m3:{0,1}", // extr3 no spec exc for m3 - "cu21 r1:{0,2,4,6,8,10,12,14},r2:{0,2,4,6,8,10,12,14},m3:{0,1}", + "cu21 r1:{0,2,4,6,8,10,12,14},r2:{0,2,4,6,8,10,12,14},m3:{0,1}", // no spec exc for m3 "cu42 r1:{0,2,4,6,8,10,12,14},r2:{0,2,4,6,8,10,12,14}", // extr3 "cu41 r1:{0,2,4,6,8,10,12,14},r2:{0,2,4,6,8,10,12,14}", // extr3 - "cu12 r1:{0,2,4,6,8,10,12,14},r2:{0,2,4,6,8,10,12,14},m3:{0,1}", + "cu12 r1:{0,2,4,6,8,10,12,14},r2:{0,2,4,6,8,10,12,14},m3:{0,1}", // no spec exc for m3 - "cu14 r1:{0,2,4,6,8,10,12,14},r2:{0,2,4,6,8,10,12,14},m3:{0,1}", // extr3 + "cu14 r1:{0,2,4,6,8,10,12,14},r2:{0,2,4,6,8,10,12,14},m3:{0,1}", // extr3 no spec exc for m3 "cpya a1,a2", @@ -1038,8 +1036,8 @@ static const char *opcodes[] = { "fidbra f1,m3:{0,1,3..7},f2,m4", "fixbra f1:{0,1,4,5,8,9,12,13},m3:{0,1,3..7},f2:{0,1,4,5,8,9,12,13},m4", "ldebr f1,f2", - "lxdbr f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13}", - "lxebr f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13}", + "lxdbr f1:{0,1,4,5,8,9,12,13},f2", + "lxebr f1:{0,1,4,5,8,9,12,13},f2", "ldeb f1,d12(x2,b2)", "lxdb f1:{0,1,4,5,8,9,12,13},d12(x2,b2)", "lxeb f1:{0,1,4,5,8,9,12,13},d12(x2,b2)", @@ -1121,10 +1119,10 @@ static const char *opcodes[] = { // cxzt not implemented "cgdtr r1,m3,f2", "cgxtr r1,m3,f2:{0,1,4,5,8,9,12,13}", - "cgdtra r1,m3,f2,m4", - "cgxtra r1,m3,f2:{0,1,4,5,8,9,12,13},m4", - "cfdtr r1,m3,f2,m4", - "cfxtr r1,m3,f2:{0,1,4,5,8,9,12,13},m4", + "cgdtra r1,m3,f2,m4", // fpext + "cgxtra r1,m3,f2:{0,1,4,5,8,9,12,13},m4", // fpext + "cfdtr r1,m3,f2,m4", // fpext + "cfxtr r1,m3,f2:{0,1,4,5,8,9,12,13},m4", // fpext "clgdtr r1,m3,f2,m4", // fpext "clgxtr r1,m3,f2:{0,1,4,5,8,9,12,13},m4", // fpext "clfdtr r1,m3,f2,m4", // fpext @@ -1142,17 +1140,17 @@ static const char *opcodes[] = { "ddtra f1,f2,f3,m4", "dxtra f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},m4", "eedtr f1,f2", - "eextr f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13}", + "eextr f1,f2:{0,1,4,5,8,9,12,13}", "esdtr f1,f2", - "esxtr f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13}", + "esxtr f1,f2:{0,1,4,5,8,9,12,13}", "iedtr f1,f3,f2", - "iextr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13}", + "iextr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},f2", "ltdtr f1,f2", "ltxtr f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13}", // fidtr not implemented // fixtr not implemented "ldetr f1,f2,m4", - "lxdtr f1:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13},m4", + "lxdtr f1:{0,1,4,5,8,9,12,13},f2,m4", "ledtr f1,m3,f2,m4", "ldxtr f1:{0,1,4,5,8,9,12,13},m3,f2:{0,1,4,5,8,9,12,13},m4", "mdtr f1,f2,f3", @@ -1162,7 +1160,7 @@ static const char *opcodes[] = { "qadtr f1,f3,f2,m4", "qaxtr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13},m4", "rrdtr f1,f3,f2,m4", - "rrxtr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},f2:{0,1,4,5,8,9,12,13},m4", + "rrxtr f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},f2,m4", "sldt f1,f3,d12(x2,b2)", "slxt f1:{0,1,4,5,8,9,12,13},f3:{0,1,4,5,8,9,12,13},d12(x2,b2)", "srdt f1,f3,d12(x2,b2)", |
From: Paul F. <pa...@so...> - 2025-04-02 19:42:36
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=e633d2c8c56d342726f98d55e42c6fbdc875bd54 commit e633d2c8c56d342726f98d55e42c6fbdc875bd54 Author: Paul Floyd <pj...@wa...> Date: Wed Apr 2 21:39:54 2025 +0200 Illumos helgrind: pthread wrapper tweaks Wrap pthread_cond_timedwait which seems to have supplanted cond_reltimedwait on Illumos. pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock both exist on illumos, so enable those wrappers. Diff: --- helgrind/hg_intercepts.c | 9 +++++++-- helgrind/tests/filter_stderr_solaris | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c index 950d71b83c..661ab1a093 100644 --- a/helgrind/hg_intercepts.c +++ b/helgrind/hg_intercepts.c @@ -1526,6 +1526,11 @@ static int pthread_cond_timedwait_WRK(pthread_cond_t* cond, struct timespec *reltime) { return pthread_cond_timedwait_WRK(cond, mutex, reltime, ETIME); } + PTH_FUNC(int, pthreadZucondZutimedwait, // pthread_cond_timedwait + pthread_cond_t* cond, pthread_mutex_t* mutex, + struct timespec* abstime) { + return pthread_cond_timedwait_WRK(cond, mutex, abstime, ETIMEDOUT); + } #else # error "Unsupported OS" #endif @@ -2810,7 +2815,7 @@ PTH_FUNC(int, pthreadZurwlockZutimedrdlock, // pthread_rwlock_timedrdlock # error "Unsupported OS" #endif -#if defined(VGO_linux) +#if defined(VGO_linux) || defined(VGO_solaris) //----------------------------------------------------------- // glibc: pthread_rwlock_clockrdlock // @@ -2917,7 +2922,7 @@ PTH_FUNC(int, pthreadZurwlockZutimedwrlock, // pthread_rwlock_timedwrlock # error "Unsupported OS" #endif -#if defined(VGO_linux) +#if defined(VGO_linux) || defined(VGO_solaris) //----------------------------------------------------------- // glibc: pthread_rwlock_clockwrlock // diff --git a/helgrind/tests/filter_stderr_solaris b/helgrind/tests/filter_stderr_solaris index 41d1f1ef59..56ecfb3fb0 100755 --- a/helgrind/tests/filter_stderr_solaris +++ b/helgrind/tests/filter_stderr_solaris @@ -2,6 +2,8 @@ # Replace pthread_create with pthread_create@* which is expected on Linux s/pthread_create \(hg_intercepts.c:/pthread_create@* \(hg_intercepts.c:/g; +# Illumos uses pthread function names (in some cases?) +s/pthread_cond_timedwait \(hg_intercepts.c:/pthread_cond_timedwait@* \(hg_intercepts.c:/; # We need to remove stack frames containing redundant function # names from libc, for example |
From: Paul F. <pa...@so...> - 2025-04-02 18:14:19
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=7170fc3bc74b2ba7bee13c38ecfed95753741a08 commit 7170fc3bc74b2ba7bee13c38ecfed95753741a08 Author: Paul Floyd <pj...@wa...> Date: Wed Apr 2 20:13:10 2025 +0200 Illumos regtest: fix configure check for GCC using Sun Studio as Diff: --- configure.ac | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index dca5661fc6..862e6feed2 100755 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,3 @@ - ##------------------------------------------------------------## # # The multiple-architecture stuff in this file is pretty @@ -3809,18 +3808,13 @@ AC_CHECK_HEADERS([sys/lgrp_user_impl.h]) # C-level symbol: none # Automake-level symbol: SOLARIS_SUN_STUDIO_AS # -AC_MSG_CHECKING([if x86/amd64 assembler speaks cmovl.l (Solaris-specific)]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -]], [[ - __asm__ __volatile__("cmovl.l %edx, %eax"); -]])], [ -solaris_have_sun_studio_as=yes -AC_MSG_RESULT([yes]) -], [ -solaris_have_sun_studio_as=no -AC_MSG_RESULT([no]) -]) -AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$solaris_have_sun_studio_as = xyes) + +# This was using a AC_COMPILE_IFELSE with "cmovl.l %edx, %eax" +# which at some time in the past was Sun Studio specific. +# GNU as now understands it, so the test was misidentifying +# the assembler. Now we ask the compiler directly. +with_gnu_as=$(${CC} -v 2>&1 | tr ' ' '\n' | grep with-gnu-as) +AM_CONDITIONAL(SOLARIS_SUN_STUDIO_AS, test x$with_gnu_as = x) # Solaris-specific check determining if symbols __xpg4 and __xpg6 # are present in linked shared libraries when gcc is invoked with -std=gnu99. |
From: Andreas A. <ar...@so...> - 2025-04-02 17:58:17
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=8d5cd244c7a81931ee17c3a7d46691774847222b commit 8d5cd244c7a81931ee17c3a7d46691774847222b Author: Andreas Arnez <ar...@li...> Date: Wed Apr 2 19:52:26 2025 +0200 Bug 502324 - Add test case for TMx memcheck false positives Add a regression test for Bug 502324. Before the bug was fixed, this test failed with various "conditional jump or move depends on uninitialised value(s)" messages. Diff: --- .gitignore | 1 + NEWS | 1 + memcheck/tests/s390x/Makefile.am | 2 +- memcheck/tests/s390x/tmxx.c | 50 ++++++++++++++++++++++++++++++++++++ memcheck/tests/s390x/tmxx.stderr.exp | 0 memcheck/tests/s390x/tmxx.stdout.exp | 5 ++++ memcheck/tests/s390x/tmxx.vgtest | 2 ++ 7 files changed, 60 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f9e50b1357..f58e91dd83 100644 --- a/.gitignore +++ b/.gitignore @@ -1266,6 +1266,7 @@ /memcheck/tests/s390x/cu21 /memcheck/tests/s390x/cu42 /memcheck/tests/s390x/ltgjhe +/memcheck/tests/s390x/tmxx /memcheck/tests/s390x/vstrc /memcheck/tests/s390x/vfae /memcheck/tests/s390x/vistr diff --git a/NEWS b/NEWS index 7f1d4246c3..ee501aef69 100644 --- a/NEWS +++ b/NEWS @@ -73,6 +73,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 501893 Missing suppression for __wcscat_avx2 (strcat-strlen-avx2.h.S:68)? 502126 glibc 2.41 extra syscall_cancel frames 502288 s390x: Memcheck false positives with NNPA last tensor dimension +502324 s390x: Memcheck false positives with TMxx and TM/TMY To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/memcheck/tests/s390x/Makefile.am b/memcheck/tests/s390x/Makefile.am index 095c07c7f3..32a898ca5f 100644 --- a/memcheck/tests/s390x/Makefile.am +++ b/memcheck/tests/s390x/Makefile.am @@ -2,7 +2,7 @@ include $(top_srcdir)/Makefile.tool-tests.am dist_noinst_SCRIPTS = filter_stderr -INSN_TESTS = cdsg cli cu21 cu42 ltgjhe vstrc vfae vistr vstrs +INSN_TESTS = cdsg cli cu21 cu42 ltgjhe tmxx vstrc vfae vistr vstrs check_PROGRAMS = $(INSN_TESTS) diff --git a/memcheck/tests/s390x/tmxx.c b/memcheck/tests/s390x/tmxx.c new file mode 100644 index 0000000000..ed4447f08f --- /dev/null +++ b/memcheck/tests/s390x/tmxx.c @@ -0,0 +1,50 @@ +#include <stdio.h> + +union foo { + char a; + unsigned long val; +}; + +static int do_tmhh(unsigned long val, int eq, int neq) +{ + int ret = eq; + int alt = neq; + __asm__("tmhh %[val],0xf000\n\t" + "jo 1f\n\t" + "nopr 0\n" + "1:\t" + "locgrne %[ret],%[alt]" + : [ret] "+d"(ret) + : [val] "d"(val), [alt] "d"(alt) + : "cc"); + return ret; +} + +static int do_tm(unsigned char val, int eq, int neq) +{ + int ret = eq; + int alt = neq; + __asm__("tm %[val],0xf0\n\t" + "jo 1f\n\t" + "nopr 0\n" + "1:\t" + "locgrne %[ret],%[alt]" + : [ret] "+d"(ret) + : [val] "Q"(val), [alt] "d"(alt) + : "cc"); + return ret; +} + +int main(void) +{ + volatile union foo a; + a.a = 0x40; + printf("%c\n", do_tmhh(a.val, 'A', 'B')); + a.val = a.val << 1; + printf("%c\n", do_tmhh(a.val, 'C', 'D')); + printf("%c\n", do_tm(a.a, 'E', 'F')); + a.val = a.val << 1; + printf("%c\n", do_tmhh(a.val, 'G', 'H')); + printf("%c\n", do_tm(a.a, 'I', 'J')); + return 0; +} diff --git a/memcheck/tests/s390x/tmxx.stderr.exp b/memcheck/tests/s390x/tmxx.stderr.exp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/memcheck/tests/s390x/tmxx.stdout.exp b/memcheck/tests/s390x/tmxx.stdout.exp new file mode 100644 index 0000000000..af2c2d5543 --- /dev/null +++ b/memcheck/tests/s390x/tmxx.stdout.exp @@ -0,0 +1,5 @@ +B +D +F +G +I diff --git a/memcheck/tests/s390x/tmxx.vgtest b/memcheck/tests/s390x/tmxx.vgtest new file mode 100644 index 0000000000..650afd4375 --- /dev/null +++ b/memcheck/tests/s390x/tmxx.vgtest @@ -0,0 +1,2 @@ +prog: tmxx +vgopts: -q |
From: Andreas A. <ar...@so...> - 2025-04-02 17:58:01
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=29f8a0ad4ed17d9cdf4a5d6661a51d25db6fc472 commit 29f8a0ad4ed17d9cdf4a5d6661a51d25db6fc472 Author: Andreas Arnez <ar...@li...> Date: Wed Apr 2 19:52:26 2025 +0200 Bug 502324 - s390x: Fix memcheck false positives with TM/TMY If the condition code of TM/TMY is generated in a different block than it is used, memcheck can yield false positives for a partially initialized value even if the checked bits are all defined. Fix this by storing the operand ANDed with the mask in the flags thunk, instead of the unmodified operand. This enables memcheck to track the defined bits correctly. Diff: --- VEX/priv/guest_s390_helpers.c | 30 ++++++++++-------------------- VEX/priv/guest_s390_toIR.c | 27 +++++++++++---------------- 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index 8f3f1a172f..b99d71a5af 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -2140,8 +2140,8 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args, } /* S390_CC_OP_TEST_UNDER_MASK_8 - Since the mask comes from an immediate field in the opcode, we - expect the mask to be a constant here. That simplifies matters. */ + cc_dep1 = the value to be tested, ANDed with the mask + cc_dep2 = an 8-bit mask; expected to be a constant here */ if (cc_op == S390_CC_OP_TEST_UNDER_MASK_8) { ULong mask16; @@ -2149,33 +2149,23 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args, mask16 = cc_dep2->Iex.Const.con->Ico.U64; - /* Get rid of the mask16 == 0 case first. Some of the simplifications - below (e.g. for OVFL) only hold if mask16 == 0. */ if (mask16 == 0) { /* cc == 0 */ if (cond & 0x8) return mkU32(1); return mkU32(0); } /* cc == 2 is a don't care */ - if (cond == 8 || cond == 8 + 2) { - return unop(Iop_1Uto32, binop(Iop_CmpEQ64, - binop(Iop_And64, cc_dep1, cc_dep2), - mkU64(0))); + if (cond == 8 || cond == 8 + 2) { /* all bits zero */ + return unop(Iop_1Uto32, binop(Iop_CmpEQ64, cc_dep1, mkU64(0))); } - if (cond == 7 || cond == 7 - 2) { - return unop(Iop_1Uto32, binop(Iop_CmpNE64, - binop(Iop_And64, cc_dep1, cc_dep2), - mkU64(0))); + if (cond == 7 || cond == 7 - 2) { /* not all bits zero */ + return unop(Iop_1Uto32, binop(Iop_CmpNE64, cc_dep1, mkU64(0))); } - if (cond == 1 || cond == 1 + 2) { - return unop(Iop_1Uto32, binop(Iop_CmpEQ64, - binop(Iop_And64, cc_dep1, cc_dep2), - cc_dep2)); + if (cond == 1 || cond == 1 + 2) { /* all bits set */ + return unop(Iop_1Uto32, binop(Iop_CmpEQ64, cc_dep1, cc_dep2)); } - if (cond == 14 || cond == 14 - 2) { /* ! OVFL */ - return unop(Iop_1Uto32, binop(Iop_CmpNE64, - binop(Iop_And64, cc_dep1, cc_dep2), - cc_dep2)); + if (cond == 14 || cond == 14 - 2) { /* not all bits set */ + return unop(Iop_1Uto32, binop(Iop_CmpNE64, cc_dep1, cc_dep2)); } goto missed; } diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index e95f28bfda..a5b1fcae6a 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -11066,31 +11066,26 @@ s390_irgen_SVC(UChar i) } static const HChar * -s390_irgen_TM(UChar i2, IRTemp op1addr) +s390_irgen_TMx(const HChar *mnem, UChar mask, IRTemp op1addr) { - UChar mask; - IRTemp value = newTemp(Ity_I8); + IRTemp masked = newTemp(Ity_I8); - mask = i2; - assign(value, load(Ity_I8, mkexpr(op1addr))); - s390_cc_thunk_putZZ(S390_CC_OP_TEST_UNDER_MASK_8, value, mktemp(Ity_I8, + assign(masked, binop(Iop_And8, load(Ity_I8, mkexpr(op1addr)), mkU8(mask))); + s390_cc_thunk_putZZ(S390_CC_OP_TEST_UNDER_MASK_8, masked, mktemp(Ity_I8, mkU8(mask))); + return mnem; +} - return "tm"; +static const HChar * +s390_irgen_TM(UChar i2, IRTemp op1addr) +{ + return s390_irgen_TMx("tm", i2, op1addr); } static const HChar * s390_irgen_TMY(UChar i2, IRTemp op1addr) { - UChar mask; - IRTemp value = newTemp(Ity_I8); - - mask = i2; - assign(value, load(Ity_I8, mkexpr(op1addr))); - s390_cc_thunk_putZZ(S390_CC_OP_TEST_UNDER_MASK_8, value, mktemp(Ity_I8, - mkU8(mask))); - - return "tmy"; + return s390_irgen_TMx("tmy", i2, op1addr); } static const HChar * |
From: Andreas A. <ar...@so...> - 2025-04-02 17:57:53
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=a95ba0d6e549764d5a68536efc6eb1545b537c09 commit a95ba0d6e549764d5a68536efc6eb1545b537c09 Author: Andreas Arnez <ar...@li...> Date: Wed Apr 2 19:52:26 2025 +0200 Bug 502324 - s390x: Fix memcheck false positives with TMxx The 16-bit "test under mask" instructions TMLL, TMLH, TMHL, and TMHH can yield memcheck false positives when: * some of the operand bits in the tested 16-bit chunk (but outside the mask) are undefined * the resulting condition code is used in a different block In this case the condition code is computed by the helper s390_call_calculate_cond, with the full 16-bit chunk and the given mask as arguments. Since the 16-bit chunk is not fully defined, memcheck complains. To fix this, AND the operand with the given mask before storing it for use as a helper argument. Also, optimize the frequent case of testing a single bit. For this purpose, add S390_CC_OP_BITWISE2 as a new way of computing the condition code. Diff: --- VEX/priv/guest_s390_defs.h | 3 +- VEX/priv/guest_s390_helpers.c | 146 +++++++++++++++++++++--------------------- VEX/priv/guest_s390_toIR.c | 63 ++++++++---------- 3 files changed, 104 insertions(+), 108 deletions(-) diff --git a/VEX/priv/guest_s390_defs.h b/VEX/priv/guest_s390_defs.h index 0039f5e784..0ec242a99b 100644 --- a/VEX/priv/guest_s390_defs.h +++ b/VEX/priv/guest_s390_defs.h @@ -155,7 +155,8 @@ enum { S390_CC_OP_PFPO_64 = 59, S390_CC_OP_PFPO_128 = 60, S390_CC_OP_MUL_32 = 61, - S390_CC_OP_MUL_64 = 62 + S390_CC_OP_MUL_64 = 62, + S390_CC_OP_BITWISE2 = 63 }; /*------------------------------------------------------------*/ diff --git a/VEX/priv/guest_s390_helpers.c b/VEX/priv/guest_s390_helpers.c index bbba22b478..8f3f1a172f 100644 --- a/VEX/priv/guest_s390_helpers.c +++ b/VEX/priv/guest_s390_helpers.c @@ -1454,7 +1454,10 @@ s390_calculate_cc(ULong cc_op, ULong cc_dep1, ULong cc_dep2, ULong cc_ndep) switch (cc_op) { case S390_CC_OP_BITWISE: - return S390_CC_FOR_BINARY("ogr", cc_dep1, (ULong)0); + return cc_dep1 == 0 ? 0 : 1; + + case S390_CC_OP_BITWISE2: + return cc_dep1 == 0 ? 0 : 3; case S390_CC_OP_SIGNED_COMPARE: return S390_CC_FOR_BINARY("cgr", cc_dep1, cc_dep2); @@ -2045,6 +2048,21 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args, return mkU32(0); } + /* S390_CC_OP_BITWISE2 + Like S390_CC_OP_BITWISE, but yielding cc = 3 for nonzero result */ + if (cc_op == S390_CC_OP_BITWISE2) { + if ((cond & (8 + 1)) == 8 + 1) { + return mkU32(1); + } + if (cond & 8) { + return unop(Iop_1Uto32, binop(Iop_CmpEQ64, cc_dep1, mkU64(0))); + } + if (cond & 1) { + return unop(Iop_1Uto32, binop(Iop_CmpNE64, cc_dep1, mkU64(0))); + } + return mkU32(0); + } + /* S390_CC_OP_INSERT_CHAR_MASK_32 Since the mask comes from an immediate field in the opcode, we expect the mask to be a constant here. That simplifies matters. */ @@ -2163,110 +2181,94 @@ guest_s390x_spechelper(const HChar *function_name, IRExpr **args, } /* S390_CC_OP_TEST_UNDER_MASK_16 - Since the mask comes from an immediate field in the opcode, we - expect the mask to be a constant here. That simplifies matters. */ + cc_dep1 = the value to be tested, ANDed with the mask + cc_dep2 = a 16-bit mask; expected to be a constant here */ if (cc_op == S390_CC_OP_TEST_UNDER_MASK_16) { - ULong mask16; - UInt msb; + IRExpr* val = cc_dep1; + ULong mask; + ULong msb; if (! isC64(cc_dep2)) goto missed; - mask16 = cc_dep2->Iex.Const.con->Ico.U64; + mask = cc_dep2->Iex.Const.con->Ico.U64; - /* Get rid of the mask16 == 0 case first. Some of the simplifications - below (e.g. for OVFL) only hold if mask16 == 0. */ - if (mask16 == 0) { /* cc == 0 */ + if (mask == 0) { /* cc == 0 */ if (cond & 0x8) return mkU32(1); return mkU32(0); } + /* Find MSB in mask */ + msb = 0x8000; + while (msb > mask) + msb >>= 1; + + /* If cc_dep1 results from a shift, avoid the shift operation */ + if (val->tag == Iex_Binop && val->Iex.Binop.op == Iop_Shr64 && + val->Iex.Binop.arg2->tag == Iex_Const && + val->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U8) { + UInt n_bits = val->Iex.Binop.arg2->Iex.Const.con->Ico.U8; + mask <<= n_bits; + msb <<= n_bits; + val = val->Iex.Binop.arg1; + } + if (cond == 15) return mkU32(1); - if (cond == 8) { - return unop(Iop_1Uto32, binop(Iop_CmpEQ64, - binop(Iop_And64, cc_dep1, cc_dep2), - mkU64(0))); + if (cond == 8) { /* all bits zero */ + return unop(Iop_1Uto32, binop(Iop_CmpEQ64, val, mkU64(0))); } - if (cond == 7) { - return unop(Iop_1Uto32, binop(Iop_CmpNE64, - binop(Iop_And64, cc_dep1, cc_dep2), - mkU64(0))); + if (cond == 7) { /* not all bits zero */ + return unop(Iop_1Uto32, binop(Iop_CmpNE64, val, mkU64(0))); } - if (cond == 1) { - return unop(Iop_1Uto32, binop(Iop_CmpEQ64, - binop(Iop_And64, cc_dep1, cc_dep2), - mkU64(mask16))); + if (cond == 1) { /* all bits set */ + return unop(Iop_1Uto32, binop(Iop_CmpEQ64, val, mkU64(mask))); } - if (cond == 14) { /* ! OVFL */ - return unop(Iop_1Uto32, binop(Iop_CmpNE64, - binop(Iop_And64, cc_dep1, cc_dep2), - mkU64(mask16))); + if (cond == 14) { /* not all bits set */ + return unop(Iop_1Uto32, binop(Iop_CmpNE64, val, mkU64(mask))); } - /* Find MSB in mask */ - msb = 0x8000; - while (msb > mask16) - msb >>= 1; + IRExpr *masked_msb = binop(Iop_And64, val, mkU64(msb)); if (cond == 2) { /* cc == 2 */ - IRExpr *c1, *c2; - - /* (cc_dep & msb) != 0 && (cc_dep & mask16) != mask16 */ - c1 = binop(Iop_CmpNE64, - binop(Iop_And64, cc_dep1, mkU64(msb)), mkU64(0)); - c2 = binop(Iop_CmpNE64, - binop(Iop_And64, cc_dep1, cc_dep2), - mkU64(mask16)); - return binop(Iop_And32, unop(Iop_1Uto32, c1), - unop(Iop_1Uto32, c2)); + /* mixed, and leftmost bit set */ + return unop(Iop_1Uto32, + binop(Iop_And1, + binop(Iop_CmpNE64, masked_msb, mkU64(0)), + binop(Iop_CmpNE64, val, mkU64(mask)))); } if (cond == 4) { /* cc == 1 */ - IRExpr *c1, *c2; - - /* (cc_dep & msb) == 0 && (cc_dep & mask16) != 0 */ - c1 = binop(Iop_CmpEQ64, - binop(Iop_And64, cc_dep1, mkU64(msb)), mkU64(0)); - c2 = binop(Iop_CmpNE64, - binop(Iop_And64, cc_dep1, cc_dep2), - mkU64(0)); - return binop(Iop_And32, unop(Iop_1Uto32, c1), - unop(Iop_1Uto32, c2)); + /* mixed, and leftmost bit zero */ + return unop(Iop_1Uto32, + binop(Iop_And1, + binop(Iop_CmpEQ64, masked_msb, mkU64(0)), + binop(Iop_CmpNE64, val, mkU64(0)))); } if (cond == 11) { /* cc == 0,2,3 */ - IRExpr *c1, *c2; - - c1 = binop(Iop_CmpNE64, - binop(Iop_And64, cc_dep1, mkU64(msb)), mkU64(0)); - c2 = binop(Iop_CmpEQ64, - binop(Iop_And64, cc_dep1, cc_dep2), - mkU64(0)); - return binop(Iop_Or32, unop(Iop_1Uto32, c1), - unop(Iop_1Uto32, c2)); + /* leftmost bit set, or all bits zero */ + return unop(Iop_1Uto32, + binop(Iop_Or1, + binop(Iop_CmpNE64, masked_msb, mkU64(0)), + binop(Iop_CmpEQ64, val, mkU64(0)))); } if (cond == 3) { /* cc == 2 || cc == 3 */ + /* leftmost bit set, rest don't care */ return unop(Iop_1Uto32, - binop(Iop_CmpNE64, - binop(Iop_And64, cc_dep1, mkU64(msb)), - mkU64(0))); + binop(Iop_CmpNE64, masked_msb, mkU64(0))); } if (cond == 12) { /* cc == 0 || cc == 1 */ + /* leftmost bit zero, rest don't care */ return unop(Iop_1Uto32, - binop(Iop_CmpEQ64, - binop(Iop_And64, cc_dep1, mkU64(msb)), - mkU64(0))); + binop(Iop_CmpEQ64, masked_msb, mkU64(0))); } if (cond == 13) { /* cc == 0 || cc == 1 || cc == 3 */ - IRExpr *c01, *c3; - - c01 = binop(Iop_CmpEQ64, binop(Iop_And64, cc_dep1, mkU64(msb)), - mkU64(0)); - c3 = binop(Iop_CmpEQ64, binop(Iop_And64, cc_dep1, cc_dep2), - mkU64(mask16)); - return binop(Iop_Or32, unop(Iop_1Uto32, c01), - unop(Iop_1Uto32, c3)); + /* leftmost bit zero, or all bits set */ + return unop(Iop_1Uto32, + binop(Iop_Or1, + binop(Iop_CmpEQ64, masked_msb, mkU64(0)), + binop(Iop_CmpEQ64, val, mkU64(mask)))); } // fixs390: handle cond = 5,6,9,10 (the missing cases) // vex_printf("TUM mask = 0x%llx\n", mask16); diff --git a/VEX/priv/guest_s390_toIR.c b/VEX/priv/guest_s390_toIR.c index 5b16002103..e95f28bfda 100644 --- a/VEX/priv/guest_s390_toIR.c +++ b/VEX/priv/guest_s390_toIR.c @@ -11094,59 +11094,52 @@ s390_irgen_TMY(UChar i2, IRTemp op1addr) } static const HChar * -s390_irgen_TMHH(UChar r1, UShort i2) +s390_irgen_TMxx(const HChar *mnem, UChar r1, UShort mask, UChar offs) { - UShort mask; - IRTemp value = newTemp(Ity_I16); + if (mask == 0) { + s390_cc_set_val(0); + return mnem; + } - mask = i2; - assign(value, get_gpr_hw0(r1)); - s390_cc_thunk_putZZ(S390_CC_OP_TEST_UNDER_MASK_16, value, mktemp(Ity_I16, - mkU16(mask))); + IRExpr* masked; + masked = binop(Iop_And64, get_gpr_dw0(r1), mkU64((ULong)mask << offs)); - return "tmhh"; + if ((mask & (mask - 1)) == 0) { + /* Single-bit mask */ + s390_cc_thunk_put1(S390_CC_OP_BITWISE2, mktemp(Ity_I64, masked), False); + } else { + if (offs) { + masked = binop(Iop_Shr64, masked, mkU8(offs)); + } + s390_cc_thunk_putZZ(S390_CC_OP_TEST_UNDER_MASK_16, + mktemp(Ity_I64, masked), + mktemp(Ity_I64, mkU64(mask))); + } + return mnem; } static const HChar * -s390_irgen_TMHL(UChar r1, UShort i2) +s390_irgen_TMHH(UChar r1, UShort i2) { - UShort mask; - IRTemp value = newTemp(Ity_I16); - - mask = i2; - assign(value, get_gpr_hw1(r1)); - s390_cc_thunk_putZZ(S390_CC_OP_TEST_UNDER_MASK_16, value, mktemp(Ity_I16, - mkU16(mask))); + return s390_irgen_TMxx("tmhh", r1, i2, 48); +} - return "tmhl"; +static const HChar * +s390_irgen_TMHL(UChar r1, UShort i2) +{ + return s390_irgen_TMxx("tmhl", r1, i2, 32); } static const HChar * s390_irgen_TMLH(UChar r1, UShort i2) { - UShort mask; - IRTemp value = newTemp(Ity_I16); - - mask = i2; - assign(value, get_gpr_hw2(r1)); - s390_cc_thunk_putZZ(S390_CC_OP_TEST_UNDER_MASK_16, value, mktemp(Ity_I16, - mkU16(mask))); - - return "tmlh"; + return s390_irgen_TMxx("tmlh", r1, i2, 16); } static const HChar * s390_irgen_TMLL(UChar r1, UShort i2) { - UShort mask; - IRTemp value = newTemp(Ity_I16); - - mask = i2; - assign(value, get_gpr_hw3(r1)); - s390_cc_thunk_putZZ(S390_CC_OP_TEST_UNDER_MASK_16, value, mktemp(Ity_I16, - mkU16(mask))); - - return "tmll"; + return s390_irgen_TMxx("tmll", r1, i2, 0); } static const HChar * |
From: Paul F. <pa...@so...> - 2025-04-01 20:13:36
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=07fc84abb78a161542e4fea7435c1184ccb6ecd7 commit 07fc84abb78a161542e4fea7435c1184ccb6ecd7 Author: Paul Floyd <pj...@wa...> Date: Tue Apr 1 20:09:14 2025 +0200 Illumos: mention the build-essential package in README.solaris Diff: --- README.solaris | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.solaris b/README.solaris index 42adb0b0c9..1815eb4a4a 100644 --- a/README.solaris +++ b/README.solaris @@ -5,6 +5,8 @@ Requirements Running `uname -r` has to print '5.11'. - Recent GCC tools are required, GCC 3 will probably not work. GCC version 4.5 (or higher) is recommended. +- On Illumos you can install the 'build-essential' metapackage which + includes GCC and many other developer tools. - Solaris ld has to be the first linker in the PATH. GNU ld cannot be used. There is currently no linker check in the configure script but the linking phase fails if GNU ld is used. Recent Solaris/illumos distributions are ok. |
From: Andreas A. <ar...@so...> - 2025-04-01 15:21:57
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=bba9d299ca5ed0d6220fd47cf0a5eed5a7ce3b55 commit bba9d299ca5ed0d6220fd47cf0a5eed5a7ce3b55 Author: Andreas Arnez <ar...@li...> Date: Tue Apr 1 17:21:16 2025 +0200 Bug 502288 - s390x: Fix false positive with NNPA pad elements The size of the non-pad elements in the last dimension of NNPA tensors is computed incorrectly. This can lead to memcheck false positives that look like this: ==3180208== Syscall param NNPA(in_tensor_1) points to uninitialised byte(s) Fix the computation. Diff: --- NEWS | 1 + coregrind/m_extension/extension-s390x.c | 30 ++++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index b2036da737..7f1d4246c3 100644 --- a/NEWS +++ b/NEWS @@ -72,6 +72,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 501850 FreeBSD syscall arguments 7 and 8 incorrect. 501893 Missing suppression for __wcscat_avx2 (strcat-strlen-avx2.h.S:68)? 502126 glibc 2.41 extra syscall_cancel frames +502288 s390x: Memcheck false positives with NNPA last tensor dimension To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_extension/extension-s390x.c b/coregrind/m_extension/extension-s390x.c index 8a17c6fbdd..5751afc87b 100644 --- a/coregrind/m_extension/extension-s390x.c +++ b/coregrind/m_extension/extension-s390x.c @@ -417,9 +417,11 @@ static const char* const s390_NNPA_errmsg_access[s390_NNPA_message_n] = { }; struct s390_NNPA_mem_dimensions { + UChar layout; ULong dim[5]; // total dimensions - ULong used[5]; // used dimensions, without padding + ULong used[4]; // used dimensions, without padding ULong step[5]; + ULong last_dim4_size; }; /* Determine the 5 dimensions used to represent the tensor data in memory */ @@ -431,6 +433,7 @@ NNPA_tensor0_size(const struct s390_NNPA_tensor0* t, struct s390_NNPA_mem_dimensions md; ULong elem_size; + md.layout = t->layout; if (t->dtype == 0) elem_size = 2; else @@ -444,7 +447,7 @@ NNPA_tensor0_size(const struct s390_NNPA_tensor0* t, md.dim[3] = (t->dim2 + 31) / 32 * 32; md.used[3] = t->dim2; md.dim[4] = 64; - md.used[4] = t->dim1; + md.last_dim4_size = elem_size * (t->dim1 % 64); break; case 1: // 4D-kernel tensor md.dim[0] = md.used[0] = (t->dim1 + 63) / 64; @@ -453,7 +456,7 @@ NNPA_tensor0_size(const struct s390_NNPA_tensor0* t, md.dim[3] = (t->dim2 + 31) / 32 * 32; md.used[3] = t->dim2; md.dim[4] = 64; - md.used[4] = t->dim1; + md.last_dim4_size = elem_size * (t->dim1 % 64); break; default: return INSN_ERR(s390_NNPA_errmsg_layout[msg_idx]); @@ -467,6 +470,20 @@ NNPA_tensor0_size(const struct s390_NNPA_tensor0* t, return ExtErr_OK; } +/* Determine the size of the non-pad elements in the last dimension */ +static ULong NNPA_mem_dim4_size(const struct s390_NNPA_mem_dimensions* md, + ULong d0, + ULong d1) +{ + switch (md->layout) { + case 0: // 4D-feature tensor + return d1 + 1 == md->dim[1] ? md->last_dim4_size : md->step[4]; + case 1: // 4D-kernel tensor + return d0 + 1 == md->dim[0] ? md->last_dim4_size : md->step[4]; + } + return 0; +} + static enum ExtensionError NNPA_pre_read_tensor0( ThreadState* tst, UInt msg_idx, const struct s390_NNPA_tensor0* t) { @@ -483,8 +500,8 @@ static enum ExtensionError NNPA_pre_read_tensor0( for (ULong d3 = 0; d3 < md.used[3]; d3++) { ULong addr = t->address + d0 * md.step[1] + d1 * md.step[2] + d2 * md.step[3] + d3 * md.step[4]; - PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], addr, - md.dim[4]); + ULong len = NNPA_mem_dim4_size(&md, d0, d1); + PRE_MEM_READ(tst, s390_NNPA_errmsg_access[msg_idx], addr, len); } } } @@ -524,7 +541,8 @@ static void NNPA_post_write_tensor0(ThreadState* tst, for (ULong d3 = 0; d3 < md.used[3]; d3++) { ULong addr = t->address + d0 * md.step[1] + d1 * md.step[2] + d2 * md.step[3] + d3 * md.step[4]; - POST_MEM_WRITE(tst, addr, md.dim[4]); + ULong len = NNPA_mem_dim4_size(&md, d0, d1); + POST_MEM_WRITE(tst, addr, len); } } } |