From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28000 invoked by alias); 27 Aug 2009 13:48:58 -0000 Received: (qmail 27980 invoked by uid 22791); 27 Aug 2009 13:48:57 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-px0-f194.google.com (HELO mail-px0-f194.google.com) (209.85.216.194) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Aug 2009 13:48:48 +0000 Received: by pxi32 with SMTP id 32so1129872pxi.25 for ; Thu, 27 Aug 2009 06:48:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.202.20 with SMTP id z20mr756879wff.171.1251380926150; Thu, 27 Aug 2009 06:48:46 -0700 (PDT) In-Reply-To: References: <4A7BA1DE.6010103@vmware.com> <83eir1dnqw.fsf@gnu.org> <8363cbenvt.fsf@gnu.org> <4A95C927.8020607@vmware.com> <4A95D342.6070304@vmware.com> From: Hui Zhu Date: Thu, 27 Aug 2009 15:35:00 -0000 Message-ID: Subject: Re: Bug in i386_process_record? To: Michael Snyder Cc: Eli Zaretskii , "gdb-patches@sourceware.org" Content-Type: multipart/mixed; boundary=000e0cd32e1e94f92604721fd30b X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-08/txt/msg00483.txt.bz2 --000e0cd32e1e94f92604721fd30b Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-length: 3463 On Thu, Aug 27, 2009 at 09:43, Hui Zhu wrote: > On Thu, Aug 27, 2009 at 08:28, Michael Snyder wrote: >> Michael Snyder wrote: >>> >>> Hui Zhu wrote: >>>> >>>> On Wed, Aug 26, 2009 at 02:42, Eli Zaretskii wrote: >>>>>> >>>>>> From: Hui Zhu >>>>>> Date: Tue, 25 Aug 2009 13:02:44 +0800 >>>>>> Cc: msnyder@vmware.com, gdb-patches@sourceware.org >>>>>> >>>>>> It seems that the segment (It is not the section) =A0registers in x86 >>>>>> protect mode is just help MMU to get the physical address. =A0It's >>>>>> transparent for the user level program. >>>>> >>>>> It's transparent if $es and $ds have the same value (which they >>>>> usually do, AFAIK). >>>>> >>>>>> What do you think about remove this warning from this patch? >>>>> >>>>> I would indeed do that, if we find that $es and $ds have the same >>>>> values. =A0Assuming that someone who knows Linux better than I do >>>>> confirms that these two registers hold the same selector when a normal >>>>> application is running in user mode. >>>>> >>>> Thanks for remind me. =A0We cannot get the value of each segment >>>> register, but we can get each segment register point to. =A0So if the >>>> value of segment registers, it's means that the value of them is same. >>>> >>>> I add some code about it: >>>> =A0 =A0 =A0 =A0 =A0regcache_raw_read_unsigned (ir.regcache, >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0ir.regmap[X86_RECORD_ES_REGNUM], >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0&es); >>>> =A0 =A0 =A0 =A0 =A0regcache_raw_read_unsigned (ir.regcache, >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0ir.regmap[X86_RECORD_DS_REGNUM], >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0&ds); >>>> =A0 =A0 =A0 =A0 =A0if (ir.aflag && (es !=3D ds)) >>>> =A0 =A0 =A0 =A0 =A0 =A0{ >>>> >>>> After that, we will not get the warning because the es is same with ds >>>> in user level. >>>> >>>> What do you think about it? >>> >>> I think it is the best version I have seen so far. >>> And it seems to follow the conclusions of the discussion. >>> And I've tested it, and it seems to work. >>> >>> I would say wait until end-of-business Friday, and >>> if there are no more comments, check it in! >> >> Hui, >> >> Do you think you could add some new tests to i386-reverse.exp, >> to verify the string instructions? >> >> Thanks, >> Michael >> > > OK. I will do it. > > Thanks, > Hui > Hi Michael, I make a patch to add the test for string insn. Please help me review it. Thanks, Hui 2009-08-27 Hui Zhu * gdb.reverse/i386-reverse.c (string_insn_tests): New function. (main): Call "string_insn_tests". --- testsuite/gdb.reverse/i386-reverse.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) --- a/testsuite/gdb.reverse/i386-reverse.c +++ b/testsuite/gdb.reverse/i386-reverse.c @@ -38,9 +38,25 @@ inc_dec_tests (void) asm ("dec %edi"); } /* end inc_dec_tests */ +void +string_insn_tests (void) +{ + register char x asm("ax"); + char *dstp =3D (char *) 1; + int d0; + int len =3D 0; + + asm volatile("rep\n" + "stosb" /* %0, %2, %3 */ : + "=3DD" (dstp), "=3Dc" (d0) : + "0" (dstp), "1" (len), "a" (x) : + "memory"); +} + int main () { inc_dec_tests (); + string_insn_tests (); return 0; /* end of main */ } --000e0cd32e1e94f92604721fd30b Content-Type: text/plain; charset=US-ASCII; name="prec-testsuite-string-insn.txt" Content-Disposition: attachment; filename="prec-testsuite-string-insn.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_fyvjuln00 Content-length: 895 LS0tCiB0ZXN0c3VpdGUvZ2RiLnJldmVyc2UvaTM4Ni1yZXZlcnNlLmMgfCAg IDE2ICsrKysrKysrKysrKysrKysKIDEgZmlsZSBjaGFuZ2VkLCAxNiBpbnNl cnRpb25zKCspCgotLS0gYS90ZXN0c3VpdGUvZ2RiLnJldmVyc2UvaTM4Ni1y ZXZlcnNlLmMKKysrIGIvdGVzdHN1aXRlL2dkYi5yZXZlcnNlL2kzODYtcmV2 ZXJzZS5jCkBAIC0zOCw5ICszOCwyNSBAQCBpbmNfZGVjX3Rlc3RzICh2b2lk KQogICBhc20gKCJkZWMgJWVkaSIpOwogfSAvKiBlbmQgaW5jX2RlY190ZXN0 cyAqLwogCit2b2lkCitzdHJpbmdfaW5zbl90ZXN0cyAodm9pZCkKK3sKKyAg cmVnaXN0ZXIgY2hhciB4IGFzbSgiYXgiKTsKKyAgY2hhciAqZHN0cCA9IChj aGFyICopIDE7CisgIGludCBkMDsKKyAgaW50IGxlbiA9IDA7CisKKyAgYXNt IHZvbGF0aWxlKCJyZXBcbiIKKwkgICAgICAgInN0b3NiIiAvKiAlMCwgJTIs ICUzICovIDoKKwkgICAgICAgIj1EIiAoZHN0cCksICI9YyIgKGQwKSA6CisJ ICAgICAgICIwIiAoZHN0cCksICIxIiAobGVuKSwgImEiICh4KSA6CisJICAg ICAgICJtZW1vcnkiKTsKK30KKwogaW50IAogbWFpbiAoKQogewogICBpbmNf ZGVjX3Rlc3RzICgpOworICBzdHJpbmdfaW5zbl90ZXN0cyAoKTsKICAgcmV0 dXJuIDA7CS8qIGVuZCBvZiBtYWluICovCiB9Cg== --000e0cd32e1e94f92604721fd30b--