Re: [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add/subtract

2006-05-01 Thread Stefan Weil
Dirk Behme schrieb: Fix overflow conditions for MIPS add/subtract as proposed by Daniel Jacobowitz. http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00538.html Regards Dirk --- target-mips/op.c_orig

Re: [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add/subtract

2006-05-01 Thread Fabrice Bellard
OK. I hope this is correct now :-) Just a note : there is already a lot of code in QEMU to compute correctly the overflow and carry flags (for example in the i386 target)... don't spend your time on reinventing them ! Fabrice. Dirk Behme wrote: Fix overflow conditions for MIPS

Re: [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add/subtract

2006-05-01 Thread Daniel Jacobowitz
On Mon, May 01, 2006 at 08:42:08PM +0200, Stefan Weil wrote: - if (((tmp ^ T1 ^ (-1)) (T0 ^ T1)) 31) { + if (~(T0 ^ T1) (T0 ^ tmp) 0x8000) { Hello Dirk, which additions / subtractions are handled incorrectly by the current code? Here is the result of a test which shows that the

Re: [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add/subtract

2006-05-01 Thread Fabrice Bellard
The current code seems correct to me too (it is the same as the x86 reference). Fabrice. Stefan Weil wrote: Dirk Behme schrieb: Fix overflow conditions for MIPS add/subtract as proposed by Daniel Jacobowitz. http://lists.gnu.org/archive/html/qemu-devel/2006-04/msg00538.html

Re: [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add / subtract

2006-04-28 Thread Daniel Jacobowitz
On Thu, Apr 13, 2006 at 08:49:19PM +0200, Stefan Weil wrote: -if ((T0 31) ^ (T1 31) ^ (tmp 31)) { +if (((tmp ^ T1 ^ (-1)) (T0 ^ T1)) 31) { + /* operands of same sign, result different sign */ CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW); } I see this

Re: [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add / subtract

2006-04-28 Thread Dirk Behme
Daniel Jacobowitz wrote: I haven't tested the patched qemu, but I did test the expressions themselves in standalone code, and they definitely do not detect overflow. Maybe you can test Ralf's alternative proposal http://lists.gnu.org/archive/html/qemu-devel/2006-02/msg00154.html as well?

Re: [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add / subtract

2006-04-28 Thread Daniel Jacobowitz
On Fri, Apr 28, 2006 at 04:51:39PM +0200, Dirk Behme wrote: Daniel Jacobowitz wrote: I haven't tested the patched qemu, but I did test the expressions themselves in standalone code, and they definitely do not detect overflow. Maybe you can test Ralf's alternative proposal

Re: [Qemu-devel] [PATCH] Fix overflow conditions for MIPS add / subtract

2006-04-28 Thread Julian Seward
-if ((T0 31) ^ (T1 31) ^ (tmp 31)) { +if (((tmp ^ T1 ^ (-1)) (T0 ^ T1)) 31) { + /* operands of same sign, result different sign */ CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW); } I see this went in, but - huh? The math doesn't make sense.

[Qemu-devel] [PATCH] Fix overflow conditions for MIPS add / subtract

2006-04-13 Thread Stefan Weil
Hi, I had problems with MIPS system emulation (AR7 based DSL router) which were caused by wrong overflow exceptions. With the patch given below emulation works. See this link for first results: http://forum.openwrt.org/viewtopic.php?id=4381 In user mode emulation, the MIPS emulation currently