X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fnestedvm%2FRuntime.java;h=e72ef9426f5209e05ab5536dc667cd4a7e94a56b;hp=4618dc38de00aff6f4efbcb2c79159b9602abb47;hb=4a26f91aad32c62d7407e0a2dc04c5cb44c74043;hpb=3e206c53f6ee3d09c3bb781526c0fe01bf8f6c75 diff --git a/src/org/ibex/nestedvm/Runtime.java b/src/org/ibex/nestedvm/Runtime.java index 4618dc3..e72ef94 100644 --- a/src/org/ibex/nestedvm/Runtime.java +++ b/src/org/ibex/nestedvm/Runtime.java @@ -102,7 +102,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable { /** Subclasses should return the address of the symbol symbol or -1 it it doesn't exits in this method This method is only required if the call() function is used */ - protected int lookupSymbol(String symbol) { return -1; } + public int lookupSymbol(String symbol) { return -1; } /** Subclasses should populate a CPUState object representing the cpu state */ protected abstract void getCPUState(CPUState state); @@ -704,6 +704,20 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable { if(state == EXITED || state == EXECED) throw new IllegalStateException("closeFD called in inappropriate state"); if(fdn < 0 || fdn >= OPEN_MAX) return false; if(fds[fdn] == null) return false; + + // release all fcntl locks on this file + Seekable s = fds[fdn].seekable(); + if (s != null) { + try { + for (int i=0; i < LOCK_MAX; i++) { + if (locks[i] != null && s.equals(locks[i].seekable())) { + locks[i].release(); + locks[i] = null; + } + } + } catch (IOException e) { throw new RuntimeException(e); } + } + fds[fdn].close(); fds[fdn] = null; return true; @@ -1252,6 +1266,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable { /** Helper function to read a cstring from main memory */ public final String cstring(int addr) throws ReadFaultException { + if (addr == 0) return null; StringBuffer sb = new StringBuffer(); for(;;) { int word = memRead(addr&~3);