JVM as a CPU

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
dushara
Posts: 10
Joined: Sun Jul 01, 2007 2:42 am

JVM as a CPU

Post by dushara »

Just curious. Are JVMs sort of CPUs?

Just for kicks, I'm wondering if I can port an RTOS kernel I've written to a JVM.

The (wacky) idea I have is to write the kernel using C (which could be translated to Java byte code using NestedVM http://nestedvm.ibex.org) and Jamaica http://www.judoscript.com/articles/jamaica.html.

This leads me to the question, do JVMs have some sort of interrupt mechanism or will it need to be emulated by maybe using the host OS threads?
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

Have you checked out Jnode?

PS: I don't believe translating the C will work. The C interfaces with the x86 hardware. The JVM has a different architecture.
C8H10N4O2 | #446691 | Trust the nodes.
User avatar
Kevin McGuire
Member
Member
Posts: 843
Joined: Tue Nov 09, 2004 12:00 am
Location: United States
Contact:

Post by Kevin McGuire »

I am know very little about Java, but what I do know: I can say that you will most likely end up exposing these machine features through objects using some sort of mechanism.

This makes it a pretty advanced task in which you would need to know the internals of Java quite well I would imagine.

Since C# is pretty similar to Java I could give a example where if I wrote a Just-In-Time-Compiler/(JVM) it would have to be written in such a way to marshal these interrupts into calls where in which the calls might be registered via a the creation of a object that normal C# code could interact with.

Code: Select all

namespace Vogree.System.Machine
{
    public abstract unsafe class InterruptRouter
    {
          public static void RegisterHook(uint vector, ...Delegate..);
    }
}


// normal C# code to hook a interrupt (interface with machine specific mechanisms) 
Vogree.System.Machine.InterruptRouter.RegisterHook(0, ...Function Delegate..);
Not really sure much about going any deeper, but hopefully someone else can explain a way or give some insight into how to do this better than me.
User avatar
dc0d32
Member
Member
Posts: 69
Joined: Thu Jun 09, 2005 11:00 pm
Location: Right here

Post by dc0d32 »

I'm wondering if I can port an RTOS kernel I've written to a JVM.
What's the point?
dushara
Posts: 10
Joined: Sun Jul 01, 2007 2:42 am

Post by dushara »

Hi,
What's the point?
Just for kicks.
I can say that you will most likely end up exposing these machine features through objects using some sort of mechanism.
What I have in mind avoids Java altogether. A C compiler (there's one called gccjvm which is not released yet), generates the byte code, maybe use Jamaica for the bits that require assembler.


The only thing that I'm not sure about is how interrupts will be generated. I'm not sure if "events" can be injected into the JVM.
Post Reply