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)  registers in x86 >>>>>> protect mode is just help MMU to get the physical address.  It'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.  Assuming 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.  We cannot get the value of each segment >>>> register, but we can get each segment register point to.  So if the >>>> value of segment registers, it's means that the value of them is same. >>>> >>>> I add some code about it: >>>>          regcache_raw_read_unsigned (ir.regcache, >>>>                                      ir.regmap[X86_RECORD_ES_REGNUM], >>>>                                      &es); >>>>          regcache_raw_read_unsigned (ir.regcache, >>>>                                      ir.regmap[X86_RECORD_DS_REGNUM], >>>>                                      &ds); >>>>          if (ir.aflag && (es != ds)) >>>>            { >>>> >>>> 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 = (char *) 1; + int d0; + int len = 0; + + asm volatile("rep\n" + "stosb" /* %0, %2, %3 */ : + "=D" (dstp), "=c" (d0) : + "0" (dstp), "1" (len), "a" (x) : + "memory"); +} + int main () { inc_dec_tests (); + string_insn_tests (); return 0; /* end of main */ }