From: brian Date: Wed, 5 May 2004 17:44:28 +0000 (-0700) Subject: more updates for gcc X-Git-Tag: merge~16 X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=commitdiff_plain;h=94617ade62211d11c80b1e87b2a4c822297dd43f more updates for gcc darcs-hash:20040505174428-24bed-3dd245ecf63b1077f95cda81941d6ab7f5b109db.gz --- diff --git a/src/org/ibex/nestedvm/Runtime.java b/src/org/ibex/nestedvm/Runtime.java index 63e8835..0543fd0 100644 --- a/src/org/ibex/nestedvm/Runtime.java +++ b/src/org/ibex/nestedvm/Runtime.java @@ -1319,6 +1319,7 @@ public abstract class Runtime implements UsermodeConstants,Registers,Cloneable { public boolean allowRead(File f) { return true; } public boolean allowWrite(File f) { return true; } public boolean allowStat(File f) { return true; } + public boolean allowUnlink(File f) { return true; } } // Null pointer check helper function diff --git a/src/org/ibex/nestedvm/RuntimeCompiler.java b/src/org/ibex/nestedvm/RuntimeCompiler.java index a722d9c..1a1a047 100644 --- a/src/org/ibex/nestedvm/RuntimeCompiler.java +++ b/src/org/ibex/nestedvm/RuntimeCompiler.java @@ -18,7 +18,7 @@ public class RuntimeCompiler { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ClassFileCompiler c = new ClassFileCompiler(data,className,baos); // FEATURE: make this Optional, pass options on compile arguments - c.parseOptions("unixruntime,nosupportcall"); + c.parseOptions("unixruntime,nosupportcall,maxinsnpermethod=512"); c.go(); baos.close(); byte[] bytecode = baos.toByteArray(); @@ -27,7 +27,7 @@ public class RuntimeCompiler { private static class SingleClassLoader extends ClassLoader { public Class loadClass(String name, boolean resolve) throws ClassNotFoundException { - System.err.println(this + ": loadClass(\"" + name + "," + resolve + ");"); + //System.err.println(this + ": loadClass(\"" + name + "," + resolve + ");"); return super.loadClass(name,resolve); } public Class fromBytes(String name, byte[] b) { return fromBytes(name,b,0,b.length); } @@ -39,13 +39,13 @@ public class RuntimeCompiler { } public static void main(String[] args) throws Exception { - if(args.length == 0) { - System.err.println("Usage: RuntimeCompiler mipsbinary"); + if(args.length == 0) { + System.err.println("Usage: RuntimeCompiler mipsbinary"); System.exit(1); } UnixRuntime r = (UnixRuntime) compile(new Seekable.File(args[0])).newInstance(); System.err.println("Instansiated: "+ r); - System.exit(r.run(args)); + System.exit(UnixRuntime.runAndExec(r,args)); } private RuntimeCompiler() { } diff --git a/src/org/ibex/nestedvm/UnixRuntime.java b/src/org/ibex/nestedvm/UnixRuntime.java index 151699f..6c986e5 100644 --- a/src/org/ibex/nestedvm/UnixRuntime.java +++ b/src/org/ibex/nestedvm/UnixRuntime.java @@ -34,7 +34,7 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { // FEATURE: Do the proper mangling for non-unix hosts String userdir = getSystemProperty("user.dir"); cwd = - userdir != null && userdir.startsWith("/") && File.separatorChar == '/' && HostFS.hostRootDir().getParent() == null + userdir != null && userdir.startsWith("/") && File.separatorChar == '/' && getSystemProperty("nestedvm.root") == null ? userdir.substring(1) : ""; } @@ -61,7 +61,7 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { } String[] createEnv(String[] extra) { - String[] defaults = new String[5]; + String[] defaults = new String[6]; int n=0; if(extra == null) extra = new String[0]; if(!envHas("USER",extra) && getSystemProperty("user.name") != null) @@ -71,6 +71,7 @@ public abstract class UnixRuntime extends Runtime implements Cloneable { if(!envHas("SHELL",extra)) defaults[n++] = "SHELL=/bin/sh"; if(!envHas("TERM",extra)) defaults[n++] = "TERM=vt100"; if(!envHas("TZ",extra)) defaults[n++] = "TZ=" + posixTZ(); + if(!envHas("PATH",extra)) defaults[n++] = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"; String[] env = new String[extra.length+n]; for(int i=0;i_errno = EINVAL; + return -1; + } +} + DIR *opendir(const char *path) { struct stat sb; int fd;