From: "carlo.andreoli@tiscali.it" <carlo.andreoli@tiscali.it>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Printing bogus values in ne2000_asic_ioport_read()/ ne2000_receive()
Date: Wed, 1 Mar 2006 11:06:44 +0100 (CET) [thread overview]
Message-ID: <23402837.1141207604525.JavaMail.root@ps19> (raw)
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: <qemu-devel@nongnu.org>
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<len;i++) {
if (i%20 == 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
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
next reply other threads:[~2006-03-01 10:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-01 10:06 carlo.andreoli [this message]
2006-03-03 22:33 ` [Qemu-devel] Printing bogus values in ne2000_asic_ioport_read()/ ne2000_receive() Umamaheswararao Karyampudi
-- strict thread matches above, loose matches on Subject: below --
2006-02-26 18:01 Umamaheswararao Karyampudi
2006-03-03 19:28 ` Brian Wheeler
2006-02-25 18:29 Umamaheswararao Karyampudi
2006-03-01 18:47 ` Joseph Stewart
2006-03-01 23:22 ` Chris Wilson
2006-03-02 10:40 ` Alessandro Iurlano
2006-02-25 4:13 Umamaheswararao Karyampudi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=23402837.1141207604525.JavaMail.root@ps19 \
--to=carlo.andreoli@tiscali.it \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.