X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fnestedvm%2FRuntime.java;h=2f23d1c9fa61f0fdbb9b3ac0ba3c7c41132168f6;hp=fc97e71ecf3984b5e631ceeab207e3fcde3aa400;hb=ba59dfdff778e2a1b0dbe38b19534a8e775f4a4b;hpb=efbc1822d80a8fb04447731bb33d64d3537f8121 diff --git a/src/org/ibex/nestedvm/Runtime.java b/src/org/ibex/nestedvm/Runtime.java index fc97e71..2f23d1c 100644 --- a/src/org/ibex/nestedvm/Runtime.java +++ b/src/org/ibex/nestedvm/Runtime.java @@ -9,6 +9,9 @@ import java.io.*; import java.util.Arrays; public abstract class Runtime implements UsermodeConstants,Registers,Cloneable { + /** True to write useful diagnostic information to stderr when things go wrong */ + final static boolean STDERR_DIAG = true; + /** Number of bits to shift to get the page number (1<<= OPEN_MAX) return -EBADFD; if(fds[fdn] == null) return -EBADFD; byte[] buf = byteBuf(count); copyin(addr,buf,count); - return fds[fdn].write(buf,0,count); + try { + return fds[fdn].write(buf,0,count); + } catch(ErrnoException e) { + if(e.errno == EPIPE) sys_exit(128+13); + throw e; + } } /** The read syscall */ @@ -864,7 +870,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable { switch(n) { case _SC_CLK_TCK: return 1000; default: - System.err.println("WARNING: Attempted to use unknown sysconf key: " + n); + if(STDERR_DIAG) System.err.println("WARNING: Attempted to use unknown sysconf key: " + n); return -EINVAL; } } @@ -887,7 +893,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable { try { for(int i=start;i