From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FFaPH-0003jE-Fp for qemu-devel@nongnu.org; Sat, 04 Mar 2006 12:19:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FFaPA-0003c7-VT for qemu-devel@nongnu.org; Sat, 04 Mar 2006 12:19:00 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FEi5h-00046I-4m for qemu-devel@nongnu.org; Thu, 02 Mar 2006 02:19:13 -0500 Received: from [64.233.162.199] (helo=zproxy.gmail.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FEWNC-0004EJ-Um for qemu-devel@nongnu.org; Wed, 01 Mar 2006 13:48:31 -0500 Received: by zproxy.gmail.com with SMTP id 40so217716nzk for ; Wed, 01 Mar 2006 10:47:08 -0800 (PST) Message-ID: <2781f020603011047y28d9d611l6e04d88b8ff03387@mail.gmail.com> Date: Wed, 1 Mar 2006 13:47:08 -0500 From: "Joseph Stewart" Subject: Re: [Qemu-devel] Printing bogus values in ne2000_asic_ioport_read()/ ne2000_receive() In-Reply-To: <20060225182908.21386.qmail@web36810.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1270_19729014.1141238828490" References: <20060225182908.21386.qmail@web36810.mail.mud.yahoo.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ------=_Part_1270_19729014.1141238828490 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Change the function argument from signed to unsigned and see it printf handles prints the values correctly. I.E. static void print_packet(unsigned char *s, int len) ... -joe On 2/25/06, Umamaheswararao Karyampudi wrote: > > Hi, > I am using QEMU in one of my research projects. I > landed in a problem where I see bogus numbers being > printed when I printed the packet/each word that is > received from ne2000. > > In ne2000_receive(), I copied the packet received to a > static char [] and printed the packet using > static void print_packet(char *s, int len) > { > int i,j; > for (i=3D0;i if (i%20 =3D=3D 0) > printf("\n"); > printf("%02x ", s[i]); > } > printf("\n"); > } > And some bytes it prints as fffffffff > instead of just the last byte. > For eg: > 52 54 00 12 34 56 00 ffffffff 4f 0a 46 05 08 00 45 00 > 00 ffffff80 00 00 > 40 00 40 01 ffffffbc 2b ffffffc0 ffffffa8 fffffffe > fffffffe ffffffc0 ffffffa8 ff > > Similarly in ne2000_asic_ioport_read(), I print each > word that is read from NetDriverState.s->mem using the > following - > printf("\n %02x %02x", (char)(ret &0xff), (char) ( > (ret >> 8) && 0xff)); > And occasionally I see the 4 bytes printed instead of > 1 byte for each value. > > Any reason why it happens? Also, > ne2000_asic_ioport_read(), reads 6 bytes before > reading actual packet? I can think of 4 bytes for CRC > but not for the remaining 2 bytes - eg - If pak is - > 52 54 00 12 34 56 00 ffffffff 4f 0a 46 05 08 00 45 00 > 00 ffffff80 00 00 > 40 00 40 01 ffffffbc 2b > In asic_ioport_read() - > rdw 01 59 > rdw 92 00 > rdw 52 54 > rdw 52 54 > rdw 00 12 > rdw 34 56 > > Anyhelp is greatly appreciated. > > Thanks > Uma > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > > _______________________________________________ > Qemu-devel mailing list > Qemu-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/qemu-devel > ------=_Part_1270_19729014.1141238828490 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Change the function argument from signed to unsigned and see it printf hand= les prints the values correctly. I.E.

static void print_packet(unsig= ned char *s, int len) ...

-joe

On 2/25/06, Umamaheswararao Karyampudi &l= t;kumrao2003@yahoo.com> wrot= e:
Hi,
I am using QEMU in one of my research projects. I
landed in a pro= blem where I see bogus numbers being
printed when I printed the packet/e= ach word that is
received from ne2000.

In ne2000_receive(), I cop= ied the packet received to a
static char [] and printed the packet using
static void print_packe= t(char *s, int len)
{
  int i,j;
  for (i=3D0;= i<len;i++) {
      if (i%20 =3D=3D 0)          printf("= \n");
      printf("%02x ",= s[i]);
  }
         =  printf("\n");
}
And some bytes it prints as fffffffff= <last byte>
instead of just the last byte.
For eg:
52 54 00 = 12 34 56 00 ffffffff 4f 0a 46 05 08 00 45 00
00 ffffff80 00 00
40 00 40 01 ffffffbc 2b ffffffc0 ffffffa8 fffffffe
fffffffe ffffffc0= ffffffa8 ff

Similarly in ne2000_asic_ioport_read(), I print eachword that is read from NetDriverState.s->mem using the
following -
printf("\n %02x %02x", (char)(ret &0xff), (char) (
(re= t >> 8) && 0xff));
And occasionally I see the 4 bytes prin= ted instead of
1 byte for each value.

Any reason why it happens? = Also,
ne2000_asic_ioport_read(), reads 6 bytes before
reading actual packe= t? I can think of 4 bytes for CRC
but not for the remaining 2 bytes = ; - eg - If pak is -
52 54 00 12 34 56 00 ffffffff 4f 0a 46 05 08 0= 0 45 00
00 ffffff80 00 00
40 00 40 01 ffffffbc 2b
In asic_ioport_read() -=
rdw 01 59
rdw 92 00
rdw 52 54
rdw 52 54
rdw 00 12
rdw 34= 56

Anyhelp is greatly appreciated.

Thanks
Uma


__________________________________________________
Do You Yahoo!?Tired of spam?  Yahoo! Mail has the best spam protection around<= br>http://mail.yahoo.com


_= ______________________________________________
Qemu-devel mailing list
Qem= u-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel
<= /blockquote>

------=_Part_1270_19729014.1141238828490--