[Qemu-devel] Bug in helper_pcmpestrm and helper_pcmpistrm

2011-09-29 Thread Frank Mehnert
Hi,

the two functions helper_pcmpestrm() and helper_pcmpistrm() in
target-i386/ops_sse.h contain obviously typos. I think that at
all 4 marked places should increment the index 'i', not decrement
it during the loop:


void glue(helper_pcmpestrm, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
{
int i;
unsigned int res = pcmpxstrx(d, s, ctrl,
pcmp_elen(R_EDX, ctrl),
pcmp_elen(R_EAX, ctrl));

if ((ctrl  6)  1) {
if (ctrl  1)
for (i = 0; i = 8; i--, res = 1)
^^^
d-W(i) = (res  1) ? ~0 : 0;
else
for (i = 0; i = 16; i--, res = 1)

d-B(i) = (res  1) ? ~0 : 0;
} else {
d-Q(1) = 0;
d-Q(0) = res;
}
}


void glue(helper_pcmpistrm, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
{
int i;
unsigned int res = pcmpxstrx(d, s, ctrl,
pcmp_ilen(s, ctrl),
pcmp_ilen(d, ctrl));

if ((ctrl  6)  1) {
if (ctrl  1)
for (i = 0; i = 8; i--, res = 1)
^^^
d-W(i) = (res  1) ? ~0 : 0;
else
for (i = 0; i = 16; i--, res = 1)

d-B(i) = (res  1) ? ~0 : 0;
} else {
d-Q(1) = 0;
d-Q(0) = res;
}
}


Kind regards,

Frank
-- 
Dr.-Ing. Frank Mehnert
Senior Manager Software Development Desktop Virtualization, VirtualBox
ORACLE Deutschland B.V.  Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven


signature.asc
Description: This is a digitally signed message part.


[Qemu-devel] hw/serial.c: Xmit fifo never used

2010-05-26 Thread Frank Mehnert
Hi,

the xmit fifo of the serial device is never used. If qemu_chr_write()
fails (interface currently not able to send characters) then the
transmit_timer should be engaged to try to send the current character
from the fifo again after some time. The code is

} else if (qemu_chr_write(s-chr, s-tsr, 1) != 1) {
if ((s-tsr_retry  0)  (s-tsr_retry = MAX_XMIT_RETRY)) {
s-tsr_retry++;
qemu_mod_timer(s-transmit_timer,
   new_xmit_ts + s-char_transmit_time);
return;
}
...
}

The problem is that this path is never used as tsr_retry is never  0
initially. So if qemu_chr_write() fails, we never try again but drop
the character.

I assume the correct condition would be '= 0', that is

...
if ((s-tsr_retry = 0)  (s-tsr_retry = MAX_XMIT_RETRY)) {
s-tsr_retry++;
...

Kind regards,

Frank
-- 
Dr.-Ing. Frank Mehnert

Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Jürgen Kunz


signature.asc
Description: This is a digitally signed message part.


Re: [Qemu-devel] Re: hw/serial.c: Xmit fifo never used

2010-05-26 Thread Frank Mehnert
On Wednesday 26 May 2010, Jan Kiszka wrote:
 Frank Mehnert wrote:
  I assume the correct condition would be '= 0', that is
 
  ...
  if ((s-tsr_retry = 0)  (s-tsr_retry = MAX_XMIT_RETRY)) {
  s-tsr_retry++;
  ...

 Makes sense, patch welcome.

Attached.

Kind regards,

Frank
-- 
Dr.-Ing. Frank Mehnert

Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Jürgen Kunz
diff --git a/hw/serial.c b/hw/serial.c
index 9102edb..0b1550b 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -327,7 +327,7 @@ static void serial_xmit(void *opaque)
 /* in loopback mode, say that we just received a char */
 serial_receive1(s, s-tsr, 1);
 } else if (qemu_chr_write(s-chr, s-tsr, 1) != 1) {
-if ((s-tsr_retry  0)  (s-tsr_retry = MAX_XMIT_RETRY)) {
+if ((s-tsr_retry = 0)  (s-tsr_retry = MAX_XMIT_RETRY)) {
 s-tsr_retry++;
 qemu_mod_timer(s-transmit_timer,  new_xmit_ts + s-char_transmit_time);
 return;


signature.asc
Description: This is a digitally signed message part.


Re: [Qemu-devel] Re: hw/serial.c: Xmit fifo never used

2010-05-26 Thread Frank Mehnert
On Wednesday 26 May 2010, Stefano Stabellini wrote:
 I think the patch is correct.

serial: fixed bug which prevented the use of the xmit fifo

Signed-off-by: Frank Mehnert frank.mehn...@sun.com
---
 hw/serial.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/serial.c b/hw/serial.c
index 9102edb..0b1550b 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -327,7 +327,7 @@ static void serial_xmit(void *opaque)
 /* in loopback mode, say that we just received a char */
 serial_receive1(s, s-tsr, 1);
 } else if (qemu_chr_write(s-chr, s-tsr, 1) != 1) {
-if ((s-tsr_retry  0)  (s-tsr_retry = MAX_XMIT_RETRY)) {
+if ((s-tsr_retry = 0)  (s-tsr_retry = MAX_XMIT_RETRY)) {
 s-tsr_retry++;
 qemu_mod_timer(s-transmit_timer,  new_xmit_ts + 
s-char_transmit_time);
 return;
--
1.5.6.5



Hope this is now the correct format.

Kind regards,

Frank
-- 
Dr.-Ing. Frank Mehnert

Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Jürgen Kunz