fix sltiu
authorbrian <brian@brianweb.net>
Wed, 5 May 2004 17:35:40 +0000 (10:35 -0700)
committerbrian <brian@brianweb.net>
Wed, 5 May 2004 17:35:40 +0000 (10:35 -0700)
darcs-hash:20040505173540-24bed-47616f1354328f7c39259de93c950e7e75125ca6.gz

src/org/ibex/nestedvm/ClassFileCompiler.java
src/org/ibex/nestedvm/Interpreter.java
src/org/ibex/nestedvm/JavaSourceCompiler.java
src/tests/Simple.c
upstream/patches/newlib-mips.patch

index a7f035c..208e365 100644 (file)
@@ -1136,7 +1136,7 @@ public class ClassFileCompiler extends Compiler implements org.apache.bcel.Const
             a(InstructionConstants.I2L);
             pushConst(0xffffffffL);
             a(InstructionConstants.LAND);
-            pushConst((long)unsignedImmediate);
+            pushConst((long)signedImmediate);
             a(InstructionConstants.LCMP);
             
             b1 = a(InstructionFactory.createBranchInstruction(IFLT,null));
index c840312..1fcdc4b 100644 (file)
@@ -65,6 +65,7 @@ public class Interpreter extends UnixRuntime {
         try {
             insn = readPages[pc>>>pageShift][(pc>>>2)&PAGE_WORDS-1];
         } catch (RuntimeException e) {
+            if(pc == 0xdeadbeef) throw new Error("fell off cpu: r2: " + r[2]);
             insn = memRead(pc);
         }
 
@@ -270,7 +271,7 @@ public class Interpreter extends UnixRuntime {
                 r[rt] = r[rs] < signedImmediate ? 1 : 0;
                 break;
             case 11: // SLTIU
-                r[rt] = (r[rs]&0xffffffffL) < (unsignedImmediate&0xffffffffL) ? 1 : 0;
+                r[rt] = (r[rs]&0xffffffffL) < (signedImmediate&0xffffffffL) ? 1 : 0;
                 break;
             case 12: // ANDI
                 r[rt] = r[rs] & unsignedImmediate;
index a983b58..f7f2353 100644 (file)
@@ -600,7 +600,7 @@ public class JavaSourceCompiler extends Compiler {
                 p( "r"+rt+" = r"+rs+" < "+signedImmediate+" ? 1 : 0;");
                 break;
             case 11: // SLTIU
-                p( "r"+rt+" = (r"+rs+"&0xffffffffL) < ("+unsignedImmediate+"&0xffffffffL) ? 1 : 0;");
+                p( "r"+rt+" = (r"+rs+"&0xffffffffL) < ("+signedImmediate+"&0xffffffffL) ? 1 : 0;");
                 break;
             case 12: // ANDI
                 p( "r"+rt+" = r"+rs+" & "+unsignedImmediate+";");
index bb8452e..b55c272 100644 (file)
@@ -4,6 +4,8 @@ char *a = "bar";
 
 volatile char buf[] = "Hello World";
 
+long long l = -1614907703LL;
+
 int _start() {
-    return strlen("foo");
+    return l >= -64;
 }
index 5746917..889a32f 100644 (file)
@@ -105,7 +105,7 @@ diff -urN ../newlib-1.11.0.orig/newlib/configure.host ./newlib/configure.host
        syscall_dir=syscalls
        ;;
 +  mips*-unknown-elf*)
-+       newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_GETTIMEOFDAY -DHAVE_FCNTL -DHAVE_OPENDIR"
++       newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_GETTIMEOFDAY -DHAVE_FCNTL -DHAVE_OPENDIR -DWANT_PRINTF_LONG_LONG"
 +       syscall_dir=syscalls
 +        ;;
    mmix-*)