Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FFIpl-0006j2-8Z for qemu-devel@nongnu.org; Fri, 03 Mar 2006 17:33:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FFIph-0006hM-AO for qemu-devel@nongnu.org; Fri, 03 Mar 2006 17:33:12 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FFIph-0006hD-4Q for qemu-devel@nongnu.org; Fri, 03 Mar 2006 17:33:09 -0500 Received: from [209.191.85.53] (helo=web36802.mail.mud.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.52) id 1FFIrT-00025B-1s for qemu-devel@nongnu.org; Fri, 03 Mar 2006 17:34:59 -0500 Message-ID: <20060303223306.20121.qmail@web36802.mail.mud.yahoo.com> Date: Fri, 3 Mar 2006 14:33:06 -0800 (PST) From: Umamaheswararao Karyampudi Subject: Re: [Qemu-devel] Printing bogus values in ne2000_asic_ioport_read()/ ne2000_receive() In-Reply-To: <23402837.1141207604525.JavaMail.root@ps19> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-132533160-1141425186=:19251" Content-Transfer-Encoding: 8bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "carlo.andreoli@tiscali.it" , qemu-devel@nongnu.org --0-132533160-1141425186=:19251 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Thanks Carlo. Now it works after changing it to . and Thanks all for the replies. Uma "carlo.andreoli@tiscali.it" wrote: Regarding the bogus numbers occasionally printed, you can see that the leading ffs are printed when the character has its bit7 set to 1. This occurs because in printf("%02x ", s[i]); the expected argument for %02x is an integer, and since the actual argument is a (signed) character, the compiler promotes it to an integer extending the sign bit. You can simply write instead printf("%02x ", (unsigned char)s[i]); and the problem should disappear, since in this case the promotion to an integer adds non-significative 0s that are ignored when printig Carlo ----Messaggio originale---- Da: kumrao2003@yahoo.com Data: 25/02/2006 19.29 A: Ogg: [Qemu-devel] Printing bogus values in ne2000_asic_ioport_read()/ ne2000_receive() 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=0;i if (i%20 == 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 Tiscali ADSL 4 Mega Flat Naviga senza limiti con l'unica Adsl a 4 Mega di velocità a soli 19,95 € al mese! Attivala subito e hai GRATIS 2 MESI e l'ATTIVAZIONE. http://abbonati.tiscali.it/banner/middlepagetracking.html?c=webmailadsl&r=http://abbonati.tiscali.it/adsl/sa/4flat_tc/&a=webmail&z=webmail&t=14 _______________________________________________ Qemu-devel mailing list Qemu-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/qemu-devel --------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments. --0-132533160-1141425186=:19251 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Thanks Carlo. Now it works after changing it to . and Thanks all for the replies.

Uma
"carlo.andreoli@tiscali.it" <carlo.andreoli@tiscali.it> wrote:
Regarding the bogus numbers occasionally printed, you can see that the
leading
ffs are printed when the character has its bit7 set to 1. This occurs
because in
printf("%02x ", s[i]);
the expected argument for %02x is an integer, and since the actual
argument is
a (signed) character, the compiler promotes it to an integer extending
the sign bit.
You can simply write instead
printf("%02x ", (unsigned char)s[i]);
and the problem should disappear, since in this case the promotion to
an integer
adds non-significative 0s that are ignored when printig

Carlo

----Messaggio originale----
Da: kumrao2003@yahoo.com
Data: 25/02/2006 19.29
A:
Ogg: [Qemu-devel] Printing bogus values in ne2000_asic_ioport_read()/
ne2000_receive()

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=0;i
if (i%20 == 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





Tiscali ADSL 4 Mega Flat
Naviga senza limiti con l'unica Adsl a 4 Mega di velocità a soli 19,95 € al mese!
Attivala subito e hai GRATIS 2 MESI e l'ATTIVAZIONE.
http://abbonati.tiscali.it/banner/middlepagetracking.html?c=webmailadsl&r=http://abbonati.tiscali.it/adsl/sa/4flat_tc/&a=webmail&z=webmail&t=14


_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel


Yahoo! Mail
Use Photomail to share photos without annoying attachments. --0-132533160-1141425186=:19251--