qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-i386: fix pcmpxstrx equal-ordered (strstr) mode
@ 2015-10-12  9:50 Paolo Bonzini
  2015-10-12 22:16 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2015-10-12  9:50 UTC (permalink / raw)
  To: qemu-devel; +Cc: fweimer, Eduardo Habkost, Richard Henderson

In this mode, referring an invalid element of the source forces the
result to false (table 4-7, last column) but referring an invalid
element of the destination forces the result to true, so the outer
loop should still be run even if some elements of the destination
will be invalid.  They will be culled in the inner loop, which
correctly bounds "i" to validd.

This fix tst_strstr in glibc 2.17.

Reported-by: Florian Weimer <fweimer@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target-i386/ops_sse.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target-i386/ops_sse.h b/target-i386/ops_sse.h
index 7aa693a..268f3e1 100644
--- a/target-i386/ops_sse.h
+++ b/target-i386/ops_sse.h
@@ -2037,7 +2037,7 @@ static inline unsigned pcmpxstrx(CPUX86State *env, Reg *d, Reg *s,
         }
         break;
     case 3:
-        for (j = valids - validd; j >= 0; j--) {
+        for (j = valids; j >= 0; j--) {
             res <<= 1;
             v = 1;
             for (i = MIN(upper - j, validd); i >= 0; i--) {
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-10-13  7:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-12  9:50 [Qemu-devel] [PATCH] target-i386: fix pcmpxstrx equal-ordered (strstr) mode Paolo Bonzini
2015-10-12 22:16 ` Richard Henderson
2015-10-13  7:41   ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).