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
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);
}
// 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);