make nestedvm work under SableVM
[nestedvm.git] / src / org / ibex / nestedvm / Runtime.java
index 5a1a895..a54fbc2 100644 (file)
@@ -6,7 +6,6 @@ package org.ibex.nestedvm;
 
 import org.ibex.nestedvm.util.*;
 import java.io.*;
-import java.util.Arrays;
 
 public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
     public static final String VERSION = "1.0";
@@ -47,10 +46,10 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
     /** When the process started */
     private long startTime;
     
-    /**  Text/Data loaded in memory  */
-    public final static int STOPPED = 0;
     /** Program is executing instructions */
-    public final static int RUNNING = 1;
+    public final static int RUNNING = 0; // Horrible things will happen if this isn't 0
+    /**  Text/Data loaded in memory  */
+    public final static int STOPPED = 1;
     /** Prgram has been started but is paused */
     public final static int PAUSED = 2;
     /** Program is executing a callJava() method */
@@ -159,7 +158,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
             }
         }
     
-        InputStream stdin = Boolean.valueOf(getSystemProperty("nestedvm.textstdin")).booleanValue() ? new TextInputStream(System.in) : System.in;
+        InputStream stdin = Boolean.valueOf(Platform.getProperty("nestedvm.textstdin")).booleanValue() ? new TextInputStream(System.in) : System.in;
         addFD(new TerminalFD(stdin));
         addFD(new TerminalFD(System.out));
         addFD(new TerminalFD(System.err));
@@ -1237,7 +1236,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         public FStat _fstat() { return new FStat() { public int type() { return S_IFCHR; } public int mode() { return 0600; } }; }
     }
     
-    // FEATURE: TextInputStream: This is pretty inefficient but it is only used for reading from the console on win32
+    // This is pretty inefficient but it is only used for reading from the console on win32
     static class TextInputStream extends InputStream {
         private int pushedBack = -1;
         private final InputStream parent;
@@ -1394,14 +1393,6 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
         return _byteBuf;
     }
     
-    static String getSystemProperty(String key) {
-        try {
-            return System.getProperty(key);
-        } catch(SecurityException e) {
-            return null;
-        }
-    }
-    
     /** Decode a packed string */
     protected static final int[] decodeData(String s, int words) {
         if(s.length() % 8 != 0) throw new IllegalArgumentException("string length must be a multiple of 8");