public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
public static final String VERSION = "1.0";
public abstract class Runtime implements UsermodeConstants,Registers,Cloneable {
public static final String VERSION = "1.0";
/** Prgram has been started but is paused */
public final static int PAUSED = 2;
/** Program is executing a callJava() method */
/** Prgram has been started but is paused */
public final static int PAUSED = 2;
/** Program is executing a callJava() method */
if(page == null) throw new WriteFaultException(a<<2);
int index = a&pageWordMask;
int n = min(c,pageWords-index);
if(page == null) throw new WriteFaultException(a<<2);
int index = a&pageWordMask;
int n = min(c,pageWords-index);
- Arrays.fill(page,index,index+n,fourBytes);
+ /* Arrays.fill(page,index,index+n,fourBytes);*/
+ for(int i=index;i<index+n;i++) page[i] = fourBytes;
} catch(FileNotFoundException e) {
if(e.getMessage() != null && e.getMessage().indexOf("Permission denied") >= 0) throw new ErrnoException(EACCES);
return null;
} catch(FileNotFoundException e) {
if(e.getMessage() != null && e.getMessage().indexOf("Permission denied") >= 0) throw new ErrnoException(EACCES);
return null;
/** The open syscall */
private int sys_open(int addr, int flags, int mode) throws ErrnoException, FaultException {
/** The open syscall */
private int sys_open(int addr, int flags, int mode) throws ErrnoException, FaultException {
int stat(FStat fs, int addr) throws FaultException {
memWrite(addr+0,(fs.dev()<<16)|(fs.inode()&0xffff)); // st_dev (top 16), // st_ino (bottom 16)
memWrite(addr+4,((fs.type()&0xf000))|(fs.mode()&0xfff)); // st_mode
int stat(FStat fs, int addr) throws FaultException {
memWrite(addr+0,(fs.dev()<<16)|(fs.inode()&0xffff)); // st_dev (top 16), // st_ino (bottom 16)
memWrite(addr+4,((fs.type()&0xf000))|(fs.mode()&0xfff)); // st_mode
- memWrite(addr+8,1<<16); // st_nlink (top 16) // st_uid (bottom 16)
- memWrite(addr+12,0); // st_gid (top 16) // st_rdev (bottom 16)
+ memWrite(addr+8,fs.nlink()<<16|fs.uid()&0xffff); // st_nlink (top 16) // st_uid (bottom 16)
+ memWrite(addr+12,fs.gid()<<16|0); // st_gid (top 16) // st_rdev (bottom 16)
memWrite(addr+16,fs.size()); // st_size
memWrite(addr+20,fs.atime()); // st_atime
// memWrite(addr+24,0) // st_spare1
memWrite(addr+16,fs.size()); // st_size
memWrite(addr+20,fs.atime()); // st_atime
// memWrite(addr+24,0) // st_spare1
ret = callJavaCB.call(a,b,c,d);
} catch(RuntimeException e) {
System.err.println("Error while executing callJavaCB");
ret = callJavaCB.call(a,b,c,d);
} catch(RuntimeException e) {
System.err.println("Error while executing callJavaCB");
public TerminalFD(OutputStream os) { this(null,os); }
public TerminalFD(InputStream is, OutputStream os) { super(is,os); }
public void _close() { /* noop */ }
public TerminalFD(OutputStream os) { this(null,os); }
public TerminalFD(InputStream is, OutputStream os) { super(is,os); }
public void _close() { /* noop */ }
static class TextInputStream extends InputStream {
private int pushedBack = -1;
private final InputStream parent;
static class TextInputStream extends InputStream {
private int pushedBack = -1;
private final InputStream parent;