2003/11/03 02:10:52
[org.ibex.core.git] / src / org / xwt / mips / VM.java
index 08fee29..b0bbf7b 100644 (file)
@@ -1,7 +1,7 @@
 package org.xwt.mips;
 import java.io.*;
 
-abstract class VM implements Syscalls, Errno {
+public abstract class VM implements Syscalls, Errno {
     // Register Names
     protected final static int ZERO = 0; // Immutable, hardwired to 0
     protected final static int AT = 1;  // Reserved for assembler
@@ -125,7 +125,7 @@ abstract class VM implements Syscalls, Errno {
             int end = start + (min(PAGE_SIZE-(addr&(PAGE_SIZE-1)),(length-n)&~3) >> 2);
             int[] page = readPages[addr >>> PAGE_SHIFT];
             if(page == null) throw new ReadFaultException(addr);
-            if(page == emptyPage) { addr+=(end-start); n+=(end-start); continue; }
+            if(page == emptyPage) { addr+=(end-start)<<2; n+=(end-start)<<2; continue; }
             for(int i=start;i<end;i++,addr+=4) {
                 int word = page[i];
                 a[n++] = (byte)((word>>>24)&0xff); a[n++] = (byte)((word>>>16)&0xff);
@@ -504,7 +504,7 @@ abstract class VM implements Syscalls, Errno {
     }
     
     // Helper function to read a cstring from main memory
-    private String cstring(int addr) throws ReadFaultException {
+    public String cstring(int addr) throws ReadFaultException {
         StringBuffer sb = new StringBuffer();
         for(;;) {
             int word = memRead(addr&~3);