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?
JVM as a CPU
- Kevin McGuire
- Member
- Posts: 843
- Joined: Tue Nov 09, 2004 12:00 am
- Location: United States
- Contact:
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.
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.
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..);
Hi,
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.
Just for kicks.What's the point?
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.I can say that you will most likely end up exposing these machine features through objects using some sort of mechanism.
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.