Slashdot Mirror


Java-Based x86 Emulator

jaavaaguru writes "Researchers at Oxford University have produced a Java-based x86 emulator that they hope will be useful in testing applications and learning about viruses without damaging the host, utilizing the robust sandboxing that Java provides. They have an online demo available that boots DOS and has some games to play. Being purely Java, this emulator should be able to run on almost anything, including cell phones." The code is not yet available outside the Oxford community; the developers are said to be working on a suitable general license. In the meantime the code can be licensed on a case-by-case basis.

43 of 263 comments (clear)

  1. Interesting, but by dreamchaser · · Score: 5, Funny

    I can only imagine that this will make even Bochs look fast in comparison!

    Still, I'd love to tinker with this from a 'gee whiz' standpoint.

    1. Re:Interesting, but by Qwertie · · Score: 5, Interesting

      I'd have to agree. Using instruction-by-instruction emulation, a C++ based SNES emulator I wrote around 1998 used at least 150Mhz of processing power to emulate the SNES' 3Mhz processor. When I rewrote it in assembly, it was 5-10 times faster. I expect that some pretty sophisticated techniques would be required to exceed a snail's pace when using Java for emulation, eg "dynamic recompilation": translating sections of x86 machine language to Java bytecode... but getting this to work 100% correctly would be pretty tricky.

      If it's hard to get good emulation speed in C++, it's even harder in Java.

    2. Re:Interesting, but by chorltonian · · Score: 3, Insightful

      Errm... how about trying it out before judging it? As has been covered god knows how many times before, Java is capable of runtime optimisations not possible with statically compiled languages like C++.

    3. Re:Interesting, but by Victor+Antolini · · Score: 2, Informative

      A little bit of searching brought this

      Btw, here's a Gameboy emulator written in Visual Basic!
      It's quite fast... puzzling.

    4. Re:Interesting, but by shaitand · · Score: 5, Funny

      'Java is capable of runtime optimisations not possible with statically compiled languages like C++.'

      And with them it can perform almost as fast as C in some fringe cases.

    5. Re:Interesting, but by Citizen+of+Earth · · Score: 2, Interesting

      Java is capable of runtime optimisations not possible with statically compiled languages like C++.

      There is a world of difference between "theoretically capable" and "reliable does". Is there some practical demonstration that compute-intensive tasks like emulation can be reliably executed with Java without sucking?

    6. Re:Interesting, but by Anonymous Coward · · Score: 5, Insightful
      Don't you know, around here:
      • All Java is slow
      • All Perl is unreadable
      • All PHP is insecure
      • All JavaScript is a useless intrusion into your browser
      ... and all comments like those are written by "experts" who've never written one line in the language in question.
    7. Re:Interesting, but by MobyTurbo · · Score: 3, Insightful

      Errm... how about trying it out before judging it? As has been covered god knows how many times before, Java is capable of runtime optimisations not possible with statically compiled languages like C++. Maybe so, but it is running much slower than DOSEMU or DOSBOX does in Linux here, which are probably written in C or C++, with possibly some assembly; and can do emulation of all the games it emulates. Java is indeed capable of certain optimizations that are not done in a non-JIT compiler, but that simply is because it needs them. Anyone who tells you that Java operating system emulators typically run faster than C operating system emulators has been smoking SUNW crack. That having been said, there are reasons for choosing Java over C. One of them is built-in security sandboxing, which was obviously the reason for the choice.
    8. Re:Interesting, but by tomhudson · · Score: 2, Insightful

      Errm... how about trying it out before judging it?

      errm ... how about because the applet failed to load?

      If you go to the site, you'll see their premise is stupid - that game companies will license this to sell old dos games on cell phones, rather than porting them. Of course what they overloook is once you have the emulator, you don't need the game companies - just go through any abandonware site, or your stacks of old floppies.

    9. Re:Interesting, but by ConceptJunkie · · Score: 2, Funny

      Ridiculous! Java can perform NOPs as fast as any compiled language.

      --
      You are in a maze of twisty little passages, all alike.
    10. Re:Interesting, but by heinousjay · · Score: 3, Insightful

      Awesome, you've successfully combined unnecessary anger, anecdotal evidence, the arrogant assumption that only your opinion matters, a Slashdot meme, and a bunch of insults into one post. I think you get some kind of award for that.

      --
      Slashdot - where whining about luck is the new way to make the world you want.
  2. So... by mriya3 · · Score: 5, Funny

    ... now we should say: "x86 assembler: write once, run everywhere (slow as molasses in January)" ?

  3. How's the efficiency? by lbft · · Score: 2, Interesting

    Whilst this looks like a really interesting project, I'm failing to see how it's useful generally due to the limitations of writing it in Java and making it cross-platform. You would lose a lot of those possible (processor- or platform-specific) optimisations that make the leaders in the virtualisation market as fast as they are.

    On, say, a mobile phone (which is mentioned by the site as a possible use) would there be enough processing grunt to do anything useful? I know Java's not as slow as some people would have you believe, but virtualisation requires as much speed to be squeezed out as possible to be usable.

    On a desktop, what advantage does this have over the existing virtualisation options which don't have to deal with the Java environment?

    1. Re:How's the efficiency? by sumdumass · · Score: 2, Insightful

      I don't think this is meant for a general purpose vitalization application. This is more or less a research on what something does project. More specifically, You can take a virus and run in it a way to compromise the virtual machine without compromising the machine itself. This means your output is not likely to be damaged in any ways as well as you can monitor the activity from a removed setting while maintaining a presence.

      And this wouldn't be just limited to a virus program either. Suppose we had this around when sony distributed their root kit. The root kit would have likely been found faster seeing how it hides in the OS but not outside the sandbox. Also, take something like WGA. What exactly does it do? Well, we have found more and more about it as time goes on but we never had the ability to discover it all at once.

      But wait, it gets better. Suppose I have a program and are all the sudden getting calls that it doesn't work after update# 2 from some other company pertaining to some other product. I could use this virtual machine to watch how the interactions between my program and this other program or see were the files were changed easily and make adjustments accordingly. This would be exceptionally usefully if some other program is a competing business who wants to blame everything on your bad programing.

      Now some of this can be addressed by existing virtualization and processes already available. But the sand box functioning available with Java makes it less likely the problem can spread somewhere else un noticed.

    2. Re:How's the efficiency? by slamb · · Score: 4, Insightful

      More specifically, You can take a virus and run in it a way to compromise the virtual machine without compromising the machine itself. This means your output is not likely to be damaged in any ways as well as you can monitor the activity from a removed setting while maintaining a presence.

      Well, that's great, but you can already do that with VMware, Parallels, QEMU, or other virtualization tools. Sure, virtualization requires the same host and guest architecture, but we all have plenty of x86 machines sitting around, and near-native speeds are necessary to actually boot Windows Vista before the sun goes supernova. So while this is neat software, it's not as suitable for malware researchers as what they are already using. The JPC project needs to find a different niche.

    3. Re:How's the efficiency? by Gromius · · Score: 2, Interesting

      Actually I think it is for general purpose code. In fact I think its main purpose is for running general code on the grid and giving each process its own virtual sandbox, isolating it from the underlining hardware. This means that some random grid user wont be able to hose the machine they happen to be using which should make things easier from a grid admins point of view. Its the only reason I can possibly think of why they made it.

      Incidently when I first heard about this today, I thought it would be the comp sci dept but it turns out its particle physics, which surprised me as I'm a member of the oxford group but on a different experiment. I am still reasonably baffled why they have done this, will have to ask them on monday. This probably explains the current sad state of the ATLAS software as they are all too busy getting Commander Keen to run on their mobile phones :)

    4. Re:How's the efficiency? by kestasjk · · Score: 3, Informative

      near-native speeds are necessary to actually boot Windows Vista before the sun goes supernova.
      The sun isn't close to large enough to end in a supernova; it'll be a red giant, then end as a white dwarf.
      --
      // MD_Update(&m,buf,j);
  4. Java x86 emulator speed by christurkel · · Score: 4, Funny

    Java only: snail speed
    Java+DOS: Snail with ball and chain
    Java+DOS on non x86: Snail nailed to the table

    --

    CDE open sourced! https://sourceforge.net/projects/cdesktopenv/
  5. So it runs DOS eh? by ookabooka · · Score: 4, Funny

    But can it run Linux. . .?

    Why did they use Java? It would have been faster in C++.

    I for one welcome our new old x86 overlords.

    Did I miss any?

    --
    If you are about to mod me down, keep in mind that this post was most likely sarcastic.
    1. Re:So it runs DOS eh? by HoosierPeschke · · Score: 4, Funny

      In Soviet Russia x86 emulates Java?

      --
      Mr. Universe: "They can't stop the signal, Mal. They can never stop the signal."
  6. What do you do when it crashes? by CTho9305 · · Score: 2, Insightful

    I was playing around with DEBUG.COM and ran "OUT 20, AX"...and now it's apparently dead. A lot of things don't seem to work - e.g. "mode 80,20". Even "dir c:" when the current drive is "a:" seems to hang. I wonder how complete the hardware emulation is. Can you run Windows 3.1 on this? How about programs that probe for a joystick?

  7. Re:Comparisons to other emulators? by dreamchaser · · Score: 2, Insightful

    Both of those need to be ported to the target OS that they will be hosted on. A java based emulator doesn't need to be ported.

  8. Well for one by brunes69 · · Score: 5, Interesting

    For one this will let you run X86 DOS applications on a SPARC for example.

    I'd like you to point me to the support page for VMWare on SPARC... oh wait that's cause there isn't one. QEMU can't even run most applications on a SPARC.

    And forget about ARM.

    I think this is great. Java is not as slow as people seem to think it is. One thing Java 5 (and 6) have that actually benefits virtualization is dynamic recompilation... the JVM knows the instruction sdequences better than the original author, and in theory can optimize the code paths in ways writing a virtualizer in assembly or C++ can not.

    1. Re:Well for one by EvilIdler · · Score: 2, Interesting

      Java isn't all that slow, but the bad rep is because of its startup time and a really unoptimised GUI.
      It's fine for all sorts of things while running, but the two apps I use it for aren't exactly impressive.
      If I leave Azureus up for a while, it's eating 400 megs of memory. It also takes 10+ seconds to show
      its window. The other thing I regularly use Java for is my bank, which insists on using a friggin'
      control in its window. It takes about a minute to show up, even with other Java apps running. It seems
      the startup time is a per-process thing, not the entire loading of libraries and stuff.

      I recently installed Eclipse, and it's a world apart from the slowness of the bank webapp and Azureus.
      Starts up immediately, ready to rock. I may start using it once I figure out how :P

    2. Re:Well for one by daeg · · Score: 5, Informative

      If you are using Firefox with Java and having ridiculous applet startup times, you need to disable your Java Cache. This is Java's fault, not Firefox's (supposedly).

      Under the Java control applet, under the General tab, click "Settings..." under "Temporary Internet Files". Then click "View Applets...". It will take a moment to load (or in my case, 2-3 minutes). Then UNcheck "Enable Caching". Firefox now starts my applets almost instantly. This doesn't affect downloaded Java applications such as Azureus or Eclipse (both of which I use extensively).

      Hope this helps.

    3. Re:Well for one by jimmydevice · · Score: 2, Interesting

      I did something even slower in 1973. A Cardiac ( Bell Labs cardboard computer ) emulator written in FORTRAN, running on a FORTRAN emulator written in HP 2000 BASIC running on a HP2100 mini. Cycle time = one instruction / Sec.
      It could play tic-tac-toe, Very slowly.

  9. on a good Java runtime... by dshk · · Score: 2, Insightful

    if the emulator itself runs on x86 then the just in time compiler of the Java runtime may optimize the code enough that we get back almost the original assembly code... but without any buffer overflows and other security problems - theoretically.

  10. Molasses - 35mph! by Anonymous Coward · · Score: 3, Interesting
  11. can you run java in the x86? by leuk_he · · Score: 5, Interesting

    THe next question would be: can you run java in the x86 emulator that runs an other emulator that runs java, that runs an other emulator.

    Just like the old days when you ran windows real mode under a windows 386 mode windows.

    1. Re:can you run java in the x86? by faragon · · Score: 2, Informative

      Why not? Just you get execution speed and available memory progressively downgraded/shrinked (doing it ad infinitum or ad nauseam , until you're out of memory for the next emulation context) :~P

    2. Re:can you run java in the x86? by Citizen+of+Earth · · Score: 4, Funny

      The next question would be: can you run java in the x86 emulator that runs an other emulator that runs java, that runs another emulator.

      ...written in XSLT.

    3. Re:can you run java in the x86? by Cyberax · · Score: 4, Funny

      Yes.

      The next step is to get rid of hardware altogether.

    4. Re:can you run java in the x86? by Pseudonym · · Score: 2, Funny

      It's turtles all the way down, I tell you!

      --
      sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    5. Re:can you run java in the x86? by timeOday · · Score: 3, Funny

      Linux on emulated hardware can be faster than Linux on real hardware:
      There you go, a perpetual speedup machine. Run enough layers of Java on X86 on Java on X86 and supercomputers will be replaced by Cyrix 386s.
  12. Re:Ah, a Java-based x86 emulator... by gravis777 · · Score: 2, Informative

    Since when did emulators become news on slashdot? Its still buggy too. No mouse support (makes playing Lemmings a pain), graphic corruption in some places in Lemmings, arrow keys get effed up when playing Prince of Persia, no sound support, and, well, its kinda slow. Some lagging in Prince of Persia, and I am on a p4. Now, did the original post say that they wanted to use this to test viruses? Please tell me they are not planning on installing windows on this thing.

    Although I would smile if they installed Windows 3.1 and the thing dropped into dosshell when you exited. Of course many licensing things there. I guess there is no licensing issues showing off a product you are trying to license with shareware titles, is there?

  13. Re:Comparisons to other emulators? by badfish99 · · Score: 3, Funny

    A java based emulator doesn't need to be ported.
    That's the huge advantage of java. Just port the 100 meg or so of JVM, throw in a faster processor and a few more gigs of memory, and it'll run on anything.

  14. Re:Can I conclude: Survive /. effect = robust by animaal · · Score: 2, Insightful

    If this webapp. survives a lot of geeks messing and hacking about in that virtual machine I'd be very tempted to label this as a very interesting experience when it comes to the Java robustness factor. There's no danger to the virtual machine. The emulator and disc images are all run within the browser. So each browser receives its own emulated memory space and fresh disc images. No processing occurs on the server (except for serving the application code and disc images to the browser).
  15. Compared to what? by alienmole · · Score: 2, Insightful

    You're missing something here. Sure, Java is faster than some languages like Python or Ruby or PHP, but that doesn't necessarily put it in the realm of languages that are a good choice for implementing hardware emulators. There are many other languages that would be faster and, at the same time, more high-level than Java. (The ML family comes to mind.) The Java sandbox argument they use in this case is rather bogus - if you're writing an emulator, you can easily build sandbox functionality into it. In short, the choice of Java for this project is nowhere near as rational as the authors would have you believe. They probably chose it because that's what they were familiar with, or because it helped them get funding.

  16. Other projects doing the same/faster thing.. by Boj · · Score: 3, Informative

    There are at least 2 solutions doing a similar thing. The open source binarytranslator.org/PearColator offers x86 and PowerPC emulation:
    http://binarytranslator.org/
    There are attempts to integrate this into the JNode open source Java OS to make a JNode/GNU stack.

    There is also the VEELS/JXEmu system:
    http://nil.ics.uci.edu/~gal/?page=VEELS
    which appears not to be publicly available.

  17. My intepretation by Excelcia · · Score: 4, Funny

    An interpreted language being used to write an opcode interpreter.

    For an encore, perhaps they can write a JVM in BASIC.

    WARNING: Performance implosion imminent due to recursive interpretation.

  18. Why not Simics? by Anonymous Coward · · Score: 2, Informative

    I can get Simics for free if I am an academic and Simics gives over 300 MIPS on 2GHz AMD64s (and probaly a lot more on the Core 2 CPU). I really fail to see the use of something that probably is dog slow, written in Java, and probably cannot do reverse execution. Oh, btw, Simics does x86, x86-64, SPARC V8/V9, PPC32/64, MIPS32/64, ARM and perhaps some more.

    Can someone explain the advantages of the Java based x86-emu in TFA over something like Simics?

  19. Re:license by mohjlir · · Score: 2, Insightful

    So should we just run OSS news? Then all the MS trolls would have to get jobs! Seriously, this is news no matter what the copyright holders intend to do (or charge) for the software.

  20. Flamebait?? by Weaselmancer · · Score: 2, Insightful

    Hey mod, I'm serious and I'm making a serious point.

    Porting the JVM somewhere is about as much effort as porting a word processor, or any other 100 meg application. But if you port the JVM, all the applications you have in Java are ported by proxy. It's a one-time task.

    So if your 100 meg word processor is in Java, once you port the JVM you get the word processor for free. And all of your other Java applications. You don't have to port them seperately. It's one porting task and then you're done.

    And now that the JVM is open source, you can expect that to happen more often. It's part of the beauty of running VM based languages.

    --
    Weaselmancer
    rediculous.